Polyphase Game Engine
Loading...
Searching...
No Matches
InputConstants.h
Go to the documentation of this file.
1#pragma once
2
3#define INPUT_MAX_KEYS 256
4#define INPUT_MAX_TOUCHES 4
5#define INPUT_MAX_GAMEPADS 4
6
7#if PLATFORM_WINDOWS
8#define INPUT_KEYBOARD_SUPPORT 1
9#define INPUT_MOUSE_SUPPORT 1
10#define INPUT_TOUCH_SUPPORT 1
11#define INPUT_GAMEPAD_SUPPORT 1
12#elif PLATFORM_LINUX
13#define INPUT_KEYBOARD_SUPPORT 1
14#define INPUT_MOUSE_SUPPORT 1
15#define INPUT_TOUCH_SUPPORT 1
16#define INPUT_GAMEPAD_SUPPORT 1
17#elif PLATFORM_MAC
18#define INPUT_KEYBOARD_SUPPORT 1
19#define INPUT_MOUSE_SUPPORT 1
20#define INPUT_TOUCH_SUPPORT 1
21#define INPUT_GAMEPAD_SUPPORT 1
22#elif PLATFORM_GAMECUBE
23#define INPUT_KEYBOARD_SUPPORT 0
24#define INPUT_MOUSE_SUPPORT 0
25#define INPUT_TOUCH_SUPPORT 0
26#define INPUT_GAMEPAD_SUPPORT 1
27#elif PLATFORM_WII
28#define INPUT_KEYBOARD_SUPPORT 0
29#define INPUT_MOUSE_SUPPORT 1
30#define INPUT_TOUCH_SUPPORT 1 // Each wiimote IR treated as a separate pointer
31#define INPUT_GAMEPAD_SUPPORT 1
32#elif PLATFORM_3DS
33#define INPUT_KEYBOARD_SUPPORT 0
34#define INPUT_MOUSE_SUPPORT 0
35#define INPUT_TOUCH_SUPPORT 1
36#define INPUT_GAMEPAD_SUPPORT 1
37#elif PLATFORM_ANDROID
38#define INPUT_KEYBOARD_SUPPORT 1
39#define INPUT_MOUSE_SUPPORT 1
40#define INPUT_TOUCH_SUPPORT 1
41#define INPUT_GAMEPAD_SUPPORT 1
42#else
43// Fallback for console/addon platforms (e.g. POLYPHASE_PLATFORM_ADDON targets
44// like PSP) that don't have their own #elif arm. Without these, every
45// `#if INPUT_GAMEPAD_SUPPORT` in the engine silently compiles to false —
46// most notably the `memcpy(mPrevGamepads, mGamepads, ...)` in
47// InputUtils::InputAdvanceFrame, which means mPrevGamepads stays all-zeros
48// forever and IsGamepadButtonJustDown returns TRUE every frame the button
49// is held. Symptom on PSP: a single d-pad press cascades through 2-3 Button
50// widget nav steps because each held frame re-fires the JustDown edge.
51//
52// Console default: gamepad only (no keyboard / mouse / touch hardware on
53// PSP, GameCube, etc.). Touch-capable consoles (Wii IR, 3DS, Vita)
54// override to 1 in their own #elif arm above.
55//
56// #ifndef guards: an addon platform whose hardware differs from the console
57// default (e.g. the Web target, which has keyboard/mouse/touch) can pass
58// -DINPUT_*_SUPPORT=1 on its compile line and win over these fallbacks.
59#ifndef INPUT_KEYBOARD_SUPPORT
60#define INPUT_KEYBOARD_SUPPORT 0
61#endif
62#ifndef INPUT_MOUSE_SUPPORT
63#define INPUT_MOUSE_SUPPORT 0
64#endif
65#ifndef INPUT_TOUCH_SUPPORT
66#define INPUT_TOUCH_SUPPORT 0
67#endif
68#ifndef INPUT_GAMEPAD_SUPPORT
69#define INPUT_GAMEPAD_SUPPORT 1
70#endif
71#endif