You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.0 KiB
C++
84 lines
2.0 KiB
C++
12 years ago
|
#ifndef _SFO_EVENTS_H
|
||
|
#define _SFO_EVENTS_H
|
||
12 years ago
|
|
||
10 years ago
|
#include <SDL_types.h>
|
||
|
#include <SDL_events.h>
|
||
12 years ago
|
|
||
|
////////////
|
||
|
// Events //
|
||
|
////////////
|
||
|
|
||
10 years ago
|
namespace SDLUtil
|
||
|
{
|
||
12 years ago
|
|
||
|
/** Extended mouse event struct where we treat the wheel like an axis, like everyone expects */
|
||
12 years ago
|
struct MouseMotionEvent : SDL_MouseMotionEvent {
|
||
|
|
||
|
Sint32 zrel;
|
||
|
Sint32 z;
|
||
12 years ago
|
};
|
||
|
|
||
|
|
||
|
///////////////
|
||
|
// Listeners //
|
||
|
///////////////
|
||
|
|
||
12 years ago
|
class MouseListener
|
||
12 years ago
|
{
|
||
|
public:
|
||
12 years ago
|
virtual ~MouseListener() {}
|
||
11 years ago
|
virtual void mouseMoved( const MouseMotionEvent &arg ) = 0;
|
||
|
virtual void mousePressed( const SDL_MouseButtonEvent &arg, Uint8 id ) = 0;
|
||
|
virtual void mouseReleased( const SDL_MouseButtonEvent &arg, Uint8 id ) = 0;
|
||
12 years ago
|
};
|
||
|
|
||
12 years ago
|
class KeyListener
|
||
12 years ago
|
{
|
||
|
public:
|
||
12 years ago
|
virtual ~KeyListener() {}
|
||
12 years ago
|
virtual void textInput (const SDL_TextInputEvent& arg) {}
|
||
11 years ago
|
virtual void keyPressed(const SDL_KeyboardEvent &arg) = 0;
|
||
|
virtual void keyReleased(const SDL_KeyboardEvent &arg) = 0;
|
||
12 years ago
|
};
|
||
|
|
||
10 years ago
|
class ControllerListener
|
||
12 years ago
|
{
|
||
|
public:
|
||
10 years ago
|
virtual ~ControllerListener() {}
|
||
12 years ago
|
/** @remarks Joystick button down event */
|
||
10 years ago
|
virtual void buttonPressed(int deviceID, const SDL_ControllerButtonEvent &evt) = 0;
|
||
12 years ago
|
|
||
|
/** @remarks Joystick button up event */
|
||
10 years ago
|
virtual void buttonReleased(int deviceID, const SDL_ControllerButtonEvent &evt) = 0;
|
||
12 years ago
|
|
||
|
/** @remarks Joystick axis moved event */
|
||
10 years ago
|
virtual void axisMoved(int deviceID, const SDL_ControllerAxisEvent &arg) = 0;
|
||
12 years ago
|
|
||
10 years ago
|
/** @remarks Joystick Added **/
|
||
10 years ago
|
virtual void controllerAdded(int deviceID, const SDL_ControllerDeviceEvent &arg) = 0;
|
||
10 years ago
|
|
||
|
/** @remarks Joystick Removed **/
|
||
10 years ago
|
virtual void controllerRemoved(const SDL_ControllerDeviceEvent &arg) = 0;
|
||
12 years ago
|
|
||
|
};
|
||
|
|
||
12 years ago
|
class WindowListener
|
||
12 years ago
|
{
|
||
|
public:
|
||
12 years ago
|
virtual ~WindowListener() {}
|
||
12 years ago
|
|
||
|
/** @remarks The window's visibility changed */
|
||
10 years ago
|
virtual void windowVisibilityChange( bool visible ) {}
|
||
12 years ago
|
|
||
|
/** @remarks The window got / lost input focus */
|
||
12 years ago
|
virtual void windowFocusChange( bool have_focus ) {}
|
||
|
|
||
11 years ago
|
virtual void windowClosed () {}
|
||
|
|
||
12 years ago
|
virtual void windowResized (int x, int y) {}
|
||
12 years ago
|
};
|
||
|
|
||
12 years ago
|
}
|
||
12 years ago
|
|
||
12 years ago
|
#endif
|