added handling of resize event

This commit is contained in:
Anselme 2015-09-24 11:54:33 +02:00
parent 56efe9fb6c
commit 306d12de27
2 changed files with 16 additions and 5 deletions

View File

@ -26,6 +26,7 @@ void Input::updateEvents(){
/* reset variables */ /* reset variables */
closeRequested = false; closeRequested = false;
hasBeenResized = false;
delta_vertical_scroll = 0; delta_vertical_scroll = 0;
/* global affectation */ /* global affectation */
@ -68,9 +69,12 @@ void Input::updateEvents(){
case sf::Event::MouseEntered: case sf::Event::MouseEntered:
// action MouseEntered // action MouseEntered
break; break;
case sf::Event::MouseLeft: case sf::Event::MouseLeft:
//action MouseLeft //action MouseLeft
break; break;
case sf::Event::Resized:
hasBeenResized = true;
break;
} }
} }
for (auto key: heldkeys){ for (auto key: heldkeys){
@ -110,7 +114,12 @@ void Input::updateKeyBindings(){
bool Input::isCloseRequested() const bool Input::isCloseRequested() const
{ {
return closeRequested; return closeRequested;
}
bool Input::isResized() const
{
return hasBeenResized;
} }
/* keyboard-related functions */ /* keyboard-related functions */

View File

@ -26,7 +26,8 @@ class Input{
void updateKeyBindings(); void updateKeyBindings();
/* window-related function */ /* window-related function */
bool isCloseRequested() const; bool isCloseRequested() const;
bool isResized() const;
/* keyboard-related functions */ /* keyboard-related functions */
bool isKeyPressed(int key) const; bool isKeyPressed(int key) const;
@ -45,6 +46,7 @@ class Input{
/* window-related variables */ /* window-related variables */
sf::Window* window; sf::Window* window;
bool closeRequested; bool closeRequested;
bool hasBeenResized;
/* general action-mapping variables */ /* general action-mapping variables */
IKeysMap keysmap; IKeysMap keysmap;