56 SDLLibName = 'SDL'; |
56 SDLLibName = 'SDL'; |
57 {$ELSE} |
57 {$ELSE} |
58 SDLLibName = 'libSDL.so'; |
58 SDLLibName = 'libSDL.so'; |
59 {$ENDIF} |
59 {$ENDIF} |
60 {$ENDIF} |
60 {$ENDIF} |
61 SDL_SWSURFACE = $00000000; |
61 SDL_SWSURFACE = $00000000; |
62 SDL_HWSURFACE = $00000001; |
62 SDL_HWSURFACE = $00000001; |
63 SDL_SRCALPHA = $00010000; |
63 SDL_SRCALPHA = $00010000; |
64 SDL_INIT_VIDEO = $00000020; |
64 SDL_INIT_VIDEO = $00000020; |
65 SDL_INIT_AUDIO = $00000010; |
65 SDL_INIT_AUDIO = $00000010; |
66 SDL_INIT_JOYSTICK = $00000200; |
66 SDL_INIT_JOYSTICK = $00000200; |
67 |
67 |
68 SDL_APPINPUTFOCUS=$00000002; |
68 SDL_APPINPUTFOCUS = 2; |
69 |
69 |
70 {$IFDEF SDL13} |
70 {$IFDEF SDL13} |
71 SDL_ASYNCBLIT = $08000000; |
71 SDL_ASYNCBLIT = $08000000; |
72 SDL_ANYFORMAT = $10000000; |
72 SDL_ANYFORMAT = $10000000; |
73 SDL_HWPALETTE = $00200000; |
73 SDL_HWPALETTE = $00200000; |
109 SDL_MOUSEWHEEL = 8; //different handling, should create SDL_MouseWheelEvent type |
108 SDL_MOUSEWHEEL = 8; //different handling, should create SDL_MouseWheelEvent type |
110 SDL_JOYAXIS = 10; |
109 SDL_JOYAXIS = 10; |
111 SDL_JOYHAT = 12; |
110 SDL_JOYHAT = 12; |
112 SDL_JOYBUTTONDOWN = 13; |
111 SDL_JOYBUTTONDOWN = 13; |
113 SDL_JOYBUTTONUP = 14; |
112 SDL_JOYBUTTONUP = 14; |
114 SDL_QUITEV = 15; |
113 SDL_QUITEV = 15; |
115 {$ELSE} |
114 {$ELSE} |
116 SDL_ACTIVEEVENT = 1; |
115 SDL_ACTIVEEVENT = 1; |
117 SDL_MOUSEBUTTONDOWN = 5; |
116 SDL_MOUSEBUTTONDOWN = 5; |
118 SDL_MOUSEBUTTONUP = 6; |
117 SDL_MOUSEBUTTONUP = 6; |
119 SDL_BUTTON_WHEELDUP = 4; |
118 SDL_BUTTON_WHEELDUP = 4; |
120 SDL_BUTTON_WHEELDOWN = 5; |
119 SDL_BUTTON_WHEELDOWN = 5; |
121 SDL_JOYAXIS = 7; |
120 SDL_JOYAXIS = 7; |
122 SDL_JOYHAT = 9; |
121 SDL_JOYHAT = 9; |
123 SDL_JOYBUTTONDOWN = 10; |
122 SDL_JOYBUTTONDOWN = 10; |
124 SDL_JOYBUTTONUP = 11; |
123 SDL_JOYBUTTONUP = 11; |
125 SDL_QUITEV = 12; |
124 SDL_QUITEV = 12; |
126 {$ENDIF} |
125 {$ENDIF} |
127 {*end sdl_event binding*} |
126 {*end sdl_event binding*} |
128 |
127 |
129 {$IFDEF SDL13} |
128 |
130 {*#define SDL_BUTTON(X) (1 << ((X)-1)) |
129 //if little endian |
131 #define SDL_BUTTON_LEFT 1 |
|
132 #define SDL_BUTTON_MIDDLE 2 |
|
133 #define SDL_BUTTON_RIGHT 3 |
|
134 #define SDL_BUTTON_X1 4 |
|
135 #define SDL_BUTTON_X2 5 |
|
136 #define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT) |
|
137 #define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE) |
|
138 #define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) |
|
139 #define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1) |
|
140 #define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)*} |
|
141 {$ENDIF} |
|
142 |
|
143 RMask = $000000FF; |
130 RMask = $000000FF; |
144 GMask = $0000FF00; |
131 GMask = $0000FF00; |
145 BMask = $00FF0000; |
132 BMask = $00FF0000; |
146 AMask = $FF000000; |
133 AMask = $FF000000; |
|
134 //else |
|
135 // RMask = $FF000000; |
|
136 // GMask = $00FF0000; |
|
137 // BMask = $0000FF00; |
|
138 // AMask = $000000FF; |
|
139 //endif |
|
140 |
147 |
141 |
148 type PSDL_Rect = ^TSDL_Rect; |
142 type PSDL_Rect = ^TSDL_Rect; |
149 TSDL_Rect = record |
143 TSDL_Rect = record |
150 {$IFDEF SDL13} |
144 {$IFDEF SDL13} |
151 x, y, w, h: LongInt; |
145 x, y, w, h: LongInt; |
331 |
325 |
332 PSDL_Event = ^TSDL_Event; |
326 PSDL_Event = ^TSDL_Event; |
333 TSDL_Event = record |
327 TSDL_Event = record |
334 case Byte of |
328 case Byte of |
335 {$IFDEF SDL13} |
329 {$IFDEF SDL13} |
336 //doublecheck the type of WINDOWEVENT TEXTINPUT |
330 //doublecheck the type of WINDOWEVENT TEXTINPUT |
337 SDL_NOEVENT: (type_: byte); |
331 SDL_NOEVENT: (type_: byte); |
338 SDL_WINDOWEVENT: (active: TSDL_ActiveEvent); |
332 SDL_WINDOWEVENT: (active: TSDL_ActiveEvent); |
339 SDL_KEYDOWN, |
333 SDL_KEYDOWN, |
340 SDL_KEYUP: (key: TSDL_KeyboardEvent); |
334 SDL_KEYUP: (key: TSDL_KeyboardEvent); |
341 SDL_TEXTINPUT: (txtin: byte); |
335 SDL_TEXTINPUT: (txtin: byte); |
342 SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); |
336 SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); |
343 SDL_MOUSEBUTTONDOWN, |
337 SDL_MOUSEBUTTONDOWN, |
344 SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent); |
338 SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent); |
345 {$ELSE} |
339 {$ELSE} |
346 SDL_NOEVENT: (type_: byte); |
340 SDL_NOEVENT: (type_: byte); |
347 SDL_ACTIVEEVENT: (active: TSDL_ActiveEvent); |
341 SDL_ACTIVEEVENT: (active: TSDL_ActiveEvent); |
348 SDL_KEYDOWN, |
342 SDL_KEYDOWN, |
349 SDL_KEYUP: (key: TSDL_KeyboardEvent); |
343 SDL_KEYUP: (key: TSDL_KeyboardEvent); |
350 SDL_QUITEV: (quit: TSDL_QuitEvent); |
344 SDL_QUITEV: (quit: TSDL_QuitEvent); |
351 SDL_VIDEORESIZE: (resize: TSDL_ResizeEvent); |
345 SDL_VIDEORESIZE: (resize: TSDL_ResizeEvent); |
352 SDL_MOUSEBUTTONDOWN, |
346 SDL_MOUSEBUTTONDOWN, |
353 SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent); |
347 SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent); |
354 {$ENDIF} |
348 {$ENDIF} |
355 SDL_JOYAXIS: (jaxis: TSDL_JoyAxisEvent); |
349 SDL_JOYAXIS: (jaxis: TSDL_JoyAxisEvent); |
356 SDL_JOYHAT: (jhat: TSDL_JoyHatEvent); |
350 SDL_JOYHAT: (jhat: TSDL_JoyHatEvent); |
357 SDL_JOYBUTTONDOWN, |
351 SDL_JOYBUTTONDOWN, |
358 SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent); |
352 SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent); |
359 end; |
353 end; |
360 |
354 |
361 PByteArray = ^TByteArray; |
355 PByteArray = ^TByteArray; |
362 TByteArray = array[0..65535] of Byte; |
356 TByteArray = array[0..65535] of Byte; |
363 PLongWordArray = ^TLongWordArray; |
357 PLongWordArray = ^TLongWordArray; |
364 TLongWordArray = array[0..16383] of LongWord; |
358 TLongWordArray = array[0..16383] of LongWord; |
393 procedure SDL_UpdateRect(Screen: PSDL_Surface; x, y: LongInt; w, h: Longword); cdecl; external SDLLibName; |
387 procedure SDL_UpdateRect(Screen: PSDL_Surface; x, y: LongInt; w, h: Longword); cdecl; external SDLLibName; |
394 function SDL_Flip(Screen: PSDL_Surface): LongInt; cdecl; external SDLLibName; |
388 function SDL_Flip(Screen: PSDL_Surface): LongInt; cdecl; external SDLLibName; |
395 |
389 |
396 procedure SDL_GetRGB(pixel: Longword; fmt: PSDL_PixelFormat; r, g, b: PByte); cdecl; external SDLLibName; |
390 procedure SDL_GetRGB(pixel: Longword; fmt: PSDL_PixelFormat; r, g, b: PByte); cdecl; external SDLLibName; |
397 function SDL_MapRGB(format: PSDL_PixelFormat; r, g, b: Byte): Longword; cdecl; external SDLLibName; |
391 function SDL_MapRGB(format: PSDL_PixelFormat; r, g, b: Byte): Longword; cdecl; external SDLLibName; |
|
392 function SDL_MapRGBA(format: PSDL_PixelFormat; r, g, b, a: Byte): Longword; cdecl; external SDLLibName; |
398 |
393 |
399 function SDL_DisplayFormat(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName; |
394 function SDL_DisplayFormat(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName; |
400 function SDL_DisplayFormatAlpha(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName; |
395 function SDL_DisplayFormatAlpha(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName; |
401 |
396 |
402 function SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName; |
397 function SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName; |