VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/include/crut_api.h@ 36843

Last change on this file since 36843 was 15532, checked in by vboxsync, 16 years ago

crOpenGL: export to OSE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.4 KB
Line 
1#ifndef CRUTAPI_H
2#define CRUTAPI_H
3
4#ifdef WINDOWS
5#define CRUT_APIENTRY __stdcall
6#else
7#define CRUT_APIENTRY
8#endif
9
10#include "cr_net.h"
11#include "cr_protocol.h"
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17/* Compile-time version tests */
18#define CRUT_MAJOR_VERSION 1
19#define CRUT_MINOR_VERSION 9
20#define CRUT_PATCH_VERSION 0
21
22/* Display mode bit masks. */
23#define CRUT_RGB 0
24#define CRUT_RGBA GLUT_RGB
25#define CRUT_INDEX 1
26#define CRUT_SINGLE 0
27#define CRUT_DOUBLE 2
28#define CRUT_ACCUM 4
29#define CRUT_ALPHA 8
30#define CRUT_DEPTH 16
31#define CRUT_STENCIL 32
32
33/* Mouse buttons. */
34/* CRUT_NO_BUTTON provided for menu definition. Not every menu will
35 have a button associated with it. */
36#define CRUT_NO_BUTTON -1
37#define CRUT_LEFT_BUTTON 0
38#define CRUT_MIDDLE_BUTTON 1
39#define CRUT_RIGHT_BUTTON 2
40
41/* Mouse button state. */
42#define CRUT_DOWN 0
43#define CRUT_UP 1
44
45/* Visibility state. */
46#define CRUT_NOT_VISIBLE 0
47#define CRUT_VISIBLE 1
48
49/* function keys */
50#define CRUT_KEY_F1 1
51#define CRUT_KEY_F2 2
52#define CRUT_KEY_F3 3
53#define CRUT_KEY_F4 4
54#define CRUT_KEY_F5 5
55#define CRUT_KEY_F6 6
56#define CRUT_KEY_F7 7
57#define CRUT_KEY_F8 8
58#define CRUT_KEY_F9 9
59#define CRUT_KEY_F10 10
60#define CRUT_KEY_F11 11
61#define CRUT_KEY_F12 12
62/* directional keys */
63#define CRUT_KEY_LEFT 100
64#define CRUT_KEY_UP 101
65#define CRUT_KEY_RIGHT 102
66#define CRUT_KEY_DOWN 103
67#define CRUT_KEY_PAGE_UP 104
68#define CRUT_KEY_PAGE_DOWN 105
69#define CRUT_KEY_HOME 106
70#define CRUT_KEY_END 107
71#define CRUT_KEY_INSERT 108
72
73/* event types */
74#define CRUT_NO_EVENT 0
75#define CRUT_MOUSE_EVENT 1
76#define CRUT_RESHAPE_EVENT 2
77#define CRUT_KEYBOARD_EVENT 3
78#define CRUT_MOTION_EVENT 4
79#define CRUT_PASSIVE_MOTION_EVENT 5
80#define CRUT_MENU_EVENT 6
81#define CRUT_VISIBILITY_EVENT 7
82
83#define DEFAULT_CRUT_PORT 9000
84
85#define MENU_MAX_SIZE 1024
86#define MENU_ITEM_REGULAR 0
87#define MENU_ITEM_SUBMENU 1
88
89/* CRUTMessage is just a placeholder to find the msg_type */
90typedef struct
91{
92 CRMessageHeader header;
93 int msg_type;
94
95} CRUTMessage;
96
97typedef struct
98{
99 CRMessageHeader header;
100 int msg_type;
101 int button;
102 int state;
103 int x;
104 int y;
105
106} CRUTMouseMsg;
107
108typedef struct
109{
110 CRMessageHeader header;
111 int msg_type;
112 int width;
113 int height;
114
115} CRUTReshapeMsg;
116
117typedef struct
118{
119 CRMessageHeader header;
120 int msg_type;
121 int state;
122
123} CRUTVisibilityMsg;
124
125typedef struct
126{
127 CRMessageHeader header;
128 int msg_type;
129 unsigned char key;
130 int x;
131 int y;
132
133} CRUTKeyboardMsg;
134
135typedef struct
136{
137 CRMessageHeader header;
138 int msg_type;
139 int x;
140 int y;
141
142} CRUTMotionMsg;
143
144typedef struct
145{
146 CRMessageHeader header;
147 int msg_type;
148 int x;
149 int y;
150
151} CRUTPassiveMotionMsg;
152
153typedef struct
154{
155 CRMessageHeader header;
156 int msg_type;
157 int menuID;
158 int value;
159
160} CRUTMenuMsg;
161
162typedef struct
163{
164 unsigned short tcpip_port;
165 int mtu;
166 char protocol[1024];
167 CRConnection *send_conn;
168
169} CRUTClientPointer;
170
171typedef struct
172{
173 CRUTClientPointer *crutclients;
174 CRConnection *mothershipConn;
175 int numclients;
176 int winX;
177 int winY;
178 int winWidth;
179 int winHeight;
180
181 int compositeAlpha;
182 int compositeDepth;
183
184 char menuBuffer[MENU_MAX_SIZE];
185
186} CRUTAPI;
187
188#define MAX_MSG_SIZE sizeof(CRUTMouseMsg)
189
190
191/* extern CRUTAPI crut_api;*/
192
193void CRUT_APIENTRY crutInitAPI( CRUTAPI *crut_api, const char *mothership );
194void CRUT_APIENTRY crutGetWindowParams( CRUTAPI *crut_api );
195void CRUT_APIENTRY crutGetMenuXML( CRUTAPI *crut_api );
196void CRUT_APIENTRY crutSetWindowID( CRUTAPI *crut_api, int windowID );
197void CRUT_APIENTRY crutConnectToClients( CRUTAPI *crut_api );
198void crutSendEvent( CRUTAPI *crut_api, void *msg, int size );
199void CRUT_APIENTRY crutSendMouseEvent( CRUTAPI *crut_api, int button, int state, int x, int y );
200void CRUT_APIENTRY crutSendKeyboardEvent( CRUTAPI *crut_api, int key, int x, int y );
201void CRUT_APIENTRY crutSendReshapeEvent( CRUTAPI *crut_api, int width, int height );
202void CRUT_APIENTRY crutSendVisibilityEvent( CRUTAPI *crut_api, int state );
203void CRUT_APIENTRY crutSendMotionEvent( CRUTAPI *crut_api, int x, int y );
204void CRUT_APIENTRY crutSendPassiveMotionEvent( CRUTAPI *crut_api, int x, int y );
205void CRUT_APIENTRY crutSendMenuEvent( CRUTAPI *crut_api, int menuID, int value );
206
207#ifdef __cplusplus
208}
209#endif
210
211#endif /* CRUTAPI_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette