Commit 86e67ea8 authored by Cameron Armstrong (Nightfox)'s avatar Cameron Armstrong (Nightfox) Committed by Gargaj
Browse files

Fix warnings in Xcode 10 (#77)

parent 6a9e91c2
......@@ -61,7 +61,7 @@ int Platform::DefaultFontSize()
unsigned int Platform::DoubleClickTime()
{
return 500; // Half a second
return 500; // Half a second
}
bool Platform::MouseButtonBounce()
......@@ -296,8 +296,8 @@ void SurfaceImpl::MoveTo(float x, float y)
void SurfaceImpl::LineTo(float targetX, float targetY)
{
Renderer::RenderLine(
Renderer::Vertex( currentX+0.5f, currentY+0.5f, penColour.AsLong() ),
Renderer::Vertex( targetX+0.5f, targetY+0.5f, penColour.AsLong() )
Renderer::Vertex( currentX+0.5f, currentY+0.5f, (unsigned int)penColour.AsLong() ),
Renderer::Vertex( targetX+0.5f, targetY+0.5f, (unsigned int)penColour.AsLong() )
);
currentX = targetX;
currentY = targetY;
......@@ -334,10 +334,10 @@ void SurfaceImpl::FillRectangle(PRectangle rc, ColourDesired back)
Renderer::BindTexture(NULL);
Renderer::RenderQuad(
Renderer::Vertex( rc.left , rc.top, back.AsLong() ),
Renderer::Vertex( rc.right, rc.top, back.AsLong() ),
Renderer::Vertex( rc.right, rc.bottom, back.AsLong() ),
Renderer::Vertex( rc.left , rc.bottom, back.AsLong() )
Renderer::Vertex( rc.left , rc.top, (unsigned int)back.AsLong() ),
Renderer::Vertex( rc.right, rc.top, (unsigned int)back.AsLong() ),
Renderer::Vertex( rc.right, rc.bottom, (unsigned int)back.AsLong() ),
Renderer::Vertex( rc.left , rc.bottom, (unsigned int)back.AsLong() )
);
}
......@@ -395,10 +395,10 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font, float ybase, const cha
stbtt_GetBakedQuad( realFont->cdata, realFont->texture->width, realFont->texture->height, c, &x, &y, &quad, 1 );
Renderer::RenderQuad(
Renderer::Vertex( quad.x0, quad.y0, fore.AsLong(), quad.s0, quad.t0 ),
Renderer::Vertex( quad.x1, quad.y0, fore.AsLong(), quad.s1, quad.t0 ),
Renderer::Vertex( quad.x1, quad.y1, fore.AsLong(), quad.s1, quad.t1 ),
Renderer::Vertex( quad.x0, quad.y1, fore.AsLong(), quad.s0, quad.t1 )
Renderer::Vertex( quad.x0, quad.y0, (unsigned int)fore.AsLong(), quad.s0, quad.t0 ),
Renderer::Vertex( quad.x1, quad.y0, (unsigned int)fore.AsLong(), quad.s1, quad.t0 ),
Renderer::Vertex( quad.x1, quad.y1, (unsigned int)fore.AsLong(), quad.s1, quad.t1 ),
Renderer::Vertex( quad.x0, quad.y1, (unsigned int)fore.AsLong(), quad.s0, quad.t1 )
);
str += charLength;
len -= charLength - 1;
......
......@@ -66,10 +66,10 @@ namespace Renderer
struct Vertex
{
Vertex( float _x, float _y, unsigned int _c = 0xFFFFFFFF, float _u = 0.0, float _v = 0.0) :
x(_x), y(_y), u(_u), v(_v), c(_c) {}
x(_x), y(_y), c(_c), u(_u), v(_v) {}
float x, y;
float u, v;
unsigned int c;
float u, v;
};
void RenderQuad( const Vertex & a, const Vertex & b, const Vertex & c, const Vertex & d );
void RenderLine( const Vertex & a, const Vertex & b );
......
......@@ -210,7 +210,7 @@ void ShaderEditor::NotifyParent( Scintilla::SCNotification scn )
void ShaderEditor::CopyToClipboard( const Scintilla::SelectionText &selectedText )
{
Clipboard::Copy( selectedText.Data(), selectedText.Length() );
Clipboard::Copy( selectedText.Data(), (int)selectedText.Length() );
}
void ShaderEditor::SetMouseCapture( bool on )
......@@ -271,7 +271,7 @@ void ShaderEditor::GetText( char * buf, int len )
{
memset( buf, 0, len );
int lengthDoc = WndProc( SCI_GETLENGTH, NULL, NULL );
int lengthDoc = (int)WndProc( SCI_GETLENGTH, NULL, NULL );
Scintilla::TextRange tr;
tr.chrg.cpMin = 0;
......
......@@ -20,7 +20,7 @@ void ReplaceTokens( std::string &sDefShader, const char * sTokenBegin, const cha
&& sDefShader.find(sTokenBegin) < sDefShader.find(sTokenName)
&& sDefShader.find(sTokenName) < sDefShader.find(sTokenEnd))
{
int nTokenStart = sDefShader.find(sTokenBegin) + strlen(sTokenBegin);
int nTokenStart = (int)(sDefShader.find(sTokenBegin) + strlen(sTokenBegin));
std::string sTextureToken = sDefShader.substr( nTokenStart, sDefShader.find(sTokenEnd) - nTokenStart );
std::string sFinalShader;
......@@ -218,7 +218,7 @@ int main(int argc, const char *argv[])
memset( szShader, 0, 65535 );
fread( szShader, 1, 65535, f );
fclose(f);
if (Renderer::ReloadShader( szShader, strlen(szShader), szError, 4096 ))
if (Renderer::ReloadShader( szShader, (int)strlen(szShader), szError, 4096 ))
{
printf("Last shader works fine.\n");
shaderInitSuccessful = true;
......@@ -244,7 +244,7 @@ int main(int argc, const char *argv[])
ReplaceTokens(sDefShader, "{%midi:begin%}", "{%midi:name%}", "{%midi:end%}", tokens);
strncpy( szShader, sDefShader.c_str(), 65535 );
if (!Renderer::ReloadShader( szShader, strlen(szShader), szError, 4096 ))
if (!Renderer::ReloadShader( szShader, (int)strlen(szShader), szError, 4096 ))
{
printf("Default shader compile failed:\n");
puts(szError);
......@@ -338,7 +338,7 @@ int main(int argc, const char *argv[])
else if (Renderer::keyEventBuffer[i].scanCode == 286 || (Renderer::keyEventBuffer[i].ctrl && Renderer::keyEventBuffer[i].scanCode == 'r')) // F5
{
mShaderEditor.GetText(szShader,65535);
if (Renderer::ReloadShader( szShader, strlen(szShader), szError, 4096 ))
if (Renderer::ReloadShader( szShader, (int)strlen(szShader), szError, 4096 ))
{
// Shader compilation successful; we set a flag to save if the frame render was successful
// (If there is a driver crash, don't save.)
......@@ -370,7 +370,7 @@ int main(int argc, const char *argv[])
char utf8[5] = {0,0,0,0,0};
wchar_t utf16[2] = {Renderer::keyEventBuffer[i].character, 0};
Scintilla::UTF8FromUTF16(utf16, 1, utf8, 4 * sizeof(char));
mShaderEditor.AddCharUTF(utf8, strlen(utf8));
mShaderEditor.AddCharUTF(utf8, (unsigned int)strlen(utf8));
}
}
......@@ -448,7 +448,7 @@ int main(int argc, const char *argv[])
Renderer::Vertex( x2, y2, 0xccFFFFFF, 1.0, 1.0 ),
Renderer::Vertex( x1, y2, 0xccFFFFFF, 0.0, 1.0 )
);
surface->DrawTextNoClip( Scintilla::PRectangle(x1,y1,x2,y2), *mShaderEditor.GetTextFont(), y2 - 5.0, it->first.c_str(), it->first.length(), 0xffFFFFFF, 0x00000000);
surface->DrawTextNoClip( Scintilla::PRectangle(x1,y1,x2,y2), *mShaderEditor.GetTextFont(), y2 - 5.0, it->first.c_str(), (int)it->first.length(), 0xffFFFFFF, 0x00000000);
y1 = y2 + nMargin;
}
}
......@@ -457,7 +457,7 @@ int main(int argc, const char *argv[])
Misc::GetKeymapName(szLayout);
std::string sHelp = "F2 - toggle texture preview F5 or Ctrl-R - recompile shader F11 - hide GUI Current keymap: ";
sHelp += szLayout;
surface->DrawTextNoClip( Scintilla::PRectangle(20,Renderer::nHeight - 20,100,Renderer::nHeight), *mShaderEditor.GetTextFont(), Renderer::nHeight - 5.0, sHelp.c_str(), sHelp.length(), 0x80FFFFFF, 0x00000000);
surface->DrawTextNoClip( Scintilla::PRectangle(20,Renderer::nHeight - 20,100,Renderer::nHeight), *mShaderEditor.GetTextFont(), Renderer::nHeight - 5.0, sHelp.c_str(), (int)sHelp.length(), 0x80FFFFFF, 0x00000000);
}
......
......@@ -253,7 +253,7 @@ namespace Renderer
ShowTouchBar(mWindow);
#endif
#endif
glfwMakeContextCurrent(mWindow);
// TODO: here add text callbacks
......@@ -316,7 +316,7 @@ namespace Renderer
" gl_Position = vec4( in_pos.x, in_pos.y, in_pos.z, 1.0 );\n"
" out_texcoord = in_texcoord;\n"
"}";
GLint nShaderSize = strlen(szVertexShader);
GLint nShaderSize = (GLint)strlen(szVertexShader);
glShaderSource(glhVertexShader, 1, (const GLchar**)&szVertexShader, &nShaderSize);
glCompileShader(glhVertexShader);
......@@ -370,7 +370,7 @@ namespace Renderer
glhGUIProgram = glCreateProgram();
GLuint vshd = glCreateShader(GL_VERTEX_SHADER);
nShaderSize = strlen(defaultGUIVertexShader);
nShaderSize = (GLint)strlen(defaultGUIVertexShader);
glShaderSource(vshd, 1, (const GLchar**)&defaultGUIVertexShader, &nShaderSize);
glCompileShader(vshd);
......@@ -383,7 +383,7 @@ namespace Renderer
}
GLuint fshd = glCreateShader(GL_FRAGMENT_SHADER);
nShaderSize = strlen(defaultGUIPixelShader);
nShaderSize = (GLint)strlen(defaultGUIPixelShader);
glShaderSource(fshd, 1, (const GLchar**)&defaultGUIPixelShader, &nShaderSize);
glCompileShader(fshd);
......
......@@ -32,7 +32,7 @@ namespace Clipboard
int GetContentsLength()
{
return paste().size();
return (int)paste().size();
}
void GetContents( char * data, int len )
......
......@@ -94,7 +94,7 @@ bool Renderer::OpenSetupDialog( RENDERER_SETTINGS * settings )
} else {
settings->windowMode = RENDERER_WINDOWMODE_WINDOWED;
}
idx = responseFlags >> 24;
idx = (int)responseFlags >> 24;
if ((idx >= 0) && (idx < resolutions.size())) {
const auto &r = *std::next(resolutions.cbegin(), idx);
settings->nWidth = r.w;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment