Quellcode durchsuchen

Added mouse motion support

Thomas Buck vor 10 Jahren
Ursprung
Commit
e17f49b67e
4 geänderte Dateien mit 10 neuen und 8 gelöschten Zeilen
  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 Datei anzeigen

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

+ 1
- 1
src/Menu.cpp Datei anzeigen

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

+ 4
- 0
src/OpenRaider.cpp Datei anzeigen

@@ -584,3 +584,7 @@ void OpenRaider::handleMouseClick(unsigned int x, unsigned int y, MouseButton bu
584 584
     }
585 585
 }
586 586
 
587
+void OpenRaider::handleMouseMotion(int xrel, int yrel) {
588
+
589
+}
590
+

+ 3
- 7
src/WindowSDL.cpp Datei anzeigen

@@ -170,7 +170,7 @@ void WindowSDL::eventHandling() {
170 170
     while(SDL_PollEvent(&event)) {
171 171
         switch (event.type) {
172 172
             case SDL_MOUSEMOTION:
173
-
173
+                gOpenRaider->handleMouseMotion(event.motion.xrel, event.motion.yrel);
174 174
                 break;
175 175
 
176 176
             case SDL_MOUSEBUTTONDOWN:
@@ -541,12 +541,8 @@ void WindowSDL::writeString(WindowString *s) {
541 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 547
     GLenum textureFormat;
552 548
     if (surface->format->BytesPerPixel == 4) {

Laden…
Abbrechen
Speichern