OpenClonk
C4ConfigGamepad Class Reference

#include <C4Config.h>

Public Member Functions

void CompileFunc (StdCompiler *compiler, bool buttons_only=false)
 
void ResetButtons ()
 
void Reset ()
 

Public Attributes

int32_t Button [C4MaxKey]
 
uint32_t AxisMin [6]
 
uint32_t AxisMax [6]
 
bool AxisCalibrated [6]
 

Detailed Description

Definition at line 219 of file C4Config.h.

Member Function Documentation

◆ CompileFunc()

void C4ConfigGamepad::CompileFunc ( StdCompiler compiler,
bool  buttons_only = false 
)

Definition at line 231 of file C4Config.cpp.

232 {
233  /* The defaults here are for a Logitech Dual Action under Linux-SDL. Better than nothing, I guess. */
234  if (!buttons_only)
235  {
236  for (int i = 0; i < 6; ++i)
237  {
238  compiler->Value(mkNamingAdapt(AxisMin[i], FormatString("Axis%dMin", i).getData(), 0u));
239  compiler->Value(mkNamingAdapt(AxisMax[i], FormatString("Axis%dMax", i).getData(), 0u));
240  compiler->Value(mkNamingAdapt(AxisCalibrated[i], FormatString("Axis%dCalibrated", i).getData(), false));
241  }
242  }
243  compiler->Value(mkNamingAdapt(Button[0], "Button1", -1 ));
244  compiler->Value(mkNamingAdapt(Button[1], "Button2", -1 ));
245  compiler->Value(mkNamingAdapt(Button[2], "Button3", -1 ));
246  compiler->Value(mkNamingAdapt(Button[3], "Button4", -1 ));
247  compiler->Value(mkNamingAdapt(Button[4], "Button5", -1 ));
248  compiler->Value(mkNamingAdapt(Button[5], "Button6", -1 ));
249  compiler->Value(mkNamingAdapt(Button[6], "Button7", -1 ));
250  compiler->Value(mkNamingAdapt(Button[7], "Button8", -1 ));
251  compiler->Value(mkNamingAdapt(Button[8], "Button9", -1 ));
252  compiler->Value(mkNamingAdapt(Button[9], "Button10", -1 ));
253  compiler->Value(mkNamingAdapt(Button[10], "Button11", -1 ));
254  compiler->Value(mkNamingAdapt(Button[11], "Button12", -1 ));
255 }
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:92
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270
bool AxisCalibrated[6]
Definition: C4Config.h:224
uint32_t AxisMax[6]
Definition: C4Config.h:223
uint32_t AxisMin[6]
Definition: C4Config.h:223
int32_t Button[C4MaxKey]
Definition: C4Config.h:222
void Value(const T &rStruct)
Definition: StdCompiler.h:161

References AxisCalibrated, AxisMax, AxisMin, Button, FormatString(), mkNamingAdapt(), and StdCompiler::Value().

Here is the call graph for this function:

◆ Reset()

void C4ConfigGamepad::Reset ( )

Definition at line 263 of file C4Config.cpp.

264 {
265  // loads an empty config for the gamepad config
266  StdCompilerNull Comp; Comp.Compile(mkParAdapt(*this, false));
267 }
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:490
void Compile(T &&rStruct)
Definition: StdCompiler.h:173

References StdCompiler::Compile(), and mkParAdapt().

Here is the call graph for this function:

◆ ResetButtons()

void C4ConfigGamepad::ResetButtons ( )

Definition at line 257 of file C4Config.cpp.

258 {
259  // loads an empty config for the buttons
260  StdCompilerNull Comp; Comp.Compile(mkParAdapt(*this, true));
261 }

References StdCompiler::Compile(), and mkParAdapt().

Here is the call graph for this function:

Member Data Documentation

◆ AxisCalibrated

bool C4ConfigGamepad::AxisCalibrated[6]

Definition at line 224 of file C4Config.h.

Referenced by CompileFunc().

◆ AxisMax

uint32_t C4ConfigGamepad::AxisMax[6]

Definition at line 223 of file C4Config.h.

Referenced by CompileFunc().

◆ AxisMin

uint32_t C4ConfigGamepad::AxisMin[6]

Definition at line 223 of file C4Config.h.

Referenced by CompileFunc().

◆ Button

int32_t C4ConfigGamepad::Button[C4MaxKey]

Definition at line 222 of file C4Config.h.

Referenced by CompileFunc().


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