1 /*
2  * PROPRIETARY INFORMATION.  This software is proprietary to POWDER
3  * Development, and is not to be reproduced, transmitted, or disclosed
4  * in any way without written permission.
5  *
6  * Produced by:	Jeff Lait
7  *
8  *      	POWDER Development
9  *
10  * NAME:        control.h ( POWDER Library, C++ )
11  *
12  * COMMENTS:
13  *	Platform independent control interface
14  */
15 
16 #ifndef __control__
17 #define __control__
18 
19 // This allows the standard Game Boy Advance controls or their equivalents,
20 // namely:
21 // Direction, any or all of up/down/left/right
22 // Buttons A & B
23 // Buttons R & L
24 // Buttons Start & Select.
25 // Gameboy DS: X & Y, TOUCH and LID.
26 
27 // Button definitions
28 enum BUTTONS
29 {
30     BUTTON_UP,
31     BUTTON_DOWN,
32     BUTTON_LEFT,
33     BUTTON_RIGHT,
34     BUTTON_A,
35     BUTTON_B,
36     BUTTON_START,
37     BUTTON_SELECT,
38     BUTTON_R,
39     BUTTON_L,
40     BUTTON_X,
41     BUTTON_Y,
42     BUTTON_TOUCH,
43     BUTTON_LID,
44     NUM_BUTTONS
45 };
46 
47 // Initialize the control library.
48 void ctrl_init();
49 
50 // Set the repeat rate for keypresses.
51 void ctrl_setrepeat(int timedelay);
52 
53 // Determine if any button is pressed.
54 int ctrl_anyrawpressed();
55 
56 // Check to see if a button is currently pressed.
57 int ctrl_rawpressed(int button);
58 
59 // Check to see if a button has been pressed.  This triggers on button
60 // down. It will not retrigger until the button is released, or a timer
61 // is exceeded.  Each call will reset this status, so a second call will
62 // always report unpressed.
63 bool ctrl_hit(int button);
64 
65 // This convience function will build your dx/dy.  Raw determines if
66 // it uses ctrl_hit or rawpressed.
67 void ctrl_getdir(int &dx, int &dy, int raw = 0, bool allowdiag=false);
68 
69 // This convience function will build your dx/dy from a keypress.
70 // Handles those nifty hjkl crap.
71 void ctrl_getdirfromkey(int keypress, int &dx, int &dy, bool allowdiag=false);
72 
73 #endif
74