medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 6a5040032ca857a0f2e7945417cc1c678956b140
parent fa66016ebee1ce4b3c9d933f7acd72ea10acc228
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Wed Sep 14 02:05:11 +0100

Fix some MSVC warnings

Diffstat:
gl.cc | 2+-
immediate.cc | 2++
log.cc | 2+-
main.cc | 32++++++++++++++++----------------
4 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/gl.cc b/gl.cc @@ -99,7 +99,7 @@ GLFWwindow * gl_init() { if( GLAD_GL_KHR_debug ) { glEnable( GL_DEBUG_OUTPUT ); - glDebugMessageCallback( gl_error_printer, NULL ); + glDebugMessageCallback( ( GLDEBUGPROC ) gl_error_printer, NULL ); } INFO( "Version %s", glGetString( GL_VERSION ) ); diff --git a/immediate.cc b/immediate.cc @@ -1,3 +1,5 @@ +#include <math.h> + #include "glad.h" #include <glm/glm.hpp> diff --git a/log.cc b/log.cc @@ -23,7 +23,7 @@ static void log_init() { char path[ 128 ]; snprintf( path, sizeof( path ), "logs/%llu-%s.log", ( long long unsigned int ) time( NULL ), names[ i ] ); streams[ i ] = fopen( path, "w" ); - assert( streams[ i ] ); + assert( streams[ i ] != NULL ); } initialised = true; diff --git a/main.cc b/main.cc @@ -104,7 +104,7 @@ int main( int argc, char ** argv ) { const float current_frame_time = glfwGetTime(); const float dt = current_frame_time - last_frame_time; - if( glfwGetKey( window, GLFW_KEY_Q ) ) { + if( glfwGetKey( window, GLFW_KEY_Q ) == GLFW_PRESS ) { break; } @@ -117,21 +117,21 @@ int main( int argc, char ** argv ) { // TODO: do this properly GameInput input = { }; - input.keys[ 'w' ] = glfwGetKey( window, GLFW_KEY_W ); - input.keys[ 'a' ] = glfwGetKey( window, GLFW_KEY_A ); - input.keys[ 's' ] = glfwGetKey( window, GLFW_KEY_S ); - input.keys[ 'd' ] = glfwGetKey( window, GLFW_KEY_D ); - input.keys[ 't' ] = glfwGetKey( window, GLFW_KEY_T ); - input.keys[ KEY_SPACE ] = glfwGetKey( window, GLFW_KEY_SPACE ); - input.keys[ KEY_LEFTSHIFT ] = glfwGetKey( window, GLFW_KEY_LEFT_SHIFT ); - input.keys[ KEY_UPARROW ] = glfwGetKey( window, GLFW_KEY_UP ); - input.keys[ KEY_DOWNARROW ] = glfwGetKey( window, GLFW_KEY_DOWN ); - input.keys[ KEY_LEFTARROW ] = glfwGetKey( window, GLFW_KEY_LEFT ); - input.keys[ KEY_RIGHTARROW ] = glfwGetKey( window, GLFW_KEY_RIGHT ); - input.keys[ KEY_LEFTARROW ] = glfwGetKey( window, GLFW_KEY_LEFT ); - input.keys[ KEY_RIGHTARROW ] = glfwGetKey( window, GLFW_KEY_RIGHT ); - input.keys[ KEY_MINUS ] = glfwGetKey( window, GLFW_KEY_MINUS ); - input.keys[ KEY_EQUALS ] = glfwGetKey( window, GLFW_KEY_EQUAL ); + input.keys[ 'w' ] = glfwGetKey( window, GLFW_KEY_W ) == GLFW_PRESS; + input.keys[ 'a' ] = glfwGetKey( window, GLFW_KEY_A ) == GLFW_PRESS; + input.keys[ 's' ] = glfwGetKey( window, GLFW_KEY_S ) == GLFW_PRESS; + input.keys[ 'd' ] = glfwGetKey( window, GLFW_KEY_D ) == GLFW_PRESS; + input.keys[ 't' ] = glfwGetKey( window, GLFW_KEY_T ) == GLFW_PRESS; + input.keys[ KEY_SPACE ] = glfwGetKey( window, GLFW_KEY_SPACE ) == GLFW_PRESS; + input.keys[ KEY_LEFTSHIFT ] = glfwGetKey( window, GLFW_KEY_LEFT_SHIFT ) == GLFW_PRESS; + input.keys[ KEY_UPARROW ] = glfwGetKey( window, GLFW_KEY_UP ) == GLFW_PRESS; + input.keys[ KEY_DOWNARROW ] = glfwGetKey( window, GLFW_KEY_DOWN ) == GLFW_PRESS; + input.keys[ KEY_LEFTARROW ] = glfwGetKey( window, GLFW_KEY_LEFT ) == GLFW_PRESS; + input.keys[ KEY_RIGHTARROW ] = glfwGetKey( window, GLFW_KEY_RIGHT ) == GLFW_PRESS; + input.keys[ KEY_LEFTARROW ] = glfwGetKey( window, GLFW_KEY_LEFT ) == GLFW_PRESS; + input.keys[ KEY_RIGHTARROW ] = glfwGetKey( window, GLFW_KEY_RIGHT ) == GLFW_PRESS; + input.keys[ KEY_MINUS ] = glfwGetKey( window, GLFW_KEY_MINUS ) == GLFW_PRESS; + input.keys[ KEY_EQUALS ] = glfwGetKey( window, GLFW_KEY_EQUAL ) == GLFW_PRESS; if( game.frame ) { game.frame( state, &mem, &input, dt );