diff options
-rw-r--r-- | src/include/data_ini.h | 3 | ||||
-rw-r--r-- | src/netlem.c | 25 |
2 files changed, 19 insertions, 9 deletions
diff --git a/src/include/data_ini.h b/src/include/data_ini.h index b00d77a..bec4d48 100644 --- a/src/include/data_ini.h +++ b/src/include/data_ini.h @@ -1,15 +1,18 @@ #ifndef DATA_INI_H #define DATA_INI_H +// Original game level size is fixed to 1664x160. We want to display all the game with a x2 zoom #define LEVEL_WIDTH 1664*2 #define LEVEL_HEIGHT 160*2 #include "SDL/SDL_stdinc.h" +// object_* = entries from level ini files struct styleObjects { int frames, anim, type, sound; }; +// Various keys at the beginning of level ini files struct styleIni { char *name; uint32_t bgColor, debrisColor; diff --git a/src/netlem.c b/src/netlem.c index b77de1c..37193dd 100644 --- a/src/netlem.c +++ b/src/netlem.c @@ -473,7 +473,7 @@ int loadLevelProc(void *a) { #define MAP_SCROLL_BOUND 32 #define MAP_SCROLL_SPEED 16 void processLocalEvents(SDL_Rect *viewport, SDL_Rect *screen, SDL_Rect *terrain) { - static int mouseX=100, mouseY=100; + static int mouseActive=1, mouseX=100, mouseY=100; SDL_Event event; while( SDL_PollEvent( &event ) ) { @@ -504,6 +504,11 @@ void processLocalEvents(SDL_Rect *viewport, SDL_Rect *screen, SDL_Rect *terrain) default:break; } break; + case SDL_ACTIVEEVENT: + if ( event.active.state == SDL_APPMOUSEFOCUS ) { + mouseActive = event.active.gain; + } + break; case SDL_MOUSEMOTION: mouseX = event.motion.x; mouseY = event.motion.y; @@ -520,15 +525,17 @@ void processLocalEvents(SDL_Rect *viewport, SDL_Rect *screen, SDL_Rect *terrain) switch(getState()) { case eMultiGame: - if(mouseY <= terrain->h){ - if (mouseX > (screen->w - MAP_SCROLL_BOUND)){ - if (viewport->x < (terrain->w - screen->w ) ) { - viewport->x += MAP_SCROLL_SPEED; + if (mouseActive) { + if(mouseY <= terrain->h){ + if (mouseX > (screen->w - MAP_SCROLL_BOUND)){ + if (viewport->x < (terrain->w - screen->w ) ) { + viewport->x += MAP_SCROLL_SPEED; + } } - } - if (mouseX < MAP_SCROLL_BOUND){ - if (viewport->x >= MAP_SCROLL_SPEED ) { - viewport->x -= MAP_SCROLL_SPEED; + if (mouseX < MAP_SCROLL_BOUND){ + if (viewport->x >= MAP_SCROLL_SPEED ) { + viewport->x -= MAP_SCROLL_SPEED; + } } } } |