MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / get_key_value

Method get_key_value

win32/WinController.cpp:1120–1145  ·  view source on GitHub ↗

get keyboard info

Source from the content-addressed store, hash-verified

1118
1119// get keyboard info
1120float gameWinController::get_key_value(int key, ct_format format) {
1121 float val = (float)0.0;
1122
1123 ASSERT(key < DDIO_MAX_KEYS);
1124
1125 switch (format) {
1126 // note we take care of mouse controls and external controls here
1127 case ctDigital:
1128 if (KEY_STATE(key))
1129 val = 1.0f;
1130 break;
1131
1132 case ctDownCount:
1133 val = (float)ddio_KeyDownCount(key);
1134 break;
1135
1136 case ctTime:
1137 val = (float)ddio_KeyDownTime(key);
1138 break;
1139
1140 default:
1141 mprintf(1, "gameController::key unsupported format for function\n");
1142 }
1143
1144 return val;
1145}
1146
1147int gameWinController::assign_function(ct_function *func) {
1148 // for now this is a straight forward translation (that is, no mapping of needs to controller

Callers

nothing calls this directly

Calls 2

ddio_KeyDownCountFunction · 0.85
ddio_KeyDownTimeFunction · 0.85

Tested by

no test coverage detected