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