Browse Source

Fixed having to press Enter twice to retrigger the fullscreen toggle.

Lasse Öörni 14 years ago
parent
commit
fc7b593078
1 changed files with 5 additions and 4 deletions
  1. 5 4
      Engine/Input/Input.cpp

+ 5 - 4
Engine/Input/Input.cpp

@@ -103,9 +103,7 @@ Input::Input(Context* context) :
 {
 {
     // Zero the initial state
     // Zero the initial state
     mouseButtonDown_ = 0;
     mouseButtonDown_ = 0;
-    mouseButtonPress_ = 0;
-    lastCursorPosition_ = IntVector2::ZERO;
-    lastWheelPosition_ = 0;
+    ResetState();
     
     
     #ifndef USE_OPENGL
     #ifndef USE_OPENGL
     SubscribeToEvent(E_WINDOWMESSAGE, HANDLER(Input, HandleWindowMessage));
     SubscribeToEvent(E_WINDOWMESSAGE, HANDLER(Input, HandleWindowMessage));
@@ -132,7 +130,7 @@ void Input::Update()
     if (!graphics_)
     if (!graphics_)
         return;
         return;
     
     
-    // Reset current state
+    // Reset input accumulation for this frame
     keyPress_.Clear();
     keyPress_.Clear();
     mouseButtonPress_ = 0;
     mouseButtonPress_ = 0;
     mouseMove_ = IntVector2::ZERO;
     mouseMove_ = IntVector2::ZERO;
@@ -418,7 +416,10 @@ void Input::SetKey(int key, bool newState)
     SendEvent(newState ? E_KEYDOWN : E_KEYUP, eventData);
     SendEvent(newState ? E_KEYDOWN : E_KEYUP, eventData);
 
 
     if (key == KEY_RETURN && newState && !repeat && toggleFullscreen_ && (GetKeyDown(KEY_LALT) || GetKeyDown(KEY_RALT)))
     if (key == KEY_RETURN && newState && !repeat && toggleFullscreen_ && (GetKeyDown(KEY_LALT) || GetKeyDown(KEY_RALT)))
+    {
         graphics_->ToggleFullscreen();
         graphics_->ToggleFullscreen();
+        ResetState();
+    }
 }
 }
 
 
 void Input::SetMouseWheel(int delta)
 void Input::SetMouseWheel(int delta)