From 4431b67d6f10ae234061c4d226a54c49f1c0c30e Mon Sep 17 00:00:00 2001 From: Cong Date: Tue, 9 May 2017 21:08:51 +1000 Subject: [PATCH] Show dragging cursor in galaxy map --- gfx/input/mousePointerMove.png | Bin 0 -> 158 bytes src/galaxy/galacticMap.c | 1 + src/galaxy/galacticMap.h | 1 + src/system/input.c | 20 +++++++++++++++++++- 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 gfx/input/mousePointerMove.png diff --git a/gfx/input/mousePointerMove.png b/gfx/input/mousePointerMove.png new file mode 100644 index 0000000000000000000000000000000000000000..9894621af352777a9ae3a72be65689872a0423d6 GIT binary patch literal 158 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6n3BBRT^OpQVt0e2I14-?iy0WW zg+Z8+Vb&Z8pdfpRr>`sfLsm{MW3Iitt6PCW`kpS1AsXkC6C4=-1Ht(QX$O^$T9O(K ww*&wGPxe?`{rP{r+Nre?a}=Ev>@F^4%;=VXyw-5P3{WeBr>mdKI;Vst0AA@W^Z)<= literal 0 HcmV?d00001 diff --git a/src/galaxy/galacticMap.c b/src/galaxy/galacticMap.c index 5471f4b..7063527 100644 --- a/src/galaxy/galacticMap.c +++ b/src/galaxy/galacticMap.c @@ -762,6 +762,7 @@ static void handleMouse(void) { scrollingMap = 0; } + setMouseCursor(app.mouse.button[SDL_BUTTON_LEFT] && show == SHOW_GALAXY); } static void startMission(void) diff --git a/src/galaxy/galacticMap.h b/src/galaxy/galacticMap.h index 669814e..4fbd95b 100644 --- a/src/galaxy/galacticMap.h +++ b/src/galaxy/galacticMap.h @@ -61,6 +61,7 @@ extern void updateAllMissions(void); extern StarSystem *getStarSystem(char *name); extern void showOKDialog(void (*callback)(void), const char *format, ...); extern char *getTranslatedString(char *string); +extern void setMouseCursor(int isDrag); extern void clearInput(void); extern void awardCampaignTrophies(void); extern void awardStatsTrophies(void); diff --git a/src/system/input.c b/src/system/input.c index 0406457..cbc629b 100644 --- a/src/system/input.c +++ b/src/system/input.c @@ -21,13 +21,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "input.h" static SDL_Texture *mousePointer; +static SDL_Texture *mousePointerNormal; +static SDL_Texture *mousePointerMove; void initInput(void) { memset(&app.mouse, 0, sizeof(Mouse)); - mousePointer = getTexture("gfx/input/mousePointer.png"); + mousePointerNormal = getTexture("gfx/input/mousePointer.png"); + mousePointerMove = getTexture("gfx/input/mousePointerMove.png"); + mousePointer = mousePointerNormal; SDL_QueryTexture(mousePointer, NULL, NULL, &app.mouse.w, &app.mouse.h); } @@ -89,6 +93,18 @@ void doMouseMotion(SDL_MouseMotionEvent *event) app.mouse.dy = event->yrel; } +void setMouseCursor(int isDrag) +{ + if (isDrag) + { + mousePointer = mousePointerMove; + } + else + { + mousePointer = mousePointerNormal; + } +} + void drawMouse(void) { int x, y; @@ -111,4 +127,6 @@ void clearInput(void) while (SDL_PollEvent(&event)) { } + + setMouseCursor(0); }