comparison include/SDL_events.h @ 1294:1760ceb23bc6

Date: Fri, 18 Feb 2005 20:49:35 +0200 (EET) From: ville Subject: [SDL] Changing, at least some, anonymous enums to named enums. Howdy, Could, some if not all, enums be named rather than being anonymous enums? I ran into troubles with the enum describing event types in SDL_events.h. The problem is that an anonymous enum cannot be used in C++ templates like so: enum { C }; template< typename T > void f( T ) { } f( C );
author Sam Lantinga <slouken@libsdl.org>
date Sun, 29 Jan 2006 23:14:04 +0000
parents b2283b0ded26
children 7b32c7a586c9
comparison
equal deleted inserted replaced
1293:23b1ef7d003b 1294:1760ceb23bc6
42 #ifdef __cplusplus 42 #ifdef __cplusplus
43 extern "C" { 43 extern "C" {
44 #endif 44 #endif
45 45
46 /* Event enumerations */ 46 /* Event enumerations */
47 enum { SDL_NOEVENT = 0, /* Unused (do not remove) */ 47 typedef enum {
48 SDL_NOEVENT = 0, /* Unused (do not remove) */
48 SDL_ACTIVEEVENT, /* Application loses/gains visibility */ 49 SDL_ACTIVEEVENT, /* Application loses/gains visibility */
49 SDL_KEYDOWN, /* Keys pressed */ 50 SDL_KEYDOWN, /* Keys pressed */
50 SDL_KEYUP, /* Keys released */ 51 SDL_KEYUP, /* Keys released */
51 SDL_MOUSEMOTION, /* Mouse moved */ 52 SDL_MOUSEMOTION, /* Mouse moved */
52 SDL_MOUSEBUTTONDOWN, /* Mouse button pressed */ 53 SDL_MOUSEBUTTONDOWN, /* Mouse button pressed */
72 SDL_USEREVENT = 24, 73 SDL_USEREVENT = 24,
73 /* This last event is only for bounding internal arrays 74 /* This last event is only for bounding internal arrays
74 It is the number of bits in the event mask datatype -- Uint32 75 It is the number of bits in the event mask datatype -- Uint32
75 */ 76 */
76 SDL_NUMEVENTS = 32 77 SDL_NUMEVENTS = 32
77 }; 78 } SDL_EventType;
78 79
79 /* Predefined event masks */ 80 /* Predefined event masks */
80 #define SDL_EVENTMASK(X) (1<<(X)) 81 #define SDL_EVENTMASK(X) (1<<(X))
81 enum { 82 typedef enum {
82 SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT), 83 SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT),
83 SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN), 84 SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN),
84 SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP), 85 SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP),
85 SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION), 86 SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION),
86 SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN), 87 SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
100 SDL_EVENTMASK(SDL_JOYBUTTONUP), 101 SDL_EVENTMASK(SDL_JOYBUTTONUP),
101 SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE), 102 SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE),
102 SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE), 103 SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE),
103 SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT), 104 SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
104 SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT) 105 SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT)
105 }; 106 } SDL_EventMask ;
106 #define SDL_ALLEVENTS 0xFFFFFFFF 107 #define SDL_ALLEVENTS 0xFFFFFFFF
107 108
108 /* Application visibility event structure */ 109 /* Application visibility event structure */
109 typedef struct SDL_ActiveEvent { 110 typedef struct SDL_ActiveEvent {
110 Uint8 type; /* SDL_ACTIVEEVENT */ 111 Uint8 type; /* SDL_ACTIVEEVENT */