Kigs Framework  Doc version 0.8
Open source multi purpose Rapid Application Development framework
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
ModuleInput Class Reference

#include <ModuleInput.h>

Inherits ModuleBase.

Public Member Functions

 ModuleInput (const kstl::string &name, DECLARE_CLASS_NAME_TREE_ARG)
 constructor More...
 
void Init (KigsCore *core, const kstl::vector< CoreModifiableAttribute * > *params) override
 initialize module More...
 
void Close () override
 close module
 
void Update (const Timer &timer, void *addParam) override
 update module More...
 
MouseDeviceGetMouse ()
 return mouse if any More...
 
MultiTouchDevice * GetMultiTouch ()
 return multiTouch if any
More...
 
JoystickDevice * GetJoystick (int index)
 return joystick by index More...
 
KeyboardDeviceGetKeyboard ()
 return keyboard if any
More...
 
unsigned int GetJoystickCount ()
 return joystick count
More...
 
bool addItem (const CMSP &item, ItemPosition pos=Last DECLARE_DEFAULT_LINK_NAME) override
 method to manage CoreModifiable Tree : add a son More...
 
bool getActiveWindowPos (CoreModifiable *w, MouseDevice::MOUSE_BUTTONS buttonId, kfloat &X, kfloat &Y)
 get the position of a click for a given button on a given window More...
 
void addWindowClick (WindowClick *w)
 add a WindowClick to the list More...
 
void removeWindowClick (WindowClick *w)
 remove a WindowClick to the list More...
 
WindowClickgetWindowClick (CoreModifiable *w)
 get the WindowClick which watch a given Window More...
 

Static Public Member Functions

static void WindowClickEvent (CoreModifiable *w, int buttonId, kfloat X, kfloat Y, bool isDown)
 function called when a window get a mouse click More...
 
static void WindowDestroyEvent (CoreModifiable *w)
 function called when a window is destroyed More...
 

Protected Attributes

std::list< WindowClick * > mActiveWindows
 list of WindowClick
 

Detailed Description

Generic module for input management.

Constructor & Destructor Documentation

◆ ModuleInput()

ModuleInput::ModuleInput ( const kstl::string &  name,
DECLARE_CLASS_NAME_TREE_ARG   
)

constructor

Parameters
name: instance name
DECLARE_CLASS_NAME_TREE_ARG: list of arguments

Member Function Documentation

◆ addItem()

bool ModuleInput::addItem ( const CMSP &  item,
ItemPosition pos  DECLARE_DEFAULT_LINK_NAME = Last DECLARE_DEFAULT_LINK_NAME 
)
overridevirtual

method to manage CoreModifiable Tree : add a son

Parameters
item: item to add
linkName: name of the added item
Returns
TRUE if the item is added, FALSE otherwise

Reimplemented from CoreModifiable.

◆ addWindowClick()

void ModuleInput::addWindowClick ( WindowClick w)
inline

add a WindowClick to the list

Parameters
w: watched window

◆ getActiveWindowPos()

bool ModuleInput::getActiveWindowPos ( CoreModifiable w,
MouseDevice::MOUSE_BUTTONS  buttonId,
kfloat &  X,
kfloat &  Y 
)

get the position of a click for a given button on a given window

Parameters
w: given window
buttonId: Id of the button
X: position on X axis [0.0, 1.0] (out param)
Y: position on Y axis [0.0, 1.0] (out param)

◆ GetJoystick()

JoystickDevice * ModuleInput::GetJoystick ( int  index)

return joystick by index

Parameters
index: index of the Joystick
Returns
the Joystick

◆ GetJoystickCount()

unsigned int ModuleInput::GetJoystickCount ( )
inline

return joystick count

Returns
Joystick count

◆ GetKeyboard()

KeyboardDevice * ModuleInput::GetKeyboard ( )
inline

return keyboard if any

Returns
the keyboard

◆ GetMouse()

MouseDevice * ModuleInput::GetMouse ( )
inline

return mouse if any

update module

Parameters
timer: timer global

◆ GetMultiTouch()

MultiTouchDevice * ModuleInput::GetMultiTouch ( )
inline

return multiTouch if any

update module

Parameters
timer: timer global

◆ getWindowClick()

WindowClick * ModuleInput::getWindowClick ( CoreModifiable w)
inline

get the WindowClick which watch a given Window

Parameters
w: watched window
Returns
the WindowClick, NULL if there is no WindowClick for this Window

◆ Init()

void ModuleInput::Init ( KigsCore core,
const kstl::vector< CoreModifiableAttribute * > *  params 
)
override

initialize module


Parameters
core: link to the core, NOT NULL
params: list of parameters

◆ removeWindowClick()

void ModuleInput::removeWindowClick ( WindowClick w)
inline

remove a WindowClick to the list

Parameters
w: watched window

◆ Update()

void ModuleInput::Update ( const Timer timer,
void *  addParam 
)
overridevirtual

update module

Parameters
timer: timer global

Reimplemented from CoreModifiable.

◆ WindowClickEvent()

void ModuleInput::WindowClickEvent ( CoreModifiable w,
int  buttonId,
kfloat  X,
kfloat  Y,
bool  isDown 
)
static

function called when a window get a mouse click

Parameters
w: clicked window
buttonId: Id of the button
X: position on X axis [0.0, 1.0]
Y: position on Y axis [0.0, 1.0]

◆ WindowDestroyEvent()

void ModuleInput::WindowDestroyEvent ( CoreModifiable w)
static

function called when a window is destroyed

Parameters
w: clicked window

The documentation for this class was generated from the following files: