mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-22 19:44:21 +01:00
b861e7aaee
Also fix the Esc key behaviour Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
117 lines
4 KiB
Diff
117 lines
4 KiB
Diff
diff -up trackballs-1.1.4/src/gameMode.cc~ trackballs-1.1.4/src/gameMode.cc
|
|
--- trackballs-1.1.4/src/gameMode.cc~ 2006-08-06 14:01:39.000000000 +0200
|
|
+++ trackballs-1.1.4/src/gameMode.cc 2011-05-18 15:51:03.320256212 +0200
|
|
@@ -26,9 +26,8 @@ using namespace std;
|
|
|
|
GameMode *GameMode::current;
|
|
|
|
-GameMode::GameMode() { keyUpReceived=1; }
|
|
-GameMode::~GameMode() {
|
|
-}
|
|
+GameMode::GameMode() {}
|
|
+GameMode::~GameMode() {}
|
|
void GameMode::activate(GameMode* gm) {
|
|
if(current) current->deactivated();
|
|
current = gm;
|
|
@@ -36,7 +35,6 @@ void GameMode::activate(GameMode* gm) {
|
|
}
|
|
void GameMode::display(){}
|
|
void GameMode::key(int){}
|
|
-void GameMode::keyUp(int){ keyUpReceived=1; }
|
|
void GameMode::special(int key,int x,int y){}
|
|
void GameMode::idle(Real td){}
|
|
void GameMode::mouse(int state,int x,int y){}
|
|
diff -up trackballs-1.1.4/src/gameMode.h~ trackballs-1.1.4/src/gameMode.h
|
|
--- trackballs-1.1.4/src/gameMode.h~ 2006-08-06 14:01:20.000000000 +0200
|
|
+++ trackballs-1.1.4/src/gameMode.h 2011-05-18 15:49:50.760256145 +0200
|
|
@@ -33,7 +33,6 @@ class GameMode {
|
|
|
|
virtual void display();
|
|
virtual void key(int);
|
|
- virtual void keyUp(int);
|
|
virtual void special(int,int,int);
|
|
virtual void idle(Real dt);
|
|
virtual void doExpensiveComputations();
|
|
@@ -44,9 +43,6 @@ class GameMode {
|
|
|
|
static void activate(GameMode*);
|
|
static GameMode *current;
|
|
- protected:
|
|
- int keyUpReceived;
|
|
- private:
|
|
};
|
|
|
|
#endif
|
|
diff -up trackballs-1.1.4/src/mainMode.cc~ trackballs-1.1.4/src/mainMode.cc
|
|
--- trackballs-1.1.4/src/mainMode.cc~ 2007-05-25 12:23:50.000000000 +0200
|
|
+++ trackballs-1.1.4/src/mainMode.cc 2011-05-18 15:45:44.458256059 +0200
|
|
@@ -464,11 +464,6 @@ void MainMode::activated() {
|
|
camFocus[1] = Game::current->map->startPosition[1] - 5;
|
|
time = 0.0;
|
|
flash = 0.0;
|
|
-
|
|
- /* Fix for an apparanet bug in my SDL + Xorg combination... */
|
|
- SDL_WM_ToggleFullScreen(screen);
|
|
- SDL_WM_ToggleFullScreen(screen);
|
|
-
|
|
}
|
|
void MainMode::deactivated() { free(viewportData); viewportData=NULL; }
|
|
void MainMode::playerLoose() { Game::current->gamer->playerLoose(); gameStatus=statusGameOver; }
|
|
diff -up trackballs-1.1.4/src/mmad.cc~ trackballs-1.1.4/src/mmad.cc
|
|
--- trackballs-1.1.4/src/mmad.cc~ 2011-05-18 14:55:38.000000000 +0200
|
|
+++ trackballs-1.1.4/src/mmad.cc 2011-05-18 16:11:33.817256492 +0200
|
|
@@ -411,7 +411,6 @@ void innerMain(void *closure,int argc,ch
|
|
/* Initialize random number generator */
|
|
int seed=(int) getSystemTime();
|
|
srand(seed);
|
|
- int keyUpReceived=1;
|
|
|
|
while(is_running) {
|
|
|
|
@@ -469,9 +468,6 @@ void innerMain(void *closure,int argc,ch
|
|
if(GameMode::current) GameMode::current->mouseDown(e->button,e->x,e->y);
|
|
break;
|
|
case SDL_KEYUP:
|
|
- /* Prevent repeated keys */
|
|
- keyUpReceived=1;
|
|
-
|
|
/* Use Caps lock key to determine if mouse should be hidden+grabbed */
|
|
if(event.key.keysym.sym == SDLK_CAPSLOCK) {
|
|
if(SDL_GetModState() & KMOD_CAPS) {
|
|
@@ -481,12 +477,12 @@ void innerMain(void *closure,int argc,ch
|
|
SDL_WM_GrabInput(SDL_GRAB_ON);
|
|
SDL_ShowCursor(SDL_DISABLE);
|
|
}
|
|
- } else
|
|
- GameMode::current->keyUp(event.key.keysym.sym);
|
|
+ }
|
|
+ break;
|
|
case SDL_KEYDOWN:
|
|
-
|
|
/* Always quit if the 'q' key is pressed */
|
|
- if(event.key.keysym.sym == 'q' && SDL_GetModState() & KMOD_CTRL) exit(0);
|
|
+ if(event.key.keysym.sym == 'q' && SDL_GetModState() & KMOD_CTRL)
|
|
+ exit(0);
|
|
|
|
/* Change between fullscreen/windowed mode if the 'f' key
|
|
is pressed */
|
|
@@ -525,14 +521,13 @@ void innerMain(void *closure,int argc,ch
|
|
((EditMode*)GameMode::current)->askQuit();
|
|
} else if((GameMode::current && GameMode::current == MenuMode::menuMode))
|
|
is_running=0;
|
|
- else { GameMode::activate(MenuMode::menuMode); while(SDL_PollEvent(&event)) {} }
|
|
-
|
|
+ else {
|
|
+ GameMode::activate(MenuMode::menuMode);
|
|
+ while(SDL_PollEvent(&event)) {}
|
|
+ }
|
|
}
|
|
- else if(GameMode::current) {
|
|
- /* Prevent repeated keys */
|
|
- if(!keyUpReceived) break;
|
|
- keyUpReceived=0;
|
|
|
|
+ else if(GameMode::current) {
|
|
GameMode::current->key(event.key.keysym.sym);
|
|
}
|
|
|