Selaa lähdekoodia

Added mouse motion support

Thomas Buck 10 vuotta sitten
vanhempi
commit
e17f49b67e
4 muutettua tiedostoa jossa 10 lisäystä ja 8 poistoa
  1. 2
    0
      include/OpenRaider.h
  2. 1
    1
      src/Menu.cpp
  3. 4
    0
      src/OpenRaider.cpp
  4. 3
    7
      src/WindowSDL.cpp

+ 2
- 0
include/OpenRaider.h Näytä tiedosto

73
 
73
 
74
     void handleMouseClick(unsigned int x, unsigned int y, MouseButton button, bool released);
74
     void handleMouseClick(unsigned int x, unsigned int y, MouseButton button, bool released);
75
 
75
 
76
+    void handleMouseMotion(int xrel, int yrel);
77
+
76
     Window *mWindow;
78
     Window *mWindow;
77
     Sound *mSound;
79
     Sound *mSound;
78
     Menu *mMenu;
80
     Menu *mMenu;

+ 1
- 1
src/Menu.cpp Näytä tiedosto

188
     if ((!released) || (button != leftButton))
188
     if ((!released) || (button != leftButton))
189
         return;
189
         return;
190
 
190
 
191
-    if ((y >= 100) && (y <= (100 + (25 * items)))) {
191
+    if ((y >= 100) && (y <= (unsigned int)(100 + (25 * items)))) {
192
         y -= 100;
192
         y -= 100;
193
         mCursor = mMin + (y / 25);
193
         mCursor = mMin + (y / 25);
194
     } else if ((y >= 25) && (y <= 100) && (x >= 25) && (x <= 125)) {
194
     } else if ((y >= 25) && (y <= 100) && (x >= 25) && (x <= 125)) {

+ 4
- 0
src/OpenRaider.cpp Näytä tiedosto

584
     }
584
     }
585
 }
585
 }
586
 
586
 
587
+void OpenRaider::handleMouseMotion(int xrel, int yrel) {
588
+
589
+}
590
+

+ 3
- 7
src/WindowSDL.cpp Näytä tiedosto

170
     while(SDL_PollEvent(&event)) {
170
     while(SDL_PollEvent(&event)) {
171
         switch (event.type) {
171
         switch (event.type) {
172
             case SDL_MOUSEMOTION:
172
             case SDL_MOUSEMOTION:
173
-
173
+                gOpenRaider->handleMouseMotion(event.motion.xrel, event.motion.yrel);
174
                 break;
174
                 break;
175
 
175
 
176
             case SDL_MOUSEBUTTONDOWN:
176
             case SDL_MOUSEBUTTONDOWN:
541
         return;
541
         return;
542
     }
542
     }
543
 
543
 
544
-    if (TTF_SizeUTF8(mFont, s->text, &s->w, &s->h) != 0) {
545
-        printf("TTF_SizeUTF8 Error: %s\n", TTF_GetError());
546
-        // Don't need to abort
547
-    }
548
-    s->w = (int)((float)s->w * s->scale);
549
-    s->h = (int)((float)s->h * s->scale);
544
+    s->w = (int)((float)surface->w * s->scale);
545
+    s->h = (int)((float)surface->h * s->scale);
550
 
546
 
551
     GLenum textureFormat;
547
     GLenum textureFormat;
552
     if (surface->format->BytesPerPixel == 4) {
548
     if (surface->format->BytesPerPixel == 4) {

Loading…
Peruuta
Tallenna