File: GameControls.h

package info (click to toggle)
flobopuyo 0.20-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,052 kB
  • sloc: cpp: 6,209; ansic: 3,743; yacc: 179; makefile: 176; lex: 42
file content (62 lines) | stat: -rw-r--r-- 1,347 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef _GAME_CONT_H
#define _GAME_CONT_H

#include "glSDL.h"
#include "InputManager.h"

typedef struct GameControlEvent {
    enum {
        kGameNone,
        kPauseGame,
        kPlayer1Left,
        kPlayer1Right,
        kPlayer1TurnLeft,
        kPlayer1TurnRight,
        kPlayer1Down,
        kPlayer2Left,
        kPlayer2Right,
        kPlayer2TurnLeft,
        kPlayer2TurnRight,
        kPlayer2Down,
        kGameLastKey
    } gameEvent;
    enum {
        kCursorNone,
        kUp,
        kDown,
        kLeft,
        kRight,
        kStart,
        kBack,
        kQuit,
        kCursorLastKey
    } cursorEvent;
    bool isUp;
} GameControlEvent;


enum {
    kPlayer1LeftControl             = 0,
    kPlayer1RightControl            = 1,
    kPlayer1DownControl             = 2,
    kPlayer1ClockwiseControl        = 3,
    kPlayer1CounterclockwiseControl = 4,
    kPlayer2LeftControl             = 5,
    kPlayer2RightControl            = 6,
    kPlayer2DownControl             = 7,
    kPlayer2ClockwiseControl        = 8,
    kPlayer2CounterclockwiseControl = 9
};


void initGameControls();
void getControlEvent(SDL_Event e, GameControlEvent *result);

void getKeyName(int control, char *keyName);
bool tryChangeControl(int control, SDL_Event e, GameControlEvent *result);

void saveControls();
void loadControls();

#endif