src/Input.hh
author terom
Sat, 06 Dec 2008 21:35:36 +0000
changeset 230 78cf0cd69af4
parent 229 355e46effa41
child 233 ff4ecea83cf5
permissions -rw-r--r--
better input handling
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
     1
#ifndef INPUT_HH
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
     2
#define INPUT_HH
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
     3
221
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
     4
#include <stdint.h>
230
78cf0cd69af4 better input handling
terom
parents: 229
diff changeset
     5
#include <ClanLib/Display/input_device.h>
221
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
     6
#include <ClanLib/Display/keys.h>
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
     7
221
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
     8
// const uint16_t INPUT_INTERVAL_MS = 20;
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
     9
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
    10
enum _PlayerInput {
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
    11
    INPUT_AIM_UP        = 0x0001,
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
    12
    INPUT_AIM_DOWN      = 0x0002,
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    13
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    14
    INPUT_MOVE_LEFT     = 0x0004,
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    15
    INPUT_MOVE_RIGHT    = 0x0008,
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    16
221
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
    17
    INPUT_JUMP          = 0x0010,
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
    18
    INPUT_DIG           = 0x0020,
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    19
    INPUT_SHOOT         = 0x0040,
212
4389c1e6b9b8 Weapon.cc&hh
nireco
parents: 185
diff changeset
    20
    INPUT_CHANGE        = 0x0080,
229
355e46effa41 Rope works
ekku
parents: 225
diff changeset
    21
    INPUT_ROPE          = 0x0100,
230
78cf0cd69af4 better input handling
terom
parents: 229
diff changeset
    22
    INPUT_UNROPE        = 0x0200,
78cf0cd69af4 better input handling
terom
parents: 229
diff changeset
    23
    INPUT_ROPE_UP       = 0x0400,
78cf0cd69af4 better input handling
terom
parents: 229
diff changeset
    24
    INPUT_ROPE_DOWN     = 0x0800,
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    25
};
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    26
221
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
    27
typedef uint16_t PlayerInput;
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
    28
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
    29
struct InputKeymapEntry {
230
78cf0cd69af4 better input handling
terom
parents: 229
diff changeset
    30
    int keycode1, keycode2;
221
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
    31
    enum _PlayerInput input;
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
    32
};
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
    33
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
    34
/*
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
    35
 * Get the global input keymap
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
    36
 */
fbc5db6fce45 reorganize the weapons code and input handling code
terom
parents: 212
diff changeset
    37
InputKeymapEntry* getGlobalInputKeymap (void);
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    38
230
78cf0cd69af4 better input handling
terom
parents: 229
diff changeset
    39
/*
78cf0cd69af4 better input handling
terom
parents: 229
diff changeset
    40
 * Handle keycodes
78cf0cd69af4 better input handling
terom
parents: 229
diff changeset
    41
 */
78cf0cd69af4 better input handling
terom
parents: 229
diff changeset
    42
PlayerInput handleInputDevice (CL_InputDevice &keyboard);
78cf0cd69af4 better input handling
terom
parents: 229
diff changeset
    43
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff changeset
    44
#endif