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 ()
 
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 31 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 39 of file C4PlayerControl.h.

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

Definition at line 34 of file C4PlayerControl.h.

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

Constructor & Destructor Documentation

C4PlayerControlDef::C4PlayerControlDef ( )
inline

Definition at line 65 of file C4PlayerControl.h.

65  :
66  fGlobal(false), fIsHoldKey(false), fDefaultDisabled(false), fSendCursorPos(false),
67  idControlExtraData(C4ID::None), eCoordSpace(COS_Game), eAction(CDA_Script)
68  {}
static const C4ID None
Definition: C4Id.h:42
C4PlayerControlDef::~C4PlayerControlDef ( )
inline

Definition at line 69 of file C4PlayerControl.h.

69 {};

Member Function Documentation

void C4PlayerControlDef::CompileFunc ( StdCompiler pComp)

Definition at line 44 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().

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

Here is the call graph for this function:

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

Definition at line 76 of file C4PlayerControl.h.

Referenced by C4PlayerControl::Execute().

76 { return eAction; }

Here is the caller graph for this function:

CoordinateSpace C4PlayerControlDef::GetCoordinateSpace ( ) const
inline

Definition at line 83 of file C4PlayerControl.h.

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

Definition at line 78 of file C4PlayerControl.h.

Referenced by C4PlayerControl::Execute().

78 { return idControlExtraData; }

Here is the caller graph for this function:

const char* C4PlayerControlDef::GetGUIDesc ( ) const
inline

Definition at line 75 of file C4PlayerControl.h.

References StdStrBuf::getData().

Referenced by C4PlayerControlAssignment::GetGUIDesc().

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

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 74 of file C4PlayerControl.h.

References StdStrBuf::getData().

Referenced by C4PlayerControlAssignment::GetGUIName().

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

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 73 of file C4PlayerControl.h.

References StdStrBuf::getData().

Referenced by C4PlayerControlDefs::MergeFrom().

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

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4PlayerControlDef::GetInitialRepeatDelay ( ) const
inline

Definition at line 81 of file C4PlayerControl.h.

Referenced by C4PlayerControl::Execute().

81 { return iInitialRepeatDelay; }

Here is the caller graph for this function:

int32_t C4PlayerControlDef::GetRepeatDelay ( ) const
inline

Definition at line 80 of file C4PlayerControl.h.

Referenced by C4PlayerControl::Execute().

80 { return iRepeatDelay; }

Here is the caller graph for this function:

bool C4PlayerControlDef::IsAsync ( ) const
inline

Definition at line 90 of file C4PlayerControl.h.

References CDA_None, CDA_Script, and IsSyncObjectMenuControl().

90 { 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 82 of file C4PlayerControl.h.

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

82 { return fDefaultDisabled; }

Here is the caller graph for this function:

bool C4PlayerControlDef::IsGlobal ( ) const
inline

Definition at line 79 of file C4PlayerControl.h.

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

Definition at line 77 of file C4PlayerControl.h.

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

77 { return fIsHoldKey; }

Here is the caller graph for this function:

bool C4PlayerControlDef::IsSendCursorPos ( ) const
inline

Definition at line 84 of file C4PlayerControl.h.

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

Definition at line 91 of file C4PlayerControl.h.

References CDA_Script, and IsSyncObjectMenuControl().

Referenced by C4PlayerControl::ExecuteControlPacket().

91 { 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 89 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 92 of file C4PlayerControl.h.

References CDA_None.

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

Definition at line 92 of file C4PlayerControl.cpp.

93 {
94  return sIdentifier == cmp.sIdentifier
95  && sGUIName == cmp.sGUIName
96  && sGUIDesc == cmp.sGUIDesc
97  && fGlobal == cmp.fGlobal
98  && fIsHoldKey == cmp.fIsHoldKey
99  && iRepeatDelay == cmp.iRepeatDelay
100  && iInitialRepeatDelay == cmp.iInitialRepeatDelay
101  && fDefaultDisabled == cmp.fDefaultDisabled
102  && idControlExtraData == cmp.idControlExtraData
103  && fSendCursorPos == cmp.fSendCursorPos
104  && eAction == cmp.eAction;
105 }

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