![]() |
FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
|
This class is a wrapper for SDL events. More...
#include <C_event.hpp>
Public Member Functions | |
Event (fge::Vector2i const &windowSize, fge::Vector2i const &windowPosition) | |
Constructor to apply to size of the window and the position. | |
Event (fge::vulkan::SurfaceWindow const &surfaceWindow) | |
Constructor to apply window data. | |
Event (fge::RenderWindow const &renderWindow) | |
void | clear () |
Clear all the events. | |
void | start () |
Start the event loop. | |
void | process (SDL_Event const &evt) |
Process an SDL event. | |
void | process (unsigned int maxEventCount=20) |
Process automatically SDL events. | |
void | pushType (SDL_EventType type) |
void | popType (SDL_EventType type) |
TODO: add comments. | |
bool | isKeyPressed (uint32_t keycode) const |
Check if a key is pressed. | |
uint32_t | getKeyUnicode () const |
Get the unicode of the last key pressed. | |
fge::Vector2i const & | getWindowSize () const |
Get the window size. | |
fge::Vector2i const & | getWindowPos () const |
Get the window position. | |
bool | isEventType (uint32_t type) const |
Check if the specified SDL event is active. | |
fge::Vector2i const & | getMousePixelPos () const |
Get the mouse pixel position. | |
bool | isMouseButtonPressed (uint8_t mouseButton) const |
Check if the specified mouse button is pressed. | |
int | getMouseWheelHorizontalDelta () const |
Get the horizontal mouse wheel delta. | |
int | getMouseWheelVerticalDelta () const |
Get the vertical mouse wheel delta. | |
fge::net::Packet & | pack (fge::net::Packet &pck) |
Pack events data into a network packet. | |
fge::net::Packet & | unpack (fge::net::Packet &pck) |
Unpack events data from a network packet. | |
std::string | getBinaryKeysString () const |
Get a binary representation of all keys into a string. | |
std::string | getBinaryTypesString () const |
Get a binary representation of all SDL event types into a string. | |
std::string | getBinaryMouseButtonsString () const |
Get a binary representation of all mouse buttons into a string. | |
Public Attributes | |
fge::CallbackHandler< fge::Event const &, SDL_QuitEvent const & > | _onQuit |
fge::CallbackHandler< fge::Event const &, SDL_CommonEvent const & > | _onAppTerminating |
fge::CallbackHandler< fge::Event const &, SDL_CommonEvent const & > | _onAppLowMemory |
fge::CallbackHandler< fge::Event const &, SDL_CommonEvent const & > | _onAppWillEnterBackground |
fge::CallbackHandler< fge::Event const &, SDL_CommonEvent const & > | _onAppDidEnterBackground |
fge::CallbackHandler< fge::Event const &, SDL_CommonEvent const & > | _onAppWillEnterForeground |
fge::CallbackHandler< fge::Event const &, SDL_CommonEvent const & > | _onAppDidEnterForeground |
fge::CallbackHandler< fge::Event const &, SDL_WindowEvent const & > | _onWindowEvent |
fge::CallbackHandler< fge::Event const &, SDL_SysWMEvent const & > | _onSyswmEvent |
fge::CallbackHandler< fge::Event const &, SDL_KeyboardEvent const & > | _onKeyDown |
fge::CallbackHandler< fge::Event const &, SDL_KeyboardEvent const & > | _onKeyUp |
fge::CallbackHandler< fge::Event const &, SDL_TextEditingEvent const & > | _onTextEditing |
fge::CallbackHandler< fge::Event const &, SDL_TextInputEvent const & > | _onTextInput |
fge::CallbackHandler< fge::Event const &, SDL_CommonEvent const & > | _onKeymapChanged |
fge::CallbackHandler< fge::Event const &, SDL_MouseMotionEvent const & > | _onMouseMotion |
fge::CallbackHandler< fge::Event const &, SDL_MouseButtonEvent const & > | _onMouseButtonDown |
fge::CallbackHandler< fge::Event const &, SDL_MouseButtonEvent const & > | _onMouseButtonUp |
fge::CallbackHandler< fge::Event const &, SDL_MouseWheelEvent const & > | _onMouseWheel |
fge::CallbackHandler< fge::Event const &, SDL_JoyAxisEvent const & > | _onJoyAxisMotion |
fge::CallbackHandler< fge::Event const &, SDL_JoyBallEvent const & > | _onJoyBallMotion |
fge::CallbackHandler< fge::Event const &, SDL_JoyHatEvent const & > | _onJoyHatMotion |
fge::CallbackHandler< fge::Event const &, SDL_JoyButtonEvent const & > | _onJoyButtonDown |
fge::CallbackHandler< fge::Event const &, SDL_JoyButtonEvent const & > | _onJoyButtonUp |
fge::CallbackHandler< fge::Event const &, SDL_JoyDeviceEvent const & > | _onJoyDeviceAdded |
fge::CallbackHandler< fge::Event const &, SDL_JoyDeviceEvent const & > | _onJoyDeviceRemoved |
fge::CallbackHandler< fge::Event const &, SDL_ControllerAxisEvent const & > | _onControllerAxisMotion |
fge::CallbackHandler< fge::Event const &, SDL_ControllerButtonEvent const & > | _onControllerButtonDown |
fge::CallbackHandler< fge::Event const &, SDL_ControllerButtonEvent const & > | _onControllerButtonUp |
fge::CallbackHandler< fge::Event const &, SDL_ControllerDeviceEvent const & > | _onControllerDeviceAdded |
fge::CallbackHandler< fge::Event const &, SDL_ControllerDeviceEvent const & > | _onControllerDeviceRemoved |
fge::CallbackHandler< fge::Event const &, SDL_ControllerDeviceEvent const & > | _onControllerDeviceRemapped |
fge::CallbackHandler< fge::Event const &, SDL_TouchFingerEvent const & > | _onFingerDown |
fge::CallbackHandler< fge::Event const &, SDL_TouchFingerEvent const & > | _onFingerUp |
fge::CallbackHandler< fge::Event const &, SDL_TouchFingerEvent const & > | _onFingerMotion |
fge::CallbackHandler< fge::Event const &, SDL_DollarGestureEvent const & > | _onDollarGesture |
fge::CallbackHandler< fge::Event const &, SDL_DollarGestureEvent const & > | _onDollarRecord |
fge::CallbackHandler< fge::Event const &, SDL_MultiGestureEvent const & > | _onMultiGesture |
fge::CallbackHandler< fge::Event const &, SDL_CommonEvent const & > | _onClipboardUpdate |
fge::CallbackHandler< fge::Event const &, SDL_DropEvent const & > | _onDropFile |
fge::CallbackHandler< fge::Event const &, SDL_DropEvent const & > | _onDropText |
fge::CallbackHandler< fge::Event const &, SDL_DropEvent const & > | _onDropBegin |
fge::CallbackHandler< fge::Event const &, SDL_DropEvent const & > | _onDropComplete |
fge::CallbackHandler< fge::Event const &, SDL_AudioDeviceEvent const & > | _onAudioDeviceAdded |
fge::CallbackHandler< fge::Event const &, SDL_AudioDeviceEvent const & > | _onAudioDeviceRemoved |
fge::CallbackHandler< fge::Event const &, SDL_CommonEvent const & > | _onRenderTargetReset |
fge::CallbackHandler< fge::Event const &, SDL_CommonEvent const & > | _onRenderDeviceReset |
This class is a wrapper for SDL events.
This class regroups all the SDL events in a single class. It also provides a way to send events to the server. All events can be monitored with callbacks.
|
inlineexplicit |
Constructor to apply to size of the window and the position.
windowSize | The size of the window |
windowPosition | The position of the window |
|
explicit |
Constructor to apply window data.
surfaceWindow | The surface window |
void fge::Event::clear | ( | ) |
Clear all the events.
std::string fge::Event::getBinaryKeysString | ( | ) | const |
Get a binary representation of all keys into a string.
std::string fge::Event::getBinaryMouseButtonsString | ( | ) | const |
Get a binary representation of all mouse buttons into a string.
std::string fge::Event::getBinaryTypesString | ( | ) | const |
Get a binary representation of all SDL event types into a string.
uint32_t fge::Event::getKeyUnicode | ( | ) | const |
Get the unicode of the last key pressed.
fge::Vector2i const & fge::Event::getMousePixelPos | ( | ) | const |
Get the mouse pixel position.
int fge::Event::getMouseWheelHorizontalDelta | ( | ) | const |
Get the horizontal mouse wheel delta.
int fge::Event::getMouseWheelVerticalDelta | ( | ) | const |
Get the vertical mouse wheel delta.
fge::Vector2i const & fge::Event::getWindowPos | ( | ) | const |
Get the window position.
fge::Vector2i const & fge::Event::getWindowSize | ( | ) | const |
Get the window size.
bool fge::Event::isEventType | ( | uint32_t | type | ) | const |
Check if the specified SDL event is active.
type | The SDL event type |
bool fge::Event::isKeyPressed | ( | uint32_t | keycode | ) | const |
Check if a key is pressed.
keycode | The SDL key code |
bool fge::Event::isMouseButtonPressed | ( | uint8_t | mouseButton | ) | const |
Check if the specified mouse button is pressed.
mouseButton | The SDL mouse button |
fge::net::Packet & fge::Event::pack | ( | fge::net::Packet & | pck | ) |
Pack events data into a network packet.
pck | The packet |
void fge::Event::popType | ( | SDL_EventType | type | ) |
TODO: add comments.
void fge::Event::process | ( | SDL_Event const & | evt | ) |
Process an SDL event.
Before any attempt to call this function, you should call start.
evt | The SDL event |
void fge::Event::process | ( | unsigned int | maxEventCount = 20 | ) |
Process automatically SDL events.
This function loop through all available events and call process. The start function is called by this function.
maxEventCount | The maximum number of processed events par call |
void fge::Event::start | ( | ) |
fge::net::Packet & fge::Event::unpack | ( | fge::net::Packet & | pck | ) |
Unpack events data from a network packet.
pck | The packet |