Leviathan  0.8.0.0
Leviathan game engine
Leviathan::InputReceiver Class Referenceabstract

class to derive from when wanting to connect to input More...

#include <InputController.h>

Public Member Functions

DLLEXPORT InputReceiver ()
 
virtual DLLEXPORT ~InputReceiver ()
 
virtual DLLEXPORT void BeginNewReceiveQueue ()
 
virtual DLLEXPORT bool ReceiveInput (int32_t key, int modifiers, bool down)=0
 Called when the object receives a key press, return true when consumed. More...
 
virtual DLLEXPORT void ReceiveBlockedInput (int32_t key, int modifiers, bool down)=0
 This is called when input is not received. More...
 
virtual DLLEXPORT bool OnScroll (int x, int y, int modifiers)
 
virtual DLLEXPORT bool OnMouseMove (int xmove, int ymove)=0
 when mouse is captured and is moved (relative movement is passed) More...
 
DLLEXPORT void _UnConnectParent (Lock &ownerlock)
 If ConnectedTo is not NULL notifies it that we are no longer valid. More...
 

Protected Member Functions

void _OnConnected (InputController *owner)
 
void _OnDisconnect (InputController *owner)
 

Protected Attributes

InputControllerConnectedTo
 

Detailed Description

class to derive from when wanting to connect to input

Definition at line 15 of file InputController.h.

Constructor & Destructor Documentation

◆ InputReceiver()

DLLEXPORT InputReceiver::InputReceiver ( )

Definition at line 111 of file InputController.cpp.

111 : ConnectedTo(nullptr) {}
InputController * ConnectedTo

◆ ~InputReceiver()

InputReceiver::~InputReceiver ( )
virtual

Definition at line 113 of file InputController.cpp.

114 {
115  // tell owner that we no longer exist //
116  LEVIATHAN_ASSERT(!ConnectedTo, "InputReceiver not _UnConnectParent called");
117 }
#define LEVIATHAN_ASSERT(x, msg)
Definition: Define.h:92
InputController * ConnectedTo

Member Function Documentation

◆ _OnConnected()

void InputReceiver::_OnConnected ( InputController owner)
protected

Definition at line 133 of file InputController.cpp.

134 {
135  ConnectedTo = owner;
136 }
InputController * ConnectedTo

◆ _OnDisconnect()

void InputReceiver::_OnDisconnect ( InputController owner)
protected

Definition at line 138 of file InputController.cpp.

139 {
140  ConnectedTo = NULL;
141 }
InputController * ConnectedTo

◆ _UnConnectParent()

DLLEXPORT void InputReceiver::_UnConnectParent ( Lock ownerlock)

If ConnectedTo is not NULL notifies it that we are no longer valid.

Definition at line 124 of file InputController.cpp.

125 {
126 
127  if(ConnectedTo)
128  ConnectedTo->_OnChildUnlink(ownerlock, this);
129 
130  ConnectedTo = NULL;
131 }
virtual DLLEXPORT void _OnChildUnlink(Lock &guard, InputReceiver *child)
Called by input controllers if they unlink.
InputController * ConnectedTo

◆ BeginNewReceiveQueue()

DLLEXPORT void InputReceiver::BeginNewReceiveQueue ( )
virtual

called at the beginning of key press receive sequence (you shouldn't reset anything, since you will get blocked input if keys are released while the object isn't getting input

Definition at line 143 of file InputController.cpp.

143 {}

◆ OnMouseMove()

virtual DLLEXPORT bool Leviathan::InputReceiver::OnMouseMove ( int  xmove,
int  ymove 
)
pure virtual

when mouse is captured and is moved (relative movement is passed)

◆ OnScroll()

DLLEXPORT bool InputReceiver::OnScroll ( int  x,
int  y,
int  modifiers 
)
virtual

Called the scroll wheel is used and the GUI didn't take the scroll input

Parameters
xThe x side scroll. NOTE: this is the side to side scrolling
yThe y direction scroll amount. This is the usual scroll direction

Definition at line 119 of file InputController.cpp.

120 {
121  return false;
122 }

◆ ReceiveBlockedInput()

virtual DLLEXPORT void Leviathan::InputReceiver::ReceiveBlockedInput ( int32_t  key,
int  modifiers,
bool  down 
)
pure virtual

This is called when input is not received.

basically everything should be reseted to not received

◆ ReceiveInput()

virtual DLLEXPORT bool Leviathan::InputReceiver::ReceiveInput ( int32_t  key,
int  modifiers,
bool  down 
)
pure virtual

Called when the object receives a key press, return true when consumed.

Member Data Documentation

◆ ConnectedTo

InputController* Leviathan::InputReceiver::ConnectedTo
protected

Definition at line 52 of file InputController.h.


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