author | unc0rr |
Thu, 01 Feb 2007 21:42:11 +0000 | |
changeset 377 | d9b88dbdf5a9 |
parent 358 | 236bbd12d4d9 |
child 432 | b0f693024b50 |
permissions | -rw-r--r-- |
4 | 1 |
(* |
2 |
* Hedgewars, a worms-like game |
|
316 | 3 |
* Copyright (c) 2004-2007 Andrey Korotaev <unC0Rr@gmail.com> |
4 | 4 |
* |
183 | 5 |
* This program is free software; you can redistribute it and/or modify |
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
4 | 8 |
* |
183 | 9 |
* This program is distributed in the hope that it will be useful, |
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
4 | 13 |
* |
183 | 14 |
* You should have received a copy of the GNU General Public License |
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
4 | 17 |
*) |
18 |
||
19 |
unit SDLh; |
|
20 |
interface |
|
21 |
{$IFDEF LINUX} |
|
22 |
{$DEFINE UNIX} |
|
23 |
{$ENDIF} |
|
24 |
{$IFDEF FREEBSD} |
|
25 |
{$DEFINE UNIX} |
|
26 |
{$ENDIF} |
|
27 |
||
28 |
{$IFDEF UNIX} |
|
29 |
{$linklib c} |
|
105 | 30 |
{$linklib pthread} |
4 | 31 |
{$ENDIF} |
32 |
||
33 |
{$IFDEF FPC} |
|
34 |
{$MODE Delphi} |
|
109 | 35 |
{ $PACKRECORDS 4} |
4 | 36 |
{$ENDIF} |
37 |
||
38 |
(* SDL *) |
|
39 |
const {$IFDEF WIN32} |
|
40 |
SDLLibName = 'SDL.dll'; |
|
41 |
{$ENDIF} |
|
42 |
{$IFDEF UNIX} |
|
43 |
SDLLibName = 'libSDL.so'; |
|
44 |
{$ENDIF} |
|
45 |
SDL_SWSURFACE = $00000000; |
|
46 |
SDL_HWSURFACE = $00000001; |
|
47 |
SDL_ASYNCBLIT = $00000004; |
|
48 |
SDL_ANYFORMAT = $10000000; |
|
49 |
SDL_HWPALETTE = $20000000; |
|
358 | 50 |
SDL_DOUBLEBUF = $40000000; |
4 | 51 |
SDL_FULLSCREEN = $80000000; |
52 |
SDL_NOFRAME = $00000020; |
|
53 |
SDL_HWACCEL = $00000100; |
|
54 |
SDL_SRCCOLORKEY = $00001000; |
|
55 |
SDL_RLEACCEL = $00004000; |
|
56 |
||
57 |
SDL_NOEVENT = 0; |
|
308 | 58 |
SDL_ACTIVEEVENT = 1; |
4 | 59 |
SDL_KEYDOWN = 2; |
60 |
SDL_KEYUP = 3; |
|
61 |
SDL_QUITEV = 12; |
|
62 |
||
308 | 63 |
SDL_APPINPUTFOCUS = 2; |
64 |
||
4 | 65 |
SDL_INIT_VIDEO = $00000020; |
11 | 66 |
SDL_INIT_AUDIO = $00000010; |
67 |
||
4 | 68 |
type PSDL_Rect = ^TSDL_Rect; |
69 |
TSDL_Rect = record |
|
70 |
x, y: SmallInt; |
|
71 |
w, h: Word; |
|
72 |
end; |
|
73 |
||
74 |
TPoint = record |
|
105 | 75 |
X: LongInt; |
76 |
Y: LongInt; |
|
4 | 77 |
end; |
78 |
||
79 |
PSDL_PixelFormat = ^TSDL_PixelFormat; |
|
80 |
TSDL_PixelFormat = record |
|
81 |
palette: Pointer; |
|
82 |
BitsPerPixel : Byte; |
|
83 |
BytesPerPixel: Byte; |
|
84 |
Rloss : Byte; |
|
85 |
Gloss : Byte; |
|
86 |
Bloss : Byte; |
|
87 |
Aloss : Byte; |
|
88 |
Rshift: Byte; |
|
89 |
Gshift: Byte; |
|
90 |
Bshift: Byte; |
|
91 |
Ashift: Byte; |
|
92 |
RMask : Longword; |
|
93 |
GMask : Longword; |
|
94 |
BMask : Longword; |
|
95 |
AMask : Longword; |
|
96 |
colorkey: Longword; |
|
97 |
alpha : Byte; |
|
98 |
end; |
|
99 |
||
100 |
||
101 |
PSDL_Surface = ^TSDL_Surface; |
|
102 |
TSDL_Surface = record |
|
103 |
flags : Longword; |
|
104 |
format: PSDL_PixelFormat; |
|
106 | 105 |
w, h : integer; |
4 | 106 |
pitch : Word; |
107 |
pixels: Pointer; |
|
107 | 108 |
offset: integer; |
4 | 109 |
end; |
110 |
||
111 |
PSDL_Color = ^TSDL_Color; |
|
112 |
TSDL_Color = record |
|
206
32fa6282efe2
Add workaround over freepascal bug (http://www.freepascal.org/mantis/view.php?id=7613)
unc0rr
parents:
202
diff
changeset
|
113 |
case byte of |
32fa6282efe2
Add workaround over freepascal bug (http://www.freepascal.org/mantis/view.php?id=7613)
unc0rr
parents:
202
diff
changeset
|
114 |
0: (r: Byte; |
32fa6282efe2
Add workaround over freepascal bug (http://www.freepascal.org/mantis/view.php?id=7613)
unc0rr
parents:
202
diff
changeset
|
115 |
g: Byte; |
32fa6282efe2
Add workaround over freepascal bug (http://www.freepascal.org/mantis/view.php?id=7613)
unc0rr
parents:
202
diff
changeset
|
116 |
b: Byte; |
32fa6282efe2
Add workaround over freepascal bug (http://www.freepascal.org/mantis/view.php?id=7613)
unc0rr
parents:
202
diff
changeset
|
117 |
unused: Byte; |
32fa6282efe2
Add workaround over freepascal bug (http://www.freepascal.org/mantis/view.php?id=7613)
unc0rr
parents:
202
diff
changeset
|
118 |
); |
32fa6282efe2
Add workaround over freepascal bug (http://www.freepascal.org/mantis/view.php?id=7613)
unc0rr
parents:
202
diff
changeset
|
119 |
(* workaround over freepascal bug. |
32fa6282efe2
Add workaround over freepascal bug (http://www.freepascal.org/mantis/view.php?id=7613)
unc0rr
parents:
202
diff
changeset
|
120 |
See http://www.freepascal.org/mantis/view.php?id=7613 for details *) |
32fa6282efe2
Add workaround over freepascal bug (http://www.freepascal.org/mantis/view.php?id=7613)
unc0rr
parents:
202
diff
changeset
|
121 |
1: (value: Longword); |
4 | 122 |
end; |
123 |
||
124 |
PSDL_RWops = ^TSDL_RWops; |
|
105 | 125 |
TSeek = function( context: PSDL_RWops; offset: LongInt; whence: LongInt ): LongInt; cdecl; |
126 |
TRead = function( context: PSDL_RWops; Ptr: Pointer; size: LongInt; maxnum : LongInt ): LongInt; cdecl; |
|
127 |
TWrite = function( context: PSDL_RWops; Ptr: Pointer; size: LongInt; num: LongInt ): LongInt; cdecl; |
|
128 |
TClose = function( context: PSDL_RWops ): LongInt; cdecl; |
|
4 | 129 |
|
130 |
TStdio = record |
|
105 | 131 |
autoclose: LongInt; |
4 | 132 |
fp: pointer; |
133 |
end; |
|
134 |
||
135 |
TMem = record |
|
136 |
base: PByte; |
|
137 |
here: PByte; |
|
138 |
stop: PByte; |
|
139 |
end; |
|
140 |
||
141 |
TUnknown = record |
|
142 |
data1: Pointer; |
|
143 |
end; |
|
144 |
||
145 |
TSDL_RWops = record |
|
146 |
seek: TSeek; |
|
147 |
read: TRead; |
|
148 |
write: TWrite; |
|
149 |
close: TClose; |
|
150 |
type_: Longword; |
|
151 |
case Byte of |
|
152 |
0: (stdio: TStdio); |
|
153 |
1: (mem: TMem); |
|
154 |
2: (unknown: TUnknown); |
|
155 |
end; |
|
156 |
||
157 |
TSDL_KeySym = record |
|
158 |
scancode: Byte; |
|
106 | 159 |
sym: Longword; |
4 | 160 |
modifier: Longword; |
161 |
unicode: Word; |
|
162 |
end; |
|
163 |
||
308 | 164 |
TSDL_ActiveEvent = record |
165 |
type_: byte; |
|
166 |
gain: byte; |
|
167 |
state: byte; |
|
168 |
end; |
|
169 |
||
4 | 170 |
TSDL_KeyboardEvent = record |
171 |
type_: Byte; |
|
172 |
which: Byte; |
|
173 |
state: Byte; |
|
174 |
keysym: TSDL_KeySym; |
|
175 |
end; |
|
176 |
||
177 |
TSDL_QuitEvent = record |
|
178 |
type_: Byte; |
|
179 |
end; |
|
180 |
PSDL_Event = ^TSDL_Event; |
|
181 |
TSDL_Event = record |
|
182 |
case Byte of |
|
183 |
SDL_NOEVENT: (type_: byte); |
|
308 | 184 |
SDL_ACTIVEEVENT: (active: TSDL_ActiveEvent); |
4 | 185 |
SDL_KEYDOWN, SDL_KEYUP: (key: TSDL_KeyboardEvent); |
186 |
SDL_QUITEV: (quit: TSDL_QuitEvent); |
|
187 |
end; |
|
188 |
||
189 |
PByteArray = ^TByteArray; |
|
316 | 190 |
TByteArray = array[0..65535] of Byte; |
191 |
PLongWordArray = ^TLongWordArray; |
|
192 |
TLongWordArray = array[0..16383] of LongWord; |
|
4 | 193 |
|
107 | 194 |
function SDL_Init(flags: Longword): integer; cdecl; external SDLLibName; |
4 | 195 |
procedure SDL_Quit; cdecl; external SDLLibName; |
192 | 196 |
function SDL_VideoDriverName(var namebuf; maxlen: integer): PChar; cdecl; external SDLLibName; |
377 | 197 |
procedure SDL_EnableUNICODE(enable: integer); cdecl; external SDLLibName; |
4 | 198 |
|
199 |
procedure SDL_Delay(msec: Longword); cdecl; external SDLLibName; |
|
200 |
function SDL_GetTicks: Longword; cdecl; external SDLLibName; |
|
201 |
||
202 |
function SDL_MustLock(Surface: PSDL_Surface): Boolean; |
|
107 | 203 |
function SDL_LockSurface(Surface: PSDL_Surface): integer; cdecl; external SDLLibName; |
4 | 204 |
procedure SDL_UnlockSurface(Surface: PSDL_Surface); cdecl; external SDLLibName; |
205 |
||
206 |
function SDL_GetError: PChar; cdecl; external SDLLibName; |
|
207 |
||
107 | 208 |
function SDL_SetVideoMode(width, height, bpp: integer; flags: Longword): PSDL_Surface; cdecl; external SDLLibName; |
209 |
function SDL_CreateRGBSurface(flags: Longword; Width, Height, Depth: integer; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName; |
|
210 |
function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch: integer; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName; |
|
4 | 211 |
procedure SDL_FreeSurface(Surface: PSDL_Surface); cdecl; external SDLLibName; |
105 | 212 |
function SDL_SetColorKey(surface: PSDL_Surface; flag, key: Longword): LongInt; cdecl; external SDLLibName; |
4 | 213 |
|
105 | 214 |
function SDL_UpperBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): LongInt; cdecl; external SDLLibName; |
215 |
function SDL_FillRect(dst: PSDL_Surface; dstrect: PSDL_Rect; color: Longword): LongInt; cdecl; external SDLLibName; |
|
216 |
procedure SDL_UpdateRect(Screen: PSDL_Surface; x, y: LongInt; w, h: Longword); cdecl; external SDLLibName; |
|
107 | 217 |
function SDL_Flip(Screen: PSDL_Surface): integer; cdecl; external SDLLibName; |
4 | 218 |
|
219 |
procedure SDL_GetRGB(pixel: Longword; fmt: PSDL_PixelFormat; r, g, b: PByte); cdecl; external SDLLibName; |
|
107 | 220 |
function SDL_MapRGB(format: PSDL_PixelFormat; r, g, b: Byte): Longword; cdecl; external SDLLibName; |
4 | 221 |
|
222 |
function SDL_DisplayFormat(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName; |
|
35 | 223 |
function SDL_DisplayFormatAlpha(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName; |
4 | 224 |
|
225 |
function SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName; |
|
107 | 226 |
function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: integer): integer; cdecl; external SDLLibName; |
4 | 227 |
|
105 | 228 |
function SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName; |
107 | 229 |
function SDL_GetMouseState(x, y: PInteger): Byte; cdecl; external SDLLibName; |
4 | 230 |
function SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName; |
231 |
procedure SDL_WarpMouse(x, y: Word); cdecl; external SDLLibName; |
|
232 |
||
107 | 233 |
function SDL_PollEvent(event: PSDL_Event): integer; cdecl; external SDLLibName; |
4 | 234 |
|
107 | 235 |
function SDL_ShowCursor(toggle: integer): integer; cdecl; external SDLLibName; |
4 | 236 |
|
237 |
procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName; |
|
238 |
||
239 |
(* TTF *) |
|
240 |
||
241 |
const {$IFDEF WIN32} |
|
242 |
SDL_TTFLibName = 'SDL_ttf.dll'; |
|
243 |
{$ENDIF} |
|
244 |
{$IFDEF UNIX} |
|
245 |
SDL_TTFLibName = 'libSDL_ttf.so'; |
|
246 |
{$ENDIF} |
|
202 | 247 |
TTF_STYLE_NORMAL = 0; |
248 |
TTF_STYLE_BOLD = 1; |
|
249 |
TTF_STYLE_ITALIC = 2; |
|
4 | 250 |
|
251 |
type PTTF_Font = ^TTTF_font; |
|
252 |
TTTF_Font = record |
|
253 |
end; |
|
254 |
||
200 | 255 |
function TTF_Init: integer; cdecl; external SDL_TTFLibName; |
4 | 256 |
procedure TTF_Quit; cdecl; external SDL_TTFLibName; |
257 |
||
258 |
||
200 | 259 |
function TTF_SizeUTF8(font: PTTF_Font; const text: PChar; var w, h: integer): integer; cdecl; external SDL_TTFLibName; |
206
32fa6282efe2
Add workaround over freepascal bug (http://www.freepascal.org/mantis/view.php?id=7613)
unc0rr
parents:
202
diff
changeset
|
260 |
(* TSDL_Color -> Longword conversion is workaround over freepascal bug. |
32fa6282efe2
Add workaround over freepascal bug (http://www.freepascal.org/mantis/view.php?id=7613)
unc0rr
parents:
202
diff
changeset
|
261 |
See http://www.freepascal.org/mantis/view.php?id=7613 for details *) |
32fa6282efe2
Add workaround over freepascal bug (http://www.freepascal.org/mantis/view.php?id=7613)
unc0rr
parents:
202
diff
changeset
|
262 |
function TTF_RenderUTF8_Solid(font: PTTF_Font; const text: PChar; fg: Longword): PSDL_Surface; cdecl; external SDL_TTFLibName; |
32fa6282efe2
Add workaround over freepascal bug (http://www.freepascal.org/mantis/view.php?id=7613)
unc0rr
parents:
202
diff
changeset
|
263 |
function TTF_RenderUTF8_Blended(font: PTTF_Font; const text: PChar; fg: Longword): PSDL_Surface; cdecl; external SDL_TTFLibName; |
32fa6282efe2
Add workaround over freepascal bug (http://www.freepascal.org/mantis/view.php?id=7613)
unc0rr
parents:
202
diff
changeset
|
264 |
|
200 | 265 |
function TTF_OpenFont(const filename: PChar; size: integer): PTTF_Font; cdecl; external SDL_TTFLibName; |
202 | 266 |
procedure TTF_SetFontStyle(font: PTTF_Font; style: integer); cdecl; external SDL_TTFLibName; |
4 | 267 |
|
268 |
(* SDL_mixer *) |
|
269 |
||
270 |
const {$IFDEF WIN32} |
|
271 |
SDL_MixerLibName = 'SDL_mixer.dll'; |
|
272 |
{$ENDIF} |
|
273 |
{$IFDEF UNIX} |
|
274 |
SDL_MixerLibName = 'libSDL_mixer.so'; |
|
275 |
{$ENDIF} |
|
276 |
||
174 | 277 |
const MIX_MAX_VOLUME = 128; |
278 |
||
4 | 279 |
type PMixChunk = ^TMixChunk; |
280 |
TMixChunk = record |
|
281 |
allocated: Longword; |
|
282 |
abuf : PByte; |
|
283 |
alen : Longword; |
|
284 |
volume : PByte; |
|
106 | 285 |
end; |
4 | 286 |
TMusic = (MUS_CMD, MUS_WAV, MUS_MOD, MUS_MID, MUS_OGG, MUS_MP3); |
287 |
TMix_Fading = (MIX_NO_FADING, MIX_FADING_OUT, MIX_FADING_IN); |
|
288 |
||
289 |
TMidiSong = record |
|
105 | 290 |
samples : LongInt; |
4 | 291 |
events : pointer; |
292 |
end; |
|
293 |
||
294 |
TMusicUnion = record |
|
295 |
case Byte of |
|
296 |
0: ( midi : TMidiSong ); |
|
297 |
1: ( ogg : pointer); |
|
298 |
end; |
|
299 |
||
300 |
PMixMusic = ^TMixMusic; |
|
301 |
TMixMusic = record |
|
302 |
end; |
|
303 |
||
105 | 304 |
function Mix_OpenAudio(frequency: LongInt; format: Word; channels: LongInt; chunksize: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
4 | 305 |
procedure Mix_CloseAudio; cdecl; external SDL_MixerLibName; |
306 |
||
174 | 307 |
function Mix_Volume(channel: LongInt; volume: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
308 |
function Mix_SetDistance(channel: LongInt; distance: Byte): LongInt; cdecl; external SDL_MixerLibName; |
|
105 | 309 |
function Mix_VolumeMusic(volume: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
4 | 310 |
|
174 | 311 |
function Mix_AllocateChannels(numchans: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
4 | 312 |
procedure Mix_FreeChunk(chunk: PMixChunk); cdecl; external SDL_MixerLibName; |
313 |
procedure Mix_FreeMusic(music: PMixMusic); cdecl; external SDL_MixerLibName; |
|
314 |
||
105 | 315 |
function Mix_LoadWAV_RW(src: PSDL_RWops; freesrc: LongInt): PMixChunk; cdecl; external SDL_MixerLibName; |
4 | 316 |
function Mix_LoadMUS(const filename: PChar): PMixMusic; cdecl; external SDL_MixerLibName; |
317 |
||
105 | 318 |
function Mix_Playing(channel: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
319 |
function Mix_PlayingMusic: LongInt; cdecl; external SDL_MixerLibName; |
|
4 | 320 |
|
105 | 321 |
function Mix_PlayChannelTimed(channel: LongInt; chunk: PMixChunk; loops: LongInt; ticks: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
322 |
function Mix_PlayMusic(music: PMixMusic; loops: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
|
323 |
function Mix_HaltChannel(channel: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
|
4 | 324 |
|
325 |
(* SDL_image *) |
|
326 |
||
327 |
const {$IFDEF WIN32} |
|
328 |
SDL_ImageLibName = 'SDL_image.dll'; |
|
329 |
{$ENDIF} |
|
330 |
{$IFDEF UNIX} |
|
331 |
SDL_ImageLibName = 'libSDL_image.so'; |
|
332 |
{$ENDIF} |
|
333 |
||
334 |
function IMG_Load(const _file: PChar): PSDL_Surface; cdecl; external SDL_ImageLibName; |
|
335 |
||
336 |
(* SDL_net *) |
|
337 |
||
338 |
const {$IFDEF WIN32} |
|
339 |
SDL_NetLibName = 'SDL_net.dll'; |
|
340 |
{$ENDIF} |
|
341 |
{$IFDEF UNIX} |
|
342 |
SDL_NetLibName = 'libSDL_net.so'; |
|
343 |
{$ENDIF} |
|
344 |
||
345 |
type TIPAddress = record |
|
346 |
host: Longword; |
|
347 |
port: Word; |
|
348 |
end; |
|
349 |
||
350 |
PTCPSocket = ^TTCPSocket; |
|
351 |
TTCPSocket = record |
|
106 | 352 |
ready: LongInt; |
105 | 353 |
channel: LongInt; |
106 | 354 |
remoteAddress: TIPaddress; |
4 | 355 |
localAddress: TIPaddress; |
105 | 356 |
sflag: LongInt; |
4 | 357 |
end; |
358 |
PSDLNet_SocketSet = ^TSDLNet_SocketSet; |
|
359 |
TSDLNet_SocketSet = record |
|
360 |
numsockets, |
|
105 | 361 |
maxsockets: LongInt; |
4 | 362 |
sockets: PTCPSocket; |
363 |
end; |
|
364 |
||
105 | 365 |
function SDLNet_Init: LongInt; cdecl; external SDL_NetLibName; |
4 | 366 |
procedure SDLNet_Quit; cdecl; external SDL_NetLibName; |
367 |
||
105 | 368 |
function SDLNet_AllocSocketSet(maxsockets: LongInt): PSDLNet_SocketSet; cdecl; external SDL_NetLibName; |
369 |
function SDLNet_ResolveHost(var address: TIPaddress; host: PCHar; port: Word): LongInt; cdecl; external SDL_NetLibName; |
|
4 | 370 |
function SDLNet_TCP_Accept(server: PTCPsocket): PTCPSocket; cdecl; external SDL_NetLibName; |
371 |
function SDLNet_TCP_Open(var ip: TIPaddress): PTCPSocket; cdecl; external SDL_NetLibName; |
|
105 | 372 |
function SDLNet_TCP_Send(sock: PTCPsocket; data: Pointer; len: LongInt): LongInt; cdecl; external SDL_NetLibName; |
373 |
function SDLNet_TCP_Recv(sock: PTCPsocket; data: Pointer; len: LongInt): LongInt; cdecl; external SDL_NetLibName; |
|
4 | 374 |
procedure SDLNet_TCP_Close(sock: PTCPsocket); cdecl; external SDL_NetLibName; |
375 |
procedure SDLNet_FreeSocketSet(_set: PSDLNet_SocketSet); cdecl; external SDL_NetLibName; |
|
105 | 376 |
function SDLNet_AddSocket(_set: PSDLNet_SocketSet; sock: PTCPSocket): LongInt; cdecl; external SDL_NetLibName; |
377 |
function SDLNet_CheckSockets(_set: PSDLNet_SocketSet; timeout: LongInt): LongInt; cdecl; external SDL_NetLibName; |
|
4 | 378 |
|
316 | 379 |
procedure SDLNet_Write16(value: Word; buf: pointer); cdecl; external SDL_NetLibName; |
380 |
procedure SDLNet_Write32(value: LongWord; buf: pointer); cdecl; external SDL_NetLibName; |
|
381 |
function SDLNet_Read16(buf: pointer): Word; cdecl; external SDL_NetLibName; |
|
382 |
function SDLNet_Read32(buf: pointer): LongWord; cdecl; external SDL_NetLibName; |
|
4 | 383 |
|
384 |
implementation |
|
385 |
||
386 |
function SDL_MustLock(Surface: PSDL_Surface): Boolean; |
|
387 |
begin |
|
388 |
Result:= ( surface^.offset <> 0 ) |
|
389 |
or(( surface^.flags and (SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL)) <> 0) |
|
390 |
end; |
|
391 |
||
392 |
end. |