summaryrefslogtreecommitdiffstats
path: root/matchblox/common/message_input.h
blob: fef13f78781a18847c55c807c9fbafc62c712770 (plain)
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
63
64
65
66
67
68
69
70
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
#ifndef _CMESSAGE_INPUT_H
#define _CMESSAGE_INPUT_H


#define MESSAGE_INPUT_KEYBOARD  0x00001100
#define MESSAGE_INPUT_MOUSE     0x00001200
#define MESSAGE_INPUT_WIIMOTE   0x00001400

#ifdef __cplusplus
extern "C" {
#endif

struct input_payload_keyboard
{
  int specialkey;
  int key;
  int modifier;
  int x;
  int y;
};

struct input_payload_mouse
{
  int passive;
  int button;
  int state;
  int x;
  int y;
};


enum wiimote_btns
{
  WIIMOTE_BUTTON_TWO	 = 0x0001,
  WIIMOTE_BUTTON_ONE   = 0x0002,
  WIIMOTE_BUTTON_B		 = 0x0004,
  WIIMOTE_BUTTON_A		 = 0x0008,
  WIIMOTE_BUTTON_MINUS = 0x0010,
  WIIMOTE_BUTTON_HOME  = 0x0080,
  WIIMOTE_BUTTON_LEFT  = 0x0100,
  WIIMOTE_BUTTON_RIGHT = 0x0200,
  WIIMOTE_BUTTON_DOWN	 = 0x0400,
  WIIMOTE_BUTTON_UP		 = 0x0800,
  WIIMOTE_BUTTON_PLUS	 = 0x1000,
  WIIMOTE_BUTTON_ALL	 = 0x1F9F
};

struct rawdot { int rx, ry; };
struct smoothsbdot { double sx, sy; }; //raw smoothed dots

struct input_payload_wiimote
{
  int    btns,          //current button state
         btnsDown,      //buttons that that were pressed
         btnsUp,        //buttons that were released
         nrdots;
  double relX,  //relative x coordinate of mouse cursor [0,1]
         relY,  //relative y coordinate of mouse cursor [0,1]
         Zdist; //distance from sensorbar in mm
  struct rawdot irdot[4];
  struct smoothsbdot SensorBarDot[2]; //grouped averaged and smoothed ir sensorbar dots
  char   posDataValid; //is true when the position data is valid (nrdots > 1)
};

#ifdef __cplusplus
}
#endif

#endif