aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorptitSeb2017-12-11 11:46:02 +0100
committerptitSeb2017-12-11 11:46:02 +0100
commit7e04354a5b8e7a610a0c978c056aa6d0e7274cec (patch)
tree3bebc516272846e7459c183dd692424bd0f56587 /src
parent13a64162ef55dfe22fbeb9d72970d81353e0d6ff (diff)
downloadhydracastlelabyrinth-7e04354a5b8e7a610a0c978c056aa6d0e7274cec.tar.gz
hydracastlelabyrinth-7e04354a5b8e7a610a0c978c056aa6d0e7274cec.tar.bz2
hydracastlelabyrinth-7e04354a5b8e7a610a0c978c056aa6d0e7274cec.zip
[ODROID] Removed X11 dependancy, using SDL to get Desktop dimension
Diffstat (limited to 'src')
-rw-r--r--src/main.c12
-rwxr-xr-xsrc/sdl/graphics.c6
2 files changed, 8 insertions, 10 deletions
diff --git a/src/main.c b/src/main.c
index d15ac93..b690dea 100644
--- a/src/main.c
+++ b/src/main.c
@@ -43,6 +43,12 @@ int main(int argc, char **argv)
osSetSpeedupEnable(false);
#endif
#ifdef _SDL
+ if ( SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK ) < 0) {
+ fprintf(stderr, "Error");
+ SDL_Delay(5000);
+ exit(EXIT_FAILURE);
+ }
+
#if defined(PANDORA) || defined(PYRA) || defined(CHIP) || defined(ODROID)
wantFullscreen = 1;
#else
@@ -53,9 +59,8 @@ int main(int argc, char **argv)
#elif defined(PYRA)
screenScale = 3;
#elif defined(ODROID)
- Display* disp = XOpenDisplay(NULL);
- Screen* scrn = DefaultScreenOfDisplay(disp);
- int maxy = scrn->height;
+ const SDL_VideoInfo* infos = SDL_GetVideoInfo();
+ int maxy = infos->current_h;
if(maxy < 640)
screenScale = 1;
else if (maxy < 720)
@@ -64,7 +69,6 @@ int main(int argc, char **argv)
screenScale = 3;
else
screenScale = 4;
- XCloseDisplay(disp);
#else
screenScale = 2;
#endif
diff --git a/src/sdl/graphics.c b/src/sdl/graphics.c
index 937fea6..166eb32 100755
--- a/src/sdl/graphics.c
+++ b/src/sdl/graphics.c
@@ -24,12 +24,6 @@ SDL_Color PHL_NewRGB(uint8_t r, uint8_t g, uint8_t b)
void PHL_GraphicsInit()
{
- if ( SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK ) < 0) {
- fprintf(stderr, "Error");
- SDL_Delay(5000);
- exit(EXIT_FAILURE);
- }
-
SDL_ShowCursor(SDL_DISABLE);
Input_InitJoystick();