summaryrefslogtreecommitdiff
path: root/src/netlem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/netlem.c')
-rw-r--r--src/netlem.c25
1 files changed, 16 insertions, 9 deletions
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;
+ }
}
}
}