Nebula
Loading...
Searching...
No Matches
Base::InputServerBase Class Reference

#include <inputserverbase.h>

Detailed Description

The InputServer is the central object of the Input subsystem.

It mainly manages a prioritized list of input handlers which process incoming input events.

Inherits Core::RefCounted.

Inherited by GLFW::GLFWInputServer.

Public Member Functions

 InputServerBase ()
 constructor
virtual ~InputServerBase ()
 destructor
void SetMaxNumLocalPlayers (SizeT maxNumLocalPlayers)
 set the max number of local players for this application (default is 4)
SizeT GetMaxNumLocalPlayers () const
 get the max number of local players
virtual void Open ()
 open the input server
virtual void Close ()
 close the input server
bool IsOpen () const
 return true if open
void SetQuitRequested (bool b)
 set the quit requested flag
bool IsQuitRequested () const
 return true if some subsystem has requested to quit the app (e.g. Alt-F4)
void Reset ()
 reset input state
const Ptr< Input::Keyboard > & GetDefaultKeyboard () const
 get the default keyboard input handler
const Ptr< Input::Mouse > & GetDefaultMouse () const
 get the default mouse input handler
Ptr< Input::GamePadGetDefaultGamePad (IndexT playerIndex) const
 get default gamepad handler (playerIndex is valid up to MaxNumLocalPlayers)
void AttachInputHandler (Input::InputPriority::Code pri, const Ptr< Input::InputHandler > &inputHandler)
 attach an input handler
void RemoveInputHandler (const Ptr< Input::InputHandler > &inputHandler)
 remove an input handler
void AddGamePad (const Ptr< Input::GamePad > pad, IndexT playerIndex)
virtual void BeginFrame ()
 call before processing window events
virtual void OnFrame ()
 call after processing window events
void EndFrame ()
 call at end of frame
void PutEvent (const Input::InputEvent &ie)
 put an input event into the handler chain
void ClearMouseCapture ()
 clear the current mouse capture (if exists)
void ClearKeyboardCapture ()
 clear the current keyboard capture (if exists)
void ClearCapture ()
 clear both mouse and keyboard captures
const Ptr< Input::InputHandler > & GetMouseCaptureHandler () const
 return the current mouse capture input handler (return invalid ptr if no capture set)
const Ptr< Input::InputHandler > & GetKeyboardCaptureHandler () const
 return the current keyboard capture input handler (return invalid ptr if no capture set)
void ObtainMouseCapture (const Ptr< Input::InputHandler > &inputHandler)
 only call from InputHandler: capture mouse input to the given input handler
void ReleaseMouseCapture (const Ptr< Input::InputHandler > &inputHandler)
 only call from InputHandler: release mouse capture
void ObtainKeyboardCapture (const Ptr< Input::InputHandler > &inputHandler)
 only call from InputHandler: capture keyboard input to the given input handler
void ReleaseKeyboardCapture (const Ptr< Input::InputHandler > &inputHandler)
 only call from InputHandler: release keyboard capture
bool HasFocus () const
 return true if the application has focus
Public Member Functions inherited from Core::RefCounted
 RefCounted ()
 constructor
int GetRefCount () const
 get the current refcount
void AddRef ()
 increment refcount by one
void Release ()
 decrement refcount and destroy object if refcount is zero
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
const Util::StringGetClassName () const
 get the class name
Util::FourCC GetClassFourCC () const
 get the class FourCC code

Protected Attributes

bool isOpen
bool inBeginFrame
bool isQuitRequested
bool hasFocus
int inputHandlersLockCount
SizeT maxNumLocalPlayers
Util::Array< Util::KeyValuePair< Input::InputPriority::Code, Ptr< Input::InputHandler > > > inputHandlers
Ptr< Input::InputHandlermouseCaptureHandler
Ptr< Input::InputHandlerkeyboardCaptureHandler
Ptr< Input::KeyboarddefaultKeyboard
Ptr< Input::MousedefaultMouse
Util::FixedArray< Ptr< Input::GamePad > > defaultGamePad
Threading::CriticalSection critSect
Threading::ThreadId creatorThreadId

Private Member Functions

 __DeclareClass (InputServerBase)

Additional Inherited Members

Static Public Member Functions inherited from Core::RefCounted
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!)
Protected Member Functions inherited from Core::RefCounted
virtual ~RefCounted ()
 destructor (called when refcount reaches zero)

Constructor & Destructor Documentation

◆ InputServerBase()

Base::InputServerBase::InputServerBase ( )

constructor

◆ ~InputServerBase()

Base::InputServerBase::~InputServerBase ( )
virtual

destructor

Member Function Documentation

◆ __DeclareClass()

Base::InputServerBase::__DeclareClass ( InputServerBase )
private

◆ AddGamePad()

void Base::InputServerBase::AddGamePad ( const Ptr< Input::GamePad > pad,
IndexT playerIndex )

◆ AttachInputHandler()

void Base::InputServerBase::AttachInputHandler ( Input::InputPriority::Code pri,
const Ptr< Input::InputHandler > & inputHandler )

attach an input handler

◆ BeginFrame()

void Base::InputServerBase::BeginFrame ( )
virtual

call before processing window events

◆ ClearCapture()

void Base::InputServerBase::ClearCapture ( )

clear both mouse and keyboard captures

This clears the mouse and keyboards captures, if set.

◆ ClearKeyboardCapture()

void Base::InputServerBase::ClearKeyboardCapture ( )

clear the current keyboard capture (if exists)

This clears the currently set keyboard capture (if exists).

◆ ClearMouseCapture()

void Base::InputServerBase::ClearMouseCapture ( )

clear the current mouse capture (if exists)

This clears the currently set mouse capture (if exists).

◆ Close()

void Base::InputServerBase::Close ( )
virtual

close the input server

Reimplemented in GLFW::GLFWInputServer.

◆ EndFrame()

void Base::InputServerBase::EndFrame ( )

call at end of frame

Call this somewhere towards the end of frame, when it is guaraneteed that noone needs input anymore.

◆ GetDefaultGamePad()

Ptr< Input::GamePad > Base::InputServerBase::GetDefaultGamePad ( IndexT playerIndex) const

get default gamepad handler (playerIndex is valid up to MaxNumLocalPlayers)

◆ GetDefaultKeyboard()

const Ptr< Input::Keyboard > & Base::InputServerBase::GetDefaultKeyboard ( ) const
inline

get the default keyboard input handler

◆ GetDefaultMouse()

const Ptr< Input::Mouse > & Base::InputServerBase::GetDefaultMouse ( ) const
inline

get the default mouse input handler

◆ GetKeyboardCaptureHandler()

const Ptr< InputHandler > & Base::InputServerBase::GetKeyboardCaptureHandler ( ) const

return the current keyboard capture input handler (return invalid ptr if no capture set)

◆ GetMaxNumLocalPlayers()

SizeT Base::InputServerBase::GetMaxNumLocalPlayers ( ) const
inline

get the max number of local players

◆ GetMouseCaptureHandler()

const Ptr< InputHandler > & Base::InputServerBase::GetMouseCaptureHandler ( ) const

return the current mouse capture input handler (return invalid ptr if no capture set)

◆ HasFocus()

bool Base::InputServerBase::HasFocus ( ) const
inline

return true if the application has focus

◆ IsOpen()

bool Base::InputServerBase::IsOpen ( ) const
inline

return true if open

◆ IsQuitRequested()

bool Base::InputServerBase::IsQuitRequested ( ) const
inline

return true if some subsystem has requested to quit the app (e.g. Alt-F4)

◆ ObtainKeyboardCapture()

void Base::InputServerBase::ObtainKeyboardCapture ( const Ptr< Input::InputHandler > & inputHandler)

only call from InputHandler: capture keyboard input to the given input handler

Obtain the keyboard capture.

All keyboard input will go exclusively to the capture input handler until ReleaseKeyboardCapture() is called.

◆ ObtainMouseCapture()

void Base::InputServerBase::ObtainMouseCapture ( const Ptr< Input::InputHandler > & inputHandler)

only call from InputHandler: capture mouse input to the given input handler

Obtain the mouse capture.

All mouse input will go exclusively to the capture input handler until ReleaseMouseCapture() is called.

◆ OnFrame()

void Base::InputServerBase::OnFrame ( )
virtual

call after processing window events

Reimplemented in GLFW::GLFWInputServer.

◆ Open()

void Base::InputServerBase::Open ( )
virtual

open the input server

Reimplemented in GLFW::GLFWInputServer.

◆ PutEvent()

void Base::InputServerBase::PutEvent ( const Input::InputEvent & ie)

put an input event into the handler chain

NOTE: MouseMove and RawMouseMove events will be distributed to all input handlers regardless of mouse capture state!

◆ ReleaseKeyboardCapture()

void Base::InputServerBase::ReleaseKeyboardCapture ( const Ptr< Input::InputHandler > & inputHandler)

only call from InputHandler: release keyboard capture

Release the mouse capture.

The provided pointer must match the current capture input handler.

◆ ReleaseMouseCapture()

void Base::InputServerBase::ReleaseMouseCapture ( const Ptr< Input::InputHandler > & inputHandler)

only call from InputHandler: release mouse capture

Release the mouse capture.

The provided pointer must match the current capture input handler.

◆ RemoveInputHandler()

void Base::InputServerBase::RemoveInputHandler ( const Ptr< Input::InputHandler > & inputHandler)

remove an input handler

◆ Reset()

void Base::InputServerBase::Reset ( )

reset input state

◆ SetMaxNumLocalPlayers()

void Base::InputServerBase::SetMaxNumLocalPlayers ( SizeT num)

set the max number of local players for this application (default is 4)

Setup the maximum number of local players for this application.

The default number is 1. This defines the number of game pad objects created and queried.

◆ SetQuitRequested()

void Base::InputServerBase::SetQuitRequested ( bool b)
inline

set the quit requested flag

Member Data Documentation

◆ creatorThreadId

Threading::ThreadId Base::InputServerBase::creatorThreadId
protected

◆ critSect

Threading::CriticalSection Base::InputServerBase::critSect
protected

◆ defaultGamePad

Util::FixedArray<Ptr<Input::GamePad> > Base::InputServerBase::defaultGamePad
protected

◆ defaultKeyboard

Ptr<Input::Keyboard> Base::InputServerBase::defaultKeyboard
protected

◆ defaultMouse

Ptr<Input::Mouse> Base::InputServerBase::defaultMouse
protected

◆ hasFocus

bool Base::InputServerBase::hasFocus
protected

◆ inBeginFrame

bool Base::InputServerBase::inBeginFrame
protected

◆ inputHandlers

Util::Array<Util::KeyValuePair<Input::InputPriority::Code,Ptr<Input::InputHandler> > > Base::InputServerBase::inputHandlers
protected

◆ inputHandlersLockCount

int Base::InputServerBase::inputHandlersLockCount
protected

◆ isOpen

bool Base::InputServerBase::isOpen
protected

◆ isQuitRequested

bool Base::InputServerBase::isQuitRequested
protected

◆ keyboardCaptureHandler

Ptr<Input::InputHandler> Base::InputServerBase::keyboardCaptureHandler
protected

◆ maxNumLocalPlayers

SizeT Base::InputServerBase::maxNumLocalPlayers
protected

◆ mouseCaptureHandler

Ptr<Input::InputHandler> Base::InputServerBase::mouseCaptureHandler
protected

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