]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
event order fixes
authorClyne Sullivan <tullivan99@gmail.com>
Fri, 8 Sep 2017 01:48:11 +0000 (21:48 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Fri, 8 Sep 2017 01:48:11 +0000 (21:48 -0400)
build.sh [deleted file]
include/ui.hpp
main.cpp
src/ui.cpp

diff --git a/build.sh b/build.sh
deleted file mode 100755 (executable)
index b2ddb0a..0000000
--- a/build.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-idate=$(date +"%s" -r .git/index)
-odate=$(date +"%s" -r ./.updated)
-
-if (( $idate > $odate )); then
-       echo "Project updated, building all..."
-       make clean
-       make -j4
-       touch ./.updated
-else
-       echo "Up to date, building..."
-       make -j4
-fi
index bfa2fdd981bc62af68abf7affb452af7a9db209d..61c06cfdafbe96947cd1c714e9f2759ffa2ce610 100644 (file)
@@ -130,8 +130,6 @@ namespace ui {
         */
 
        void takeScreenshot(GLubyte *pixels);
-
-       bool handleGLEvent(SDL_Event& e);
 }
 
 #endif // UI_HPP_
index 51a577664455942bbe5a32c4d70556476438d70f..49d1dd9fd72f2ee62502d7a04dce3d0792664974 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -130,10 +130,10 @@ int main(int argc, char *argv[])
                                game::time::tick();
                        }
 
-                       while (!eventQueue.empty()) {
-                               game::events.emit<MainSDLEvent>(eventQueue.back());
-                               eventQueue.pop_back();
-                       }
+                       auto clone = eventQueue;
+                       eventQueue.clear();
+                       for (auto& e : clone)
+                               game::events.emit<MainSDLEvent>(e);
 
                        game::engine.update(game::time::getDeltaTime());
                        std::this_thread::sleep_for(1ms);
@@ -160,10 +160,8 @@ int main(int argc, char *argv[])
                        Render::render(fps);
                        
                        SDL_Event e;
-                       while (SDL_PollEvent(&e)) {
-                               ui::handleGLEvent(e);
+                       while (SDL_PollEvent(&e))
                                eventQueue.push_back(e);
-                       }
                }
 
                // on game end, get back together
index 4eed4a38db734297e270e2e235cb5d59d3958545..78baa6837b677437fd9c13a48c1ca47ba2398c46 100644 (file)
@@ -613,20 +613,6 @@ namespace ui {
 
                fclose(bmp);
        }
-
-       bool handleGLEvent(SDL_Event& e) {
-               switch (e.type) {
-               case SDL_MOUSEBUTTONDOWN:
-                       if ((UISystem::isDialog() | pageTexReady) && (e.button.button & SDL_BUTTON_RIGHT))
-                                       UISystem::advanceDialog();
-                       return true;
-                       break;
-               default:
-                       break;
-               }
-
-               return false;
-       }
 }
 
 using namespace ui;