1 | /*--------------------------------------------------------------------------------- |
---|
2 | $Id$ |
---|
3 | |
---|
4 | key input code -- provides slightly higher level input forming |
---|
5 | |
---|
6 | Copyright (C) 2005 |
---|
7 | Michael Noland (joat) |
---|
8 | Jason Rogers (dovoto) |
---|
9 | Christian Auby (DesktopMan) |
---|
10 | Dave Murphy (WinterMute) |
---|
11 | |
---|
12 | This software is provided 'as-is', without any express or implied |
---|
13 | warranty. In no event will the authors be held liable for any |
---|
14 | damages arising from the use of this software. |
---|
15 | |
---|
16 | Permission is granted to anyone to use this software for any |
---|
17 | purpose, including commercial applications, and to alter it and |
---|
18 | redistribute it freely, subject to the following restrictions: |
---|
19 | |
---|
20 | 1. The origin of this software must not be misrepresented; you |
---|
21 | must not claim that you wrote the original software. If you use |
---|
22 | this software in a product, an acknowledgment in the product |
---|
23 | documentation would be appreciated but is not required. |
---|
24 | 2. Altered source versions must be plainly marked as such, and |
---|
25 | must not be misrepresented as being the original software. |
---|
26 | 3. This notice may not be removed or altered from any source |
---|
27 | distribution. |
---|
28 | |
---|
29 | ---------------------------------------------------------------------------------*/ |
---|
30 | //! NDS input support. |
---|
31 | /*! \file input.h |
---|
32 | */ |
---|
33 | |
---|
34 | //--------------------------------------------------------------------------------- |
---|
35 | #ifndef INPUT_HEADER_INCLUDE |
---|
36 | #define INPUT_HEADER_INCLUDE |
---|
37 | //--------------------------------------------------------------------------------- |
---|
38 | |
---|
39 | #include <nds/jtypes.h> |
---|
40 | |
---|
41 | // Keyboard |
---|
42 | |
---|
43 | //! Bit values for the keypad buttons. |
---|
44 | typedef enum KEYPAD_BITS { |
---|
45 | KEY_A = BIT(0), //!< Keypad A button. |
---|
46 | KEY_B = BIT(1), //!< Keypad B button. |
---|
47 | KEY_SELECT = BIT(2), //!< Keypad SELECT button. |
---|
48 | KEY_START = BIT(3), //!< Keypad START button. |
---|
49 | KEY_RIGHT = BIT(4), //!< Keypad RIGHT button. |
---|
50 | KEY_LEFT = BIT(5), //!< Keypad LEFT button. |
---|
51 | KEY_UP = BIT(6), //!< Keypad UP button. |
---|
52 | KEY_DOWN = BIT(7), //!< Keypad DOWN button. |
---|
53 | KEY_R = BIT(8), //!< Right shoulder button. |
---|
54 | KEY_L = BIT(9), //!< Left shoulder button. |
---|
55 | KEY_X = BIT(10), //!< Keypad X button. |
---|
56 | KEY_Y = BIT(11), //!< Keypad Y button. |
---|
57 | KEY_TOUCH = BIT(12), //!< Touchscreen pendown. |
---|
58 | KEY_LID = BIT(13) //!< Lid state. |
---|
59 | } KEYPAD_BITS; |
---|
60 | |
---|
61 | #ifdef __cplusplus |
---|
62 | extern "C" { |
---|
63 | #endif |
---|
64 | |
---|
65 | //! Obtains the current keypad state. |
---|
66 | /*! Call this function once per main loop in order to use the keypad functions. |
---|
67 | */ |
---|
68 | void scanKeys(void); |
---|
69 | |
---|
70 | //! Obtains the current keypad held state. |
---|
71 | uint32 keysHeld(void); |
---|
72 | |
---|
73 | //! Obtains the current keypad pressed state. |
---|
74 | uint32 keysDown(void); |
---|
75 | |
---|
76 | //! Obtains the current keypad pressed or repeating state. |
---|
77 | uint32 keysDownRepeat(void); |
---|
78 | |
---|
79 | //! Sets the key repeat parameters. |
---|
80 | /*! \param setDelay Number of %scanKeys calls before keys start to repeat. |
---|
81 | \param setRepeat Number of %scanKeys calls before keys repeat. |
---|
82 | */ |
---|
83 | void keysSetRepeat( u8 setDelay, u8 setRepeat ); |
---|
84 | |
---|
85 | //! Obtains the current keypad released state. |
---|
86 | uint32 keysUp(void); |
---|
87 | |
---|
88 | //! Obtains the current touchscreen co-ordinates. |
---|
89 | touchPosition touchReadXY(void); |
---|
90 | |
---|
91 | #ifdef __cplusplus |
---|
92 | } |
---|
93 | #endif |
---|
94 | |
---|
95 | //--------------------------------------------------------------------------------- |
---|
96 | #endif // INPUT_HEADER_INCLUDE |
---|
97 | //--------------------------------------------------------------------------------- |
---|