Browse Source

core: fix a few compilation errors and warnings on OS X.

legacy
Sam Hocevar sam 14 years ago
parent
commit
700cfbd8ea
5 changed files with 20 additions and 11 deletions
  1. +0
    -1
      src/image.cpp
  2. +1
    -2
      src/input.cpp
  3. +14
    -4
      src/lolgl.h
  4. +1
    -0
      src/sample.cpp
  5. +4
    -4
      src/timer.cpp

+ 0
- 1
src/image.cpp View File

@@ -24,7 +24,6 @@
#endif #endif


#include "core.h" #include "core.h"
#include "lolgl.h"


namespace lol namespace lol
{ {


+ 1
- 2
src/input.cpp View File

@@ -60,7 +60,6 @@ static InputData * const data = &inputdata;


vec2 Input::GetAxis(int axis) vec2 Input::GetAxis(int axis)
{ {
float invsqrt2 = sqrtf(0.5f);
vec2 ret; vec2 ret;


#if defined USE_SDL #if defined USE_SDL
@@ -71,7 +70,7 @@ vec2 Input::GetAxis(int axis)
ret.x += left; ret.x += left;
ret.y += up; ret.y += up;
if (left && up) if (left && up)
ret = ret * invsqrt2;
ret = ret * sqrtf(0.5f);
#else #else
ret = 0; ret = 0;
#endif #endif


+ 14
- 4
src/lolgl.h View File

@@ -41,11 +41,21 @@
# include <GL/gl.h> # include <GL/gl.h>
# endif # endif
#elif defined HAVE_GLES_1X #elif defined HAVE_GLES_1X
# include <GLES/gl.h>
# include <GLES/glext.h>
# if defined __APPLE__ && defined __MACH__
# include <OpenGLES/ES1/gl.h>
# include <OpenGLES/ES1/glext.h>
# else
# include <GLES/gl.h>
# include <GLES/glext.h>
# endif
#elif defined HAVE_GLES_2X #elif defined HAVE_GLES_2X
# include <GLES2/gl2.h>
# include <GLES2/gl2ext.h>
# if defined __APPLE__ && defined __MACH__
# include <OpenGLES/ES2/gl.h>
# include <OpenGLES/ES2/glext.h>
# else
# include <GLES2/gl2.h>
# include <GLES2/gl2ext.h>
# endif
#endif #endif


/* Redefine some function names */ /* Redefine some function names */


+ 1
- 0
src/sample.cpp View File

@@ -15,6 +15,7 @@
#include <cstdlib> #include <cstdlib>
#include <cstdio> #include <cstdio>
#include <cmath> #include <cmath>
#include <cstring>


#if defined USE_SDL #if defined USE_SDL
# include <SDL.h> # include <SDL.h>


+ 4
- 4
src/timer.cpp View File

@@ -16,7 +16,7 @@
#include <cstdio> #include <cstdio>
#include <stdint.h> #include <stdint.h>


#if defined __linux__
#if defined __linux__ || defined __APPLE__
# include <sys/time.h> # include <sys/time.h>
# include <unistd.h> # include <unistd.h>
#elif defined _WIN32 #elif defined _WIN32
@@ -42,7 +42,7 @@ class TimerData
private: private:
TimerData() TimerData()
{ {
#if defined __linux__
#if defined __linux__ || defined __APPLE__
gettimeofday(&tv0, NULL); gettimeofday(&tv0, NULL);
#elif defined _WIN32 #elif defined _WIN32
LARGE_INTEGER tmp; LARGE_INTEGER tmp;
@@ -58,7 +58,7 @@ private:
float GetOrWait(float deltams, bool update) float GetOrWait(float deltams, bool update)
{ {
float ret, towait; float ret, towait;
#if defined __linux__
#if defined __linux__ || defined __APPLE__
struct timeval tv; struct timeval tv;
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
ret = 1e-3f * (tv.tv_usec - tv0.tv_usec) ret = 1e-3f * (tv.tv_usec - tv0.tv_usec)
@@ -90,7 +90,7 @@ private:
return ret; return ret;
} }


#if defined __linux__
#if defined __linux__ || defined __APPLE__
struct timeval tv0; struct timeval tv0;
#elif defined _WIN32 #elif defined _WIN32
float ms_per_cycle; float ms_per_cycle;


Loading…
Cancel
Save