OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4PlayerControlDef Class Reference

#include <C4PlayerControl.h>

Public Types

enum  CoordinateSpace { COS_Game = 0, COS_Viewport = 1 }
 
enum  Actions {
  CDA_None = 0, CDA_Script, CDA_Menu, CDA_MenuOK,
  CDA_MenuCancel, CDA_MenuLeft, CDA_MenuUp, CDA_MenuRight,
  CDA_MenuDown, CDA_ObjectMenuTextComplete, CDA_ObjectMenuOK, CDA_ObjectMenuOKAll,
  CDA_ObjectMenuSelect, CDA_ObjectMenuCancel, CDA_ObjectMenuLeft, CDA_ObjectMenuUp,
  CDA_ObjectMenuRight, CDA_ObjectMenuDown, CDA_ZoomIn, CDA_ZoomOut
}
 

Public Member Functions

 C4PlayerControlDef ()
 
 ~C4PlayerControlDef ()=default
 
void CompileFunc (StdCompiler *pComp)
 
const char * GetIdentifier () const
 
const char * GetGUIName () const
 
const char * GetGUIDesc () const
 
Actions GetAction () const
 
bool IsHoldKey () const
 
C4ID GetExtraData () const
 
bool IsGlobal () const
 
int32_t GetRepeatDelay () const
 
int32_t GetInitialRepeatDelay () const
 
bool IsDefaultDisabled () const
 
CoordinateSpace GetCoordinateSpace () const
 
bool IsSendCursorPos () const
 
bool operator== (const C4PlayerControlDef &cmp) const
 
bool Execute (bool fUp, const C4KeyEventData &rKeyExtraData)
 
bool IsSyncObjectMenuControl () const
 
bool IsAsync () const
 
bool IsSync () const
 
bool IsValid () const
 

Detailed Description

Definition at line 29 of file C4PlayerControl.h.

Member Enumeration Documentation

Enumerator
CDA_None 
CDA_Script 
CDA_Menu 
CDA_MenuOK 
CDA_MenuCancel 
CDA_MenuLeft 
CDA_MenuUp 
CDA_MenuRight 
CDA_MenuDown 
CDA_ObjectMenuTextComplete 
CDA_ObjectMenuOK 
CDA_ObjectMenuOKAll 
CDA_ObjectMenuSelect 
CDA_ObjectMenuCancel 
CDA_ObjectMenuLeft 
CDA_ObjectMenuUp 
CDA_ObjectMenuRight 
CDA_ObjectMenuDown 
CDA_ZoomIn 
CDA_ZoomOut 

Definition at line 37 of file C4PlayerControl.h.

38  {
39  CDA_None = 0, // do nothing
40  CDA_Script, // default: Script callback
41  CDA_Menu, // open player menu (async)
42  CDA_MenuOK, CDA_MenuCancel, CDA_MenuLeft, CDA_MenuUp, CDA_MenuRight, CDA_MenuDown, // player menu controls (async)
43  CDA_ObjectMenuTextComplete, // object menu fast-foward through text animation (async)
45  CDA_ZoomIn, CDA_ZoomOut // player viewport control (async)
46  };
Enumerator
COS_Game 
COS_Viewport 

Definition at line 32 of file C4PlayerControl.h.

33  {
34  COS_Game = 0, // game (landscape) coordinates
35  COS_Viewport = 1 // viewport (GUI) coordinates
36  };

Constructor & Destructor Documentation

C4PlayerControlDef::C4PlayerControlDef ( )
inline

Definition at line 63 of file C4PlayerControl.h.

63  :
64  idControlExtraData(C4ID::None)
65  {}
static const C4ID None
Definition: C4Id.h:39
C4PlayerControlDef::~C4PlayerControlDef ( )
default

Member Function Documentation

void C4PlayerControlDef::CompileFunc ( StdCompiler pComp)

Definition at line 39 of file C4PlayerControl.cpp.

References CDA_Menu, CDA_MenuCancel, CDA_MenuDown, CDA_MenuLeft, CDA_MenuOK, CDA_MenuRight, CDA_MenuUp, CDA_None, CDA_ObjectMenuCancel, CDA_ObjectMenuDown, CDA_ObjectMenuLeft, CDA_ObjectMenuOK, CDA_ObjectMenuOKAll, CDA_ObjectMenuRight, CDA_ObjectMenuSelect, CDA_ObjectMenuTextComplete, CDA_ObjectMenuUp, CDA_Script, CDA_ZoomIn, CDA_ZoomOut, COS_Game, COS_Viewport, StdCompiler::excNotFound(), mkNamingAdapt(), mkParAdapt(), StdCompiler::Name(), StdCompiler::NameEnd(), C4ID::None, StdCompiler::RCT_All, StdCompiler::RCT_Idtf, and StdCompiler::Value().

40 {
41  if (!pComp->Name("ControlDef")) { pComp->NameEnd(); pComp->excNotFound("ControlDef"); }
42  pComp->Value(mkNamingAdapt(mkParAdapt(sIdentifier, StdCompiler::RCT_Idtf), "Identifier", "None"));
43  pComp->Value(mkNamingAdapt(mkParAdapt(sGUIName, StdCompiler::RCT_All), "GUIName", ""));
44  pComp->Value(mkNamingAdapt(mkParAdapt(sGUIDesc, StdCompiler::RCT_All), "GUIDesc", ""));
45  pComp->Value(mkNamingAdapt(fGlobal, "Global", false));
46  pComp->Value(mkNamingAdapt(fIsHoldKey, "Hold", false));
47  pComp->Value(mkNamingAdapt(iRepeatDelay, "RepeatDelay", 0));
48  pComp->Value(mkNamingAdapt(iInitialRepeatDelay, "InitialRepeatDelay", 0));
49  pComp->Value(mkNamingAdapt(fDefaultDisabled, "DefaultDisabled", false));
50  pComp->Value(mkNamingAdapt(idControlExtraData, "ExtraData", C4ID::None));
51  const StdEnumEntry<CoordinateSpace> CoordSpaceNames[] =
52  {
53  { "Game", COS_Game },
54  { "Viewport", COS_Viewport },
55  { nullptr, COS_Game }
56  };
57  pComp->Value(mkNamingAdapt(mkEnumAdapt<CoordinateSpace, int32_t>(eCoordSpace, CoordSpaceNames), "CoordinateSpace", COS_Game));
58  pComp->Value(mkNamingAdapt(fSendCursorPos, "SendCursorPos", false));
59  const StdEnumEntry<Actions> ActionNames[] =
60  {
61  { "None", CDA_None },
62  { "Script", CDA_Script },
63  { "Menu", CDA_Menu },
64  { "MenuOK", CDA_MenuOK },
65  { "MenuCancel", CDA_MenuCancel },
66  { "MenuLeft", CDA_MenuLeft },
67  { "MenuUp", CDA_MenuUp },
68  { "MenuRight", CDA_MenuRight },
69  { "MenuDown", CDA_MenuDown },
70  { "ObjectMenuTextComplete", CDA_ObjectMenuTextComplete },
71  { "ObjectMenuOK", CDA_ObjectMenuOK },
72  { "ObjectMenuOKAll", CDA_ObjectMenuOKAll },
73  { "ObjectMenuSelect",CDA_ObjectMenuSelect },
74  { "ObjectMenuCancel",CDA_ObjectMenuCancel },
75  { "ObjectMenuLeft", CDA_ObjectMenuLeft },
76  { "ObjectMenuUp", CDA_ObjectMenuUp },
77  { "ObjectMenuRight", CDA_ObjectMenuRight },
78  { "ObjectMenuDown", CDA_ObjectMenuDown },
79  { "ZoomIn", CDA_ZoomIn },
80  { "ZoomOut", CDA_ZoomOut },
81  { nullptr, CDA_None }
82  };
83  pComp->Value(mkNamingAdapt(mkEnumAdapt<Actions, int32_t>(eAction, ActionNames), "Action", CDA_Script));
84  pComp->NameEnd();
85 }
Definition: StdAdaptors.h:762
virtual bool Name(const char *szName)
Definition: StdCompiler.h:77
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:92
static const C4ID None
Definition: C4Id.h:39
void excNotFound(const char *szMessage,...)
Definition: StdCompiler.h:233
void Value(const T &rStruct)
Definition: StdCompiler.h:161
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:458
virtual void NameEnd(bool fBreak=false)
Definition: StdCompiler.h:78

Here is the call graph for this function:

bool C4PlayerControlDef::Execute ( bool  fUp,
const C4KeyEventData rKeyExtraData 
)
Actions C4PlayerControlDef::GetAction ( ) const
inline

Definition at line 73 of file C4PlayerControl.h.

Referenced by C4PlayerControl::Execute().

73 { return eAction; }

Here is the caller graph for this function:

CoordinateSpace C4PlayerControlDef::GetCoordinateSpace ( ) const
inline

Definition at line 80 of file C4PlayerControl.h.

80 { return eCoordSpace; }
C4ID C4PlayerControlDef::GetExtraData ( ) const
inline

Definition at line 75 of file C4PlayerControl.h.

Referenced by C4PlayerControl::Execute().

75 { return idControlExtraData; }

Here is the caller graph for this function:

const char* C4PlayerControlDef::GetGUIDesc ( ) const
inline

Definition at line 72 of file C4PlayerControl.h.

References StdStrBuf::getData().

Referenced by C4PlayerControlAssignment::GetGUIDesc().

72 { return sGUIDesc.getData(); }
const char * getData() const
Definition: StdBuf.h:442

Here is the call graph for this function:

Here is the caller graph for this function:

const char* C4PlayerControlDef::GetGUIName ( ) const
inline

Definition at line 71 of file C4PlayerControl.h.

References StdStrBuf::getData().

Referenced by C4PlayerControlAssignment::GetGUIName().

71 { return sGUIName.getData(); }
const char * getData() const
Definition: StdBuf.h:442

Here is the call graph for this function:

Here is the caller graph for this function:

const char* C4PlayerControlDef::GetIdentifier ( ) const
inline

Definition at line 70 of file C4PlayerControl.h.

References StdStrBuf::getData().

70 { return sIdentifier.getData(); }
const char * getData() const
Definition: StdBuf.h:442

Here is the call graph for this function:

int32_t C4PlayerControlDef::GetInitialRepeatDelay ( ) const
inline

Definition at line 78 of file C4PlayerControl.h.

Referenced by C4PlayerControl::Execute().

78 { return iInitialRepeatDelay; }

Here is the caller graph for this function:

int32_t C4PlayerControlDef::GetRepeatDelay ( ) const
inline

Definition at line 77 of file C4PlayerControl.h.

Referenced by C4PlayerControl::Execute().

77 { return iRepeatDelay; }

Here is the caller graph for this function:

bool C4PlayerControlDef::IsAsync ( ) const
inline

Definition at line 87 of file C4PlayerControl.h.

References CDA_None, CDA_Script, and IsSyncObjectMenuControl().

87 { return eAction != CDA_None && eAction != CDA_Script && !IsSyncObjectMenuControl(); } // true if to be executed directly when triggered
bool IsSyncObjectMenuControl() const

Here is the call graph for this function:

bool C4PlayerControlDef::IsDefaultDisabled ( ) const
inline

Definition at line 79 of file C4PlayerControl.h.

Referenced by C4PlayerControl::CSync::InitDefaults().

79 { return fDefaultDisabled; }

Here is the caller graph for this function:

bool C4PlayerControlDef::IsGlobal ( ) const
inline

Definition at line 76 of file C4PlayerControl.h.

76 { return fGlobal; }
bool C4PlayerControlDef::IsHoldKey ( ) const
inline

Definition at line 74 of file C4PlayerControl.h.

Referenced by C4PlayerControlAssignmentSet::GetAssignmentsByKey(), and C4PlayerControlAssignmentSet::GetTriggerKeys().

74 { return fIsHoldKey; }

Here is the caller graph for this function:

bool C4PlayerControlDef::IsSendCursorPos ( ) const
inline

Definition at line 81 of file C4PlayerControl.h.

81 { return fSendCursorPos; }
bool C4PlayerControlDef::IsSync ( ) const
inline

Definition at line 88 of file C4PlayerControl.h.

References CDA_Script, and IsSyncObjectMenuControl().

Referenced by C4PlayerControl::ExecuteControlPacket().

88 { return eAction == CDA_Script || IsSyncObjectMenuControl(); } // true if to be executed via control queue
bool IsSyncObjectMenuControl() const

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4PlayerControlDef::IsSyncObjectMenuControl ( ) const
inline

Definition at line 86 of file C4PlayerControl.h.

References CDA_ObjectMenuDown, and CDA_ObjectMenuOK.

Referenced by IsAsync(), and IsSync().

Here is the caller graph for this function:

bool C4PlayerControlDef::IsValid ( ) const
inline

Definition at line 89 of file C4PlayerControl.h.

References CDA_None.

89 { return eAction != CDA_None; }
bool C4PlayerControlDef::operator== ( const C4PlayerControlDef cmp) const

Definition at line 87 of file C4PlayerControl.cpp.

88 {
89  return sIdentifier == cmp.sIdentifier
90  && sGUIName == cmp.sGUIName
91  && sGUIDesc == cmp.sGUIDesc
92  && fGlobal == cmp.fGlobal
93  && fIsHoldKey == cmp.fIsHoldKey
94  && iRepeatDelay == cmp.iRepeatDelay
95  && iInitialRepeatDelay == cmp.iInitialRepeatDelay
96  && fDefaultDisabled == cmp.fDefaultDisabled
97  && idControlExtraData == cmp.idControlExtraData
98  && fSendCursorPos == cmp.fSendCursorPos
99  && eAction == cmp.eAction;
100 }

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