DDraceNetwork Docs
CTouchControls Class Reference

#include <touch_controls.h>

Inheritance diagram for CTouchControls:
[legend]
Collaboration diagram for CTouchControls:
[legend]

Classes

class  CActionState
 
class  CBindToggleTouchButtonBehavior
 
class  CBindTouchButtonBehavior
 
class  CButtonLabel
 
class  CButtonVisibility
 
class  CButtonVisibilityData
 
class  CEmoticonTouchButtonBehavior
 
class  CExtraMenuTouchButtonBehavior
 
class  CIngameMenuTouchButtonBehavior
 
class  CJoystickActionTouchButtonBehavior
 
class  CJoystickAimTouchButtonBehavior
 
class  CJoystickFireTouchButtonBehavior
 
class  CJoystickHookTouchButtonBehavior
 
class  CJoystickTouchButtonBehavior
 
class  CPredefinedTouchButtonBehavior
 
class  CSpectateTouchButtonBehavior
 
class  CSwapActionTouchButtonBehavior
 
class  CTouchButton
 
class  CTouchButtonBehavior
 
class  CUnitRect
 
class  CUseActionTouchButtonBehavior
 

Public Types

enum class  EDirectTouchIngameMode {
  DISABLED , ACTION , AIM , FIRE ,
  HOOK , NUM_STATES
}
 
enum class  EDirectTouchSpectateMode { DISABLED , AIM , NUM_STATES }
 

Public Member Functions

int Sizeof () const override
 
void OnInit () override
 
void OnReset () override
 
void OnWindowResize () override
 
bool OnTouchState (const std::vector< IInput::CTouchFingerState > &vTouchFingerStates) override
 
void OnRender () override
 
bool LoadConfigurationFromFile (int StorageType)
 
bool LoadConfigurationFromClipboard ()
 
bool SaveConfigurationToFile ()
 
void SaveConfigurationToClipboard ()
 
EDirectTouchIngameMode DirectTouchIngame () const
 
void SetDirectTouchIngame (EDirectTouchIngameMode DirectTouchIngame)
 
EDirectTouchSpectateMode DirectTouchSpectate () const
 
void SetDirectTouchSpectate (EDirectTouchSpectateMode DirectTouchSpectate)
 
bool IsEditingActive () const
 
void SetEditingActive (bool EditingActive)
 
bool HasEditingChanges () const
 
void SetEditingChanges (bool EditingChanges)
 
- Public Member Functions inherited from CComponent
virtual ~CComponent ()
 
virtual int Sizeof () const =0
 
class CGameClientGameClient () const
 
class IClientClient () const
 
virtual void OnStateChange (int NewState, int OldState)
 
virtual void OnConsoleInit ()
 
virtual void OnInit ()
 
virtual void OnShutdown ()
 
virtual void OnReset ()
 
virtual void OnWindowResize ()
 
virtual void OnRefreshSkins ()
 
virtual void OnRender ()
 
virtual void OnNewSnapshot ()
 
virtual void OnRelease ()
 
virtual void OnMapLoad ()
 
virtual void OnMessage (int Msg, void *pRawMsg)
 
virtual bool OnCursorMove (float x, float y, IInput::ECursorType CursorType)
 
virtual bool OnInput (const IInput::CEvent &Event)
 
virtual bool OnTouchState (const std::vector< IInput::CTouchFingerState > &vTouchFingerStates)
 

Private Types

enum class  EButtonShape { RECT , CIRCLE , NUM_SHAPES }
 
enum class  EButtonVisibility {
  INGAME , ZOOM_ALLOWED , VOTE_ACTIVE , DUMMY_ALLOWED ,
  DUMMY_CONNECTED , RCON_AUTHED , DEMO_PLAYER , EXTRA_MENU_1 ,
  EXTRA_MENU_2 , EXTRA_MENU_3 , EXTRA_MENU_4 , EXTRA_MENU_5 ,
  NUM_VISIBILITIES
}
 
enum  { ACTION_AIM , ACTION_FIRE , ACTION_HOOK , NUM_ACTIONS }
 

Private Member Functions

void InitVisibilityFunctions ()
 
int NextActiveAction (int Action) const
 
int NextDirectTouchAction () const
 
void UpdateButtons (const std::vector< IInput::CTouchFingerState > &vTouchFingerStates)
 
void ResetButtons ()
 
void RenderButtons ()
 
vec2 CalculateScreenSize () const
 
bool ParseConfiguration (const void *pFileData, unsigned FileLength)
 
std::optional< EDirectTouchIngameModeParseDirectTouchIngameMode (const json_value *pModeValue)
 
std::optional< EDirectTouchSpectateModeParseDirectTouchSpectateMode (const json_value *pModeValue)
 
std::optional< CTouchButtonParseButton (const json_value *pButtonObject)
 
std::unique_ptr< CTouchButtonBehaviorParseBehavior (const json_value *pBehaviorObject)
 
std::unique_ptr< CPredefinedTouchButtonBehaviorParsePredefinedBehavior (const json_value *pBehaviorObject)
 
std::unique_ptr< CExtraMenuTouchButtonBehaviorParseExtraMenuBehavior (const json_value *pBehaviorObject)
 
std::unique_ptr< CBindTouchButtonBehaviorParseBindBehavior (const json_value *pBehaviorObject)
 
std::unique_ptr< CBindToggleTouchButtonBehaviorParseBindToggleBehavior (const json_value *pBehaviorObject)
 
void WriteConfiguration (CJsonWriter *pWriter)
 

Private Attributes

CButtonVisibilityData m_aVisibilityFunctions [(int) EButtonVisibility::NUM_VISIBILITIES]
 
EDirectTouchIngameMode m_DirectTouchIngame = EDirectTouchIngameMode::ACTION
 
EDirectTouchSpectateMode m_DirectTouchSpectate = EDirectTouchSpectateMode::AIM
 
std::vector< CTouchButtonm_vTouchButtons
 
bool m_aExtraMenuActive [(int) EButtonVisibility::EXTRA_MENU_5 -(int) EButtonVisibility::EXTRA_MENU_1+1] = {false}
 
int m_ActionSelected = ACTION_FIRE
 
int m_DirectTouchLastAction = ACTION_FIRE
 
CActionState m_aDirectTouchActionStates [NUM_ACTIONS]
 
CJoystickActionTouchButtonBehaviorm_pPrimaryJoystickTouchButtonBehavior
 
bool m_EditingActive = false
 
bool m_EditingChanges = false
 

Static Private Attributes

static constexpr const char *const DIRECT_TOUCH_INGAME_MODE_NAMES [(int) EDirectTouchIngameMode::NUM_STATES] = {"disabled", "action", "aim", "fire", "hook"}
 
static constexpr const char *const DIRECT_TOUCH_SPECTATE_MODE_NAMES [(int) EDirectTouchSpectateMode::NUM_STATES] = {"disabled", "aim"}
 
static constexpr const char *const SHAPE_NAMES [(int) EButtonShape::NUM_SHAPES] = {"rect", "circle"}
 
static constexpr const char *const LABEL_TYPE_NAMES [(int) CButtonLabel::EType::NUM_TYPES] = {"plain", "localized", "icon"}
 

Additional Inherited Members

- Protected Member Functions inherited from CComponent
class IKernelKernel () const
 
class IEngineEngine () const
 
class IGraphicsGraphics () const
 
class ITextRenderTextRender () const
 
class IInputInput () const
 
class IStorageStorage () const
 
class CUiUi () const
 
class ISoundSound () const
 
class CRenderToolsRenderTools () const
 
class IConfigManagerConfigManager () const
 
class CConfigConfig () const
 
class IConsoleConsole () const
 
class IDemoPlayerDemoPlayer () const
 
class IDemoRecorderDemoRecorder (int Recorder) const
 
class IFavoritesFavorites () const
 
class IServerBrowserServerBrowser () const
 
class CLayersLayers () const
 
class CCollisionCollision () const
 
int64_t time () const
 
float LocalTime () const
 
class IHttpHttp () const
 
- Protected Attributes inherited from CComponent
CGameClientm_pClient
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
ACTION_AIM 
ACTION_FIRE 
ACTION_HOOK 
NUM_ACTIONS 

◆ EButtonShape

enum class CTouchControls::EButtonShape
strongprivate
Enumerator
RECT 
CIRCLE 
NUM_SHAPES 

◆ EButtonVisibility

enum class CTouchControls::EButtonVisibility
strongprivate
Enumerator
INGAME 
ZOOM_ALLOWED 
VOTE_ACTIVE 
DUMMY_ALLOWED 
DUMMY_CONNECTED 
RCON_AUTHED 
DEMO_PLAYER 
EXTRA_MENU_1 
EXTRA_MENU_2 
EXTRA_MENU_3 
EXTRA_MENU_4 
EXTRA_MENU_5 
NUM_VISIBILITIES 

◆ EDirectTouchIngameMode

Enumerator
DISABLED 
ACTION 
AIM 
FIRE 
HOOK 
NUM_STATES 

◆ EDirectTouchSpectateMode

Enumerator
DISABLED 
AIM 
NUM_STATES 

Member Function Documentation

◆ CalculateScreenSize()

vec2 CTouchControls::CalculateScreenSize ( ) const
private

◆ DirectTouchIngame()

EDirectTouchIngameMode CTouchControls::DirectTouchIngame ( ) const
inline

◆ DirectTouchSpectate()

EDirectTouchSpectateMode CTouchControls::DirectTouchSpectate ( ) const
inline

◆ HasEditingChanges()

bool CTouchControls::HasEditingChanges ( ) const
inline

◆ InitVisibilityFunctions()

void CTouchControls::InitVisibilityFunctions ( )
private

◆ IsEditingActive()

bool CTouchControls::IsEditingActive ( ) const
inline

◆ LoadConfigurationFromClipboard()

bool CTouchControls::LoadConfigurationFromClipboard ( )

◆ LoadConfigurationFromFile()

bool CTouchControls::LoadConfigurationFromFile ( int  StorageType)

◆ NextActiveAction()

int CTouchControls::NextActiveAction ( int  Action) const
private

◆ NextDirectTouchAction()

int CTouchControls::NextDirectTouchAction ( ) const
private

◆ OnInit()

void CTouchControls::OnInit ( )
overridevirtual

Called to let the components run initialization code.

Reimplemented from CComponent.

◆ OnRender()

void CTouchControls::OnRender ( )
overridevirtual

Called when the component should get rendered.

The render order depends on the component insertion order.

Reimplemented from CComponent.

◆ OnReset()

void CTouchControls::OnReset ( )
overridevirtual

Called to reset the component. This method is usually called on your component constructor to avoid code duplication.

See also
CHud::CHud()
CHud::OnReset()

Reimplemented from CComponent.

◆ OnTouchState()

bool CTouchControls::OnTouchState ( const std::vector< IInput::CTouchFingerState > &  vTouchFingerStates)
overridevirtual

Called with all current touch finger states.

Parameters
vTouchFingerStatesThe touch finger states to be handled.
Returns
true if the component used the touch events, false otherwise

Reimplemented from CComponent.

◆ OnWindowResize()

void CTouchControls::OnWindowResize ( )
overridevirtual

Called when the window has been resized.

Reimplemented from CComponent.

◆ ParseBehavior()

std::unique_ptr< CTouchControls::CTouchButtonBehavior > CTouchControls::ParseBehavior ( const json_value pBehaviorObject)
private

◆ ParseBindBehavior()

std::unique_ptr< CTouchControls::CBindTouchButtonBehavior > CTouchControls::ParseBindBehavior ( const json_value pBehaviorObject)
private

◆ ParseBindToggleBehavior()

std::unique_ptr< CTouchControls::CBindToggleTouchButtonBehavior > CTouchControls::ParseBindToggleBehavior ( const json_value pBehaviorObject)
private

◆ ParseButton()

std::optional< CTouchControls::CTouchButton > CTouchControls::ParseButton ( const json_value pButtonObject)
private

◆ ParseConfiguration()

bool CTouchControls::ParseConfiguration ( const void *  pFileData,
unsigned  FileLength 
)
private

◆ ParseDirectTouchIngameMode()

std::optional< CTouchControls::EDirectTouchIngameMode > CTouchControls::ParseDirectTouchIngameMode ( const json_value pModeValue)
private

◆ ParseDirectTouchSpectateMode()

std::optional< CTouchControls::EDirectTouchSpectateMode > CTouchControls::ParseDirectTouchSpectateMode ( const json_value pModeValue)
private

◆ ParseExtraMenuBehavior()

std::unique_ptr< CTouchControls::CExtraMenuTouchButtonBehavior > CTouchControls::ParseExtraMenuBehavior ( const json_value pBehaviorObject)
private

◆ ParsePredefinedBehavior()

std::unique_ptr< CTouchControls::CPredefinedTouchButtonBehavior > CTouchControls::ParsePredefinedBehavior ( const json_value pBehaviorObject)
private

◆ RenderButtons()

void CTouchControls::RenderButtons ( )
private

◆ ResetButtons()

void CTouchControls::ResetButtons ( )
private

◆ SaveConfigurationToClipboard()

void CTouchControls::SaveConfigurationToClipboard ( )

◆ SaveConfigurationToFile()

bool CTouchControls::SaveConfigurationToFile ( )

◆ SetDirectTouchIngame()

void CTouchControls::SetDirectTouchIngame ( EDirectTouchIngameMode  DirectTouchIngame)
inline

◆ SetDirectTouchSpectate()

void CTouchControls::SetDirectTouchSpectate ( EDirectTouchSpectateMode  DirectTouchSpectate)
inline

◆ SetEditingActive()

void CTouchControls::SetEditingActive ( bool  EditingActive)
inline

◆ SetEditingChanges()

void CTouchControls::SetEditingChanges ( bool  EditingChanges)
inline

◆ Sizeof()

int CTouchControls::Sizeof ( ) const
inlineoverridevirtual

Gets the size of the non-abstract component.

Implements CComponent.

◆ UpdateButtons()

void CTouchControls::UpdateButtons ( const std::vector< IInput::CTouchFingerState > &  vTouchFingerStates)
private

◆ WriteConfiguration()

void CTouchControls::WriteConfiguration ( CJsonWriter pWriter)
private

Member Data Documentation

◆ DIRECT_TOUCH_INGAME_MODE_NAMES

constexpr const char* const CTouchControls::DIRECT_TOUCH_INGAME_MODE_NAMES[(int) EDirectTouchIngameMode::NUM_STATES] = {"disabled", "action", "aim", "fire", "hook"}
staticconstexprprivate

◆ DIRECT_TOUCH_SPECTATE_MODE_NAMES

constexpr const char* const CTouchControls::DIRECT_TOUCH_SPECTATE_MODE_NAMES[(int) EDirectTouchSpectateMode::NUM_STATES] = {"disabled", "aim"}
staticconstexprprivate

◆ LABEL_TYPE_NAMES

constexpr const char* const CTouchControls::LABEL_TYPE_NAMES[(int) CButtonLabel::EType::NUM_TYPES] = {"plain", "localized", "icon"}
staticconstexprprivate

◆ m_ActionSelected

int CTouchControls::m_ActionSelected = ACTION_FIRE
private

The currently selected action which is used for direct touch and is changed and used by some button behaviors.

◆ m_aDirectTouchActionStates

CActionState CTouchControls::m_aDirectTouchActionStates[NUM_ACTIONS]
private

The states of the different actions for direct touch input.

◆ m_aExtraMenuActive

bool CTouchControls::m_aExtraMenuActive[(int) EButtonVisibility::EXTRA_MENU_5 -(int) EButtonVisibility::EXTRA_MENU_1+1] = {false}
private

The activation states of the different extra menus which are toggle by the extra menu button behavior.

◆ m_aVisibilityFunctions

CButtonVisibilityData CTouchControls::m_aVisibilityFunctions[(int) EButtonVisibility::NUM_VISIBILITIES]
private

◆ m_DirectTouchIngame

EDirectTouchIngameMode CTouchControls::m_DirectTouchIngame = EDirectTouchIngameMode::ACTION
private

Mode of direct touch input while ingame.

Saved to the touch controls configuration.

◆ m_DirectTouchLastAction

int CTouchControls::m_DirectTouchLastAction = ACTION_FIRE
private

The action that was last activated with direct touch input, which will determine the finger that will be used to update the mouse position from direct touch input.

◆ m_DirectTouchSpectate

EDirectTouchSpectateMode CTouchControls::m_DirectTouchSpectate = EDirectTouchSpectateMode::AIM
private

Mode of direct touch input while spectating.

Saved to the touch controls configuration.

◆ m_EditingActive

bool CTouchControls::m_EditingActive = false
private

Whether editing mode is currently active.

◆ m_EditingChanges

bool CTouchControls::m_EditingChanges = false
private

Whether there are changes to the current configuration in editing mode.

◆ m_pPrimaryJoystickTouchButtonBehavior

CJoystickActionTouchButtonBehavior* CTouchControls::m_pPrimaryJoystickTouchButtonBehavior
private

A pointer to the action joystick, if any exists in the current configuration, or nullptr if none. This is set by CJoystickActionTouchButtonBehavior when it is initialized and always cleared before loading a new touch button configuration.

◆ m_vTouchButtons

std::vector<CTouchButton> CTouchControls::m_vTouchButtons
private

All touch buttons.

Saved to the touch controls configuration.

◆ SHAPE_NAMES

constexpr const char* const CTouchControls::SHAPE_NAMES[(int) EButtonShape::NUM_SHAPES] = {"rect", "circle"}
staticconstexprprivate

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