358
|
1 /**
|
|
2 * $Id: sdltoprojectM.h,v 1.1.1.1 2005/12/23 18:42:00 psperl Exp $
|
|
3 *
|
|
4 * Translates SDL -> projectM variables
|
|
5 *
|
|
6 * $Log: sdltoprojectM.h,v $
|
|
7 * Revision 1.1.1.1 2005/12/23 18:42:00 psperl
|
|
8 * Initial Import
|
|
9 *
|
|
10 * Revision 1.1 2004/10/08 00:35:28 cvs
|
|
11 * Moved and imported
|
|
12 *
|
|
13 * Revision 1.1.1.1 2004/10/04 12:56:00 cvs
|
|
14 * Imported
|
|
15 *
|
|
16 */
|
|
17
|
|
18 #ifndef _SDLTOPROJECTM_H
|
|
19 #define _SDLTOPROJECTM_H
|
|
20
|
|
21 #include "projectM/event.h"
|
|
22 #ifdef WIN32
|
|
23 #include <SDL.h>
|
|
24 #else
|
|
25 #include <SDL/SDL.h>
|
|
26 #endif
|
|
27
|
|
28 projectMEvent sdl2pmEvent( SDL_Event event ) { \
|
|
29
|
|
30 switch ( event.type ) { \
|
|
31 case SDL_VIDEORESIZE:
|
|
32 return PROJECTM_VIDEORESIZE; \
|
|
33 case SDL_KEYUP: \
|
|
34 return PROJECTM_KEYUP; \
|
|
35 case SDL_KEYDOWN: \
|
|
36 return PROJECTM_KEYDOWN; \
|
|
37 case SDL_QUIT: \
|
|
38 return PROJECTM_VIDEOQUIT; \
|
|
39 default:
|
|
40 return PROJECTM_KEYUP; \
|
|
41 } \
|
|
42 } \
|
|
43
|
|
44 projectMKeycode sdl2pmKeycode( SDLKey keysym ) { \
|
|
45 switch ( keysym ) { \
|
|
46 case SDLK_F1: \
|
|
47 return PROJECTM_K_F1; \
|
|
48 case SDLK_F2: \
|
|
49 return PROJECTM_K_F2; \
|
|
50 case SDLK_F3: \
|
|
51 return PROJECTM_K_F3; \
|
|
52 case SDLK_F4: \
|
|
53 return PROJECTM_K_F4; \
|
|
54 case SDLK_F5: \
|
|
55 return PROJECTM_K_F5; \
|
|
56 case SDLK_F6: \
|
|
57 return PROJECTM_K_F6; \
|
|
58 case SDLK_F7: \
|
|
59 return PROJECTM_K_F7; \
|
|
60 case SDLK_F8: \
|
|
61 return PROJECTM_K_F8; \
|
|
62 case SDLK_F9: \
|
|
63 return PROJECTM_K_F9; \
|
|
64 case SDLK_F10: \
|
|
65 return PROJECTM_K_F10; \
|
|
66 case SDLK_F11: \
|
|
67 return PROJECTM_K_F11; \
|
|
68 case SDLK_F12: \
|
|
69 return PROJECTM_K_F12; \
|
|
70 case SDLK_ESCAPE: \
|
|
71 return PROJECTM_K_ESCAPE;
|
|
72 case SDLK_a:
|
|
73 return PROJECTM_K_a;
|
|
74 case SDLK_b:
|
|
75 return PROJECTM_K_b;
|
|
76 case SDLK_c:
|
|
77 return PROJECTM_K_c;
|
|
78 case SDLK_d:
|
|
79 return PROJECTM_K_d;
|
|
80 case SDLK_e:
|
|
81 return PROJECTM_K_e;
|
|
82 case SDLK_f:
|
|
83 return PROJECTM_K_f;
|
|
84 case SDLK_g:
|
|
85 return PROJECTM_K_g;
|
|
86 case SDLK_h:
|
|
87 return PROJECTM_K_h;
|
|
88 case SDLK_i:
|
|
89 return PROJECTM_K_i;
|
|
90 case SDLK_j:
|
|
91 return PROJECTM_K_j;
|
|
92 case SDLK_k:
|
|
93 return PROJECTM_K_k;
|
|
94 case SDLK_l:
|
|
95 return PROJECTM_K_l;
|
|
96 case SDLK_m:
|
|
97 return PROJECTM_K_m;
|
|
98 case SDLK_n:
|
|
99 return PROJECTM_K_n;
|
|
100 case SDLK_o:
|
|
101 return PROJECTM_K_o;
|
|
102 case SDLK_p:
|
|
103 return PROJECTM_K_p;
|
|
104 case SDLK_q:
|
|
105 return PROJECTM_K_q;
|
|
106 case SDLK_r:
|
|
107 return PROJECTM_K_r;
|
|
108 case SDLK_s:
|
|
109 return PROJECTM_K_s;
|
|
110 case SDLK_t:
|
|
111 return PROJECTM_K_t;
|
|
112 case SDLK_u:
|
|
113 return PROJECTM_K_u;
|
|
114 case SDLK_v:
|
|
115 return PROJECTM_K_v;
|
|
116 case SDLK_w:
|
|
117 return PROJECTM_K_w;
|
|
118 case SDLK_x:
|
|
119 return PROJECTM_K_x;
|
|
120 case SDLK_y:
|
|
121 return PROJECTM_K_y;
|
|
122 case SDLK_z:
|
|
123 return PROJECTM_K_z;
|
|
124 case SDLK_UP:
|
|
125 return PROJECTM_K_UP;
|
|
126 case SDLK_RETURN:
|
|
127 return PROJECTM_K_RETURN;
|
|
128 case SDLK_RIGHT:
|
|
129 return PROJECTM_K_RIGHT;
|
|
130 case SDLK_LEFT:
|
|
131 return PROJECTM_K_LEFT;
|
|
132 case SDLK_DOWN:
|
|
133 return PROJECTM_K_DOWN;
|
|
134 case SDLK_PAGEUP:
|
|
135 return PROJECTM_K_PAGEUP;
|
|
136 case SDLK_PAGEDOWN:
|
|
137 return PROJECTM_K_PAGEDOWN;
|
|
138
|
|
139 default: \
|
|
140 return PROJECTM_K_NONE; \
|
|
141 } \
|
|
142 } \
|
|
143
|
|
144 projectMModifier sdl2pmModifier( SDLMod mod ) { \
|
|
145 return PROJECTM_KMOD_LSHIFT; \
|
|
146 } \
|
|
147
|
|
148 #endif /** _SDLTOPROJECTM_H */
|