Debian Codegraph @

ddio/lnxkey_null.cpp

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/Main/ddio_lnx/lnxkey_null.cpp $
21 * $Revision: 1.2 $
22 * $Date: 2004/02/25 00:04:06 $
23 * $Author: ryan $
24 *
25 * Linux NULL keyboard routines
26 *
27 * $Log: lnxkey_null.cpp,v $
28 * Revision 1.2 2004/02/25 00:04:06 ryan
29 * Removed loki_utils dependency and ported to MacOS X (runs, but incomplete).
30 *
31 * Revision 1.1.1.1 2000/04/18 00:00:33 icculus
32 * initial checkin
33 *
34 *
35 * 2 7/14/99 9:06p Jeff
36 * added comment header
37 *
38 * $NoKeywords: $
39 */
40
41 #include "ddio.h"
42
43 extern volatile struct tLnxKeys {
44 union {
45 int up_ticks;
46 float up_time;
47 };
48 union {
49 int down_ticks;
50 float down_time;
51 };
52 bool status;
53 } LKeys[DDIO_MAX_KEYS];
54
55 bool ddio_null_InternalKeyInit(ddio_init_info *init_info) {
56 // reset key list
57 for (int i = 0; i < DDIO_MAX_KEYS; i++) {
58 LKeys[i].down_ticks = 0;
59 LKeys[i].up_ticks = 0;
60 LKeys[i].status = false;
61 }
62
63 return true;
64 }
65
66 void ddio_null_InternalKeyClose() {}
67
68 bool ddio_null_InternalKeyState(uint8_t key) { return LKeys[key].status; }
69
70 void ddio_null_InternalKeySuspend() {}
71
72 void ddio_null_InternalKeyResume() {}
73
74 float ddio_null_InternalKeyDownTime(uint8_t key) {
75 float down_time = 0.0f;
76 if (LKeys[key].status) {
77 float timer = timer_GetTime();
78 down_time = timer - LKeys[key].down_time;
79 LKeys[key].down_time = timer;
80 } else {
81 down_time = LKeys[key].up_time - LKeys[key].down_time;
82 LKeys[key].down_time = LKeys[key].up_time = 0.0f;
83 }
84
85 return down_time;
86 }
87
88 void ddio_null_InternalResetKey(uint8_t key) {
89 LKeys[key].down_time = 0.0f;
90 LKeys[key].up_time = 0.0f;
91 LKeys[key].status = false;
92 }
93
94 bool ddio_null_KeyFrame() { return true; }
95
96 void ddio_null_InternalKeyFrame(void) {}