Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
Public Types | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Static Protected Attributes
Fling::Input Class Referenceabstract

Base input class for polling input in the Fling Engine. More...

#include <Input.h>

Inherits Fling::NonCopyable.

Public Types

typedef std::map< std::string, Fling::KeyKeyMap
 Input Key mappings. More...
 
typedef std::pair< std::string, Fling::KeyKeyPair
 
typedef std::map< std::string, entt::delegate< void()> > KeyDownMap
 Key press delegate mappings. More...
 
typedef std::pair< std::string, entt::delegate< void()> > KeyDownMapPair
 

Static Public Member Functions

static void Init ()
 Initialize the input instance on this platform. More...
 
static void PreUpdate ()
 PreUpdate is called before polling of input, and after Init. More...
 
static void Shutdown ()
 Shuts down input manager. More...
 
static void Poll ()
 Update any input polling that needs to happen on this platform. More...
 
static bool IsKeyDown (const std::string &t_KeyName)
 
static bool IsKeyHeld (const std::string &t_KeyName)
 
static bool IsMouseButtonPressed (const std::string &t_KeyName)
 
static bool IsMouseDown (const std::string &t_KeyName)
 
static MousePos GetMousePos ()
 Get the current mouse position in screen space. More...
 
template<auto Candidate, typename Type >
static void BindKeyPress (const std::string &t_KeyName, Type &t_Instance)
 Bind a callback function to when a key is pressed. More...
 

Protected Member Functions

virtual void InitImpl ()=0
 
virtual void PreUpdateImpl ()=0
 
virtual void ShutdownImpl ()=0
 
virtual void PollImpl ()=0
 Poll for input from the keyboard. More...
 
virtual void InitKeyMap ()=0
 
virtual bool IsKeyDownImpl (const std::string &t_KeyName)=0
 
virtual bool IsKeyHelpImpl (const std::string &t_KeyName)=0
 
virtual bool IsMouseButtonPressedImpl (const std::string &t_KeyName)=0
 
virtual bool IsMouseDownImpl (const std::string &t_KeyName)=0
 
virtual MousePos GetMousePosImpl ()=0
 
- Protected Member Functions inherited from Fling::NonCopyable
 NonCopyable ()=default
 
virtual ~NonCopyable ()=default
 

Static Protected Member Functions

static void AddKeyMap (const std::string &t_Name, UINT32 t_KeyCode)
 Add a key mapping to this platform. More...
 

Static Protected Attributes

static KeyMap m_KeyMap
 The actual key map. More...
 
static KeyDownMap m_KeyDownMap
 
static Inputm_Instance
 Created by the implementation class. More...
 

Additional Inherited Members

- Public Member Functions inherited from Fling::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
 NonCopyable (NonCopyable &&)=default
 
NonCopyableoperator= (const NonCopyable &)=delete
 
NonCopyableoperator= (NonCopyable &&)=default
 

Detailed Description

Base input class for polling input in the Fling Engine.

Member Typedef Documentation

◆ KeyDownMap

typedef std::map<std::string, entt::delegate<void()> > Fling::Input::KeyDownMap

Key press delegate mappings.

◆ KeyDownMapPair

typedef std::pair<std::string, entt::delegate<void()> > Fling::Input::KeyDownMapPair

◆ KeyMap

typedef std::map<std::string, Fling::Key> Fling::Input::KeyMap

Input Key mappings.

◆ KeyPair

typedef std::pair<std::string, Fling::Key> Fling::Input::KeyPair

Member Function Documentation

◆ AddKeyMap()

static void Fling::Input::AddKeyMap ( const std::string &  t_Name,
UINT32  t_KeyCode 
)
inlinestaticprotected

Add a key mapping to this platform.

Parameters
t_NameThe name of this key
t_KeyCodeThe KeyCode that maps this key to the current platform

◆ BindKeyPress()

template<auto Candidate, typename Type >
void Fling::Input::BindKeyPress ( const std::string &  t_KeyName,
Type &  t_Instance 
)
static

Bind a callback function to when a key is pressed.

Template Parameters
CandidateThe function that you would like to bind
Parameters
t_KeyNameKey name to bind to
t_InstanceThe instance of the object you are binding to
See also
https://github.com/skypjack/entt/wiki/Crash-Course:-events,-signals-and-everything-in-between#delegate
Fling::KeyNames

◆ GetMousePos()

static MousePos Fling::Input::GetMousePos ( )
inlinestatic

Get the current mouse position in screen space.

◆ GetMousePosImpl()

virtual MousePos Fling::Input::GetMousePosImpl ( )
protectedpure virtual

◆ Init()

static void Fling::Input::Init ( )
inlinestatic

Initialize the input instance on this platform.

Handle and input mapping on this platform

◆ InitImpl()

virtual void Fling::Input::InitImpl ( )
protectedpure virtual

◆ InitKeyMap()

virtual void Fling::Input::InitKeyMap ( )
protectedpure virtual

◆ IsKeyDown()

static bool Fling::Input::IsKeyDown ( const std::string &  t_KeyName)
inlinestatic

◆ IsKeyDownImpl()

virtual bool Fling::Input::IsKeyDownImpl ( const std::string &  t_KeyName)
protectedpure virtual

◆ IsKeyHeld()

static bool Fling::Input::IsKeyHeld ( const std::string &  t_KeyName)
inlinestatic

◆ IsKeyHelpImpl()

virtual bool Fling::Input::IsKeyHelpImpl ( const std::string &  t_KeyName)
protectedpure virtual

◆ IsMouseButtonPressed()

static bool Fling::Input::IsMouseButtonPressed ( const std::string &  t_KeyName)
inlinestatic

◆ IsMouseButtonPressedImpl()

virtual bool Fling::Input::IsMouseButtonPressedImpl ( const std::string &  t_KeyName)
protectedpure virtual

◆ IsMouseDown()

static bool Fling::Input::IsMouseDown ( const std::string &  t_KeyName)
inlinestatic

◆ IsMouseDownImpl()

virtual bool Fling::Input::IsMouseDownImpl ( const std::string &  t_KeyName)
protectedpure virtual

◆ Poll()

static void Fling::Input::Poll ( )
inlinestatic

Update any input polling that needs to happen on this platform.

◆ PollImpl()

virtual void Fling::Input::PollImpl ( )
protectedpure virtual

Poll for input from the keyboard.

◆ PreUpdate()

static void Fling::Input::PreUpdate ( )
inlinestatic

PreUpdate is called before polling of input, and after Init.

Useful for anything that needs to happen after Window creation.

◆ PreUpdateImpl()

virtual void Fling::Input::PreUpdateImpl ( )
protectedpure virtual

◆ Shutdown()

static void Fling::Input::Shutdown ( )
inlinestatic

Shuts down input manager.

Deletes the input implementation pointer.

◆ ShutdownImpl()

virtual void Fling::Input::ShutdownImpl ( )
protectedpure virtual

Field Documentation

◆ m_Instance

Input* Fling::Input::m_Instance
staticprotected

Created by the implementation class.

See also
WindowInput

◆ m_KeyDownMap

KeyDownMap Fling::Input::m_KeyDownMap
staticprotected

◆ m_KeyMap

KeyMap Fling::Input::m_KeyMap
staticprotected

The actual key map.


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