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 */
@ -71,6 +72,9 @@ void Input::updateEvents(){
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){
@ -113,6 +117,11 @@ bool Input::isCloseRequested() const
return closeRequested; return closeRequested;
} }
bool Input::isResized() const
{
return hasBeenResized;
}
/* keyboard-related functions */ /* keyboard-related functions */
bool Input::isKeyPressed(int key) const bool Input::isKeyPressed(int key) const

View File

@ -27,6 +27,7 @@ class Input{
/* 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;