author | unc0rr |
Mon, 15 Jan 2007 23:25:44 +0000 | |
changeset 344 | a98ade8c99b6 |
parent 316 | 57d50189ad86 |
child 351 | 29bc9c36ad5f |
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; |
|
50 |
SDL_DOUBLEBUF = $40000000; |
|
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; |
4 | 197 |
|
198 |
procedure SDL_Delay(msec: Longword); cdecl; external SDLLibName; |
|
199 |
function SDL_GetTicks: Longword; cdecl; external SDLLibName; |
|
200 |
||
201 |
function SDL_MustLock(Surface: PSDL_Surface): Boolean; |
|
107 | 202 |
function SDL_LockSurface(Surface: PSDL_Surface): integer; cdecl; external SDLLibName; |
4 | 203 |
procedure SDL_UnlockSurface(Surface: PSDL_Surface); cdecl; external SDLLibName; |
204 |
||
205 |
function SDL_GetError: PChar; cdecl; external SDLLibName; |
|
206 |
||
107 | 207 |
function SDL_SetVideoMode(width, height, bpp: integer; flags: Longword): PSDL_Surface; cdecl; external SDLLibName; |
208 |
function SDL_CreateRGBSurface(flags: Longword; Width, Height, Depth: integer; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName; |
|
209 |
function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch: integer; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName; |
|
4 | 210 |
procedure SDL_FreeSurface(Surface: PSDL_Surface); cdecl; external SDLLibName; |
105 | 211 |
function SDL_SetColorKey(surface: PSDL_Surface; flag, key: Longword): LongInt; cdecl; external SDLLibName; |
4 | 212 |
|
105 | 213 |
function SDL_UpperBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): LongInt; cdecl; external SDLLibName; |
214 |
function SDL_FillRect(dst: PSDL_Surface; dstrect: PSDL_Rect; color: Longword): LongInt; cdecl; external SDLLibName; |
|
215 |
procedure SDL_UpdateRect(Screen: PSDL_Surface; x, y: LongInt; w, h: Longword); cdecl; external SDLLibName; |
|
107 | 216 |
function SDL_Flip(Screen: PSDL_Surface): integer; cdecl; external SDLLibName; |
4 | 217 |
|
218 |
procedure SDL_GetRGB(pixel: Longword; fmt: PSDL_PixelFormat; r, g, b: PByte); cdecl; external SDLLibName; |
|
107 | 219 |
function SDL_MapRGB(format: PSDL_PixelFormat; r, g, b: Byte): Longword; cdecl; external SDLLibName; |
4 | 220 |
|
221 |
function SDL_DisplayFormat(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName; |
|
35 | 222 |
function SDL_DisplayFormatAlpha(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName; |
4 | 223 |
|
224 |
function SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName; |
|
107 | 225 |
function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: integer): integer; cdecl; external SDLLibName; |
4 | 226 |
|
105 | 227 |
function SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName; |
107 | 228 |
function SDL_GetMouseState(x, y: PInteger): Byte; cdecl; external SDLLibName; |
4 | 229 |
function SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName; |
230 |
procedure SDL_WarpMouse(x, y: Word); cdecl; external SDLLibName; |
|
231 |
||
107 | 232 |
function SDL_PollEvent(event: PSDL_Event): integer; cdecl; external SDLLibName; |
4 | 233 |
|
107 | 234 |
function SDL_ShowCursor(toggle: integer): integer; cdecl; external SDLLibName; |
4 | 235 |
|
236 |
procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName; |
|
237 |
||
238 |
(* TTF *) |
|
239 |
||
240 |
const {$IFDEF WIN32} |
|
241 |
SDL_TTFLibName = 'SDL_ttf.dll'; |
|
242 |
{$ENDIF} |
|
243 |
{$IFDEF UNIX} |
|
244 |
SDL_TTFLibName = 'libSDL_ttf.so'; |
|
245 |
{$ENDIF} |
|
202 | 246 |
TTF_STYLE_NORMAL = 0; |
247 |
TTF_STYLE_BOLD = 1; |
|
248 |
TTF_STYLE_ITALIC = 2; |
|
4 | 249 |
|
250 |
type PTTF_Font = ^TTTF_font; |
|
251 |
TTTF_Font = record |
|
252 |
end; |
|
253 |
||
200 | 254 |
function TTF_Init: integer; cdecl; external SDL_TTFLibName; |
4 | 255 |
procedure TTF_Quit; cdecl; external SDL_TTFLibName; |
256 |
||
257 |
||
200 | 258 |
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
|
259 |
(* 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
|
260 |
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
|
261 |
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
|
262 |
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
|
263 |
|
200 | 264 |
function TTF_OpenFont(const filename: PChar; size: integer): PTTF_Font; cdecl; external SDL_TTFLibName; |
202 | 265 |
procedure TTF_SetFontStyle(font: PTTF_Font; style: integer); cdecl; external SDL_TTFLibName; |
4 | 266 |
|
267 |
(* SDL_mixer *) |
|
268 |
||
269 |
const {$IFDEF WIN32} |
|
270 |
SDL_MixerLibName = 'SDL_mixer.dll'; |
|
271 |
{$ENDIF} |
|
272 |
{$IFDEF UNIX} |
|
273 |
SDL_MixerLibName = 'libSDL_mixer.so'; |
|
274 |
{$ENDIF} |
|
275 |
||
174 | 276 |
const MIX_MAX_VOLUME = 128; |
277 |
||
4 | 278 |
type PMixChunk = ^TMixChunk; |
279 |
TMixChunk = record |
|
280 |
allocated: Longword; |
|
281 |
abuf : PByte; |
|
282 |
alen : Longword; |
|
283 |
volume : PByte; |
|
106 | 284 |
end; |
4 | 285 |
TMusic = (MUS_CMD, MUS_WAV, MUS_MOD, MUS_MID, MUS_OGG, MUS_MP3); |
286 |
TMix_Fading = (MIX_NO_FADING, MIX_FADING_OUT, MIX_FADING_IN); |
|
287 |
||
288 |
TMidiSong = record |
|
105 | 289 |
samples : LongInt; |
4 | 290 |
events : pointer; |
291 |
end; |
|
292 |
||
293 |
TMusicUnion = record |
|
294 |
case Byte of |
|
295 |
0: ( midi : TMidiSong ); |
|
296 |
1: ( ogg : pointer); |
|
297 |
end; |
|
298 |
||
299 |
PMixMusic = ^TMixMusic; |
|
300 |
TMixMusic = record |
|
301 |
end; |
|
302 |
||
105 | 303 |
function Mix_OpenAudio(frequency: LongInt; format: Word; channels: LongInt; chunksize: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
4 | 304 |
procedure Mix_CloseAudio; cdecl; external SDL_MixerLibName; |
305 |
||
174 | 306 |
function Mix_Volume(channel: LongInt; volume: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
307 |
function Mix_SetDistance(channel: LongInt; distance: Byte): LongInt; cdecl; external SDL_MixerLibName; |
|
105 | 308 |
function Mix_VolumeMusic(volume: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
4 | 309 |
|
174 | 310 |
function Mix_AllocateChannels(numchans: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
4 | 311 |
procedure Mix_FreeChunk(chunk: PMixChunk); cdecl; external SDL_MixerLibName; |
312 |
procedure Mix_FreeMusic(music: PMixMusic); cdecl; external SDL_MixerLibName; |
|
313 |
||
105 | 314 |
function Mix_LoadWAV_RW(src: PSDL_RWops; freesrc: LongInt): PMixChunk; cdecl; external SDL_MixerLibName; |
4 | 315 |
function Mix_LoadMUS(const filename: PChar): PMixMusic; cdecl; external SDL_MixerLibName; |
316 |
||
105 | 317 |
function Mix_Playing(channel: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
318 |
function Mix_PlayingMusic: LongInt; cdecl; external SDL_MixerLibName; |
|
4 | 319 |
|
105 | 320 |
function Mix_PlayChannelTimed(channel: LongInt; chunk: PMixChunk; loops: LongInt; ticks: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
321 |
function Mix_PlayMusic(music: PMixMusic; loops: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
|
322 |
function Mix_HaltChannel(channel: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
|
4 | 323 |
|
324 |
(* SDL_image *) |
|
325 |
||
326 |
const {$IFDEF WIN32} |
|
327 |
SDL_ImageLibName = 'SDL_image.dll'; |
|
328 |
{$ENDIF} |
|
329 |
{$IFDEF UNIX} |
|
330 |
SDL_ImageLibName = 'libSDL_image.so'; |
|
331 |
{$ENDIF} |
|
332 |
||
333 |
function IMG_Load(const _file: PChar): PSDL_Surface; cdecl; external SDL_ImageLibName; |
|
334 |
||
335 |
(* SDL_net *) |
|
336 |
||
337 |
const {$IFDEF WIN32} |
|
338 |
SDL_NetLibName = 'SDL_net.dll'; |
|
339 |
{$ENDIF} |
|
340 |
{$IFDEF UNIX} |
|
341 |
SDL_NetLibName = 'libSDL_net.so'; |
|
342 |
{$ENDIF} |
|
343 |
||
344 |
type TIPAddress = record |
|
345 |
host: Longword; |
|
346 |
port: Word; |
|
347 |
end; |
|
348 |
||
349 |
PTCPSocket = ^TTCPSocket; |
|
350 |
TTCPSocket = record |
|
106 | 351 |
ready: LongInt; |
105 | 352 |
channel: LongInt; |
106 | 353 |
remoteAddress: TIPaddress; |
4 | 354 |
localAddress: TIPaddress; |
105 | 355 |
sflag: LongInt; |
4 | 356 |
end; |
357 |
PSDLNet_SocketSet = ^TSDLNet_SocketSet; |
|
358 |
TSDLNet_SocketSet = record |
|
359 |
numsockets, |
|
105 | 360 |
maxsockets: LongInt; |
4 | 361 |
sockets: PTCPSocket; |
362 |
end; |
|
363 |
||
105 | 364 |
function SDLNet_Init: LongInt; cdecl; external SDL_NetLibName; |
4 | 365 |
procedure SDLNet_Quit; cdecl; external SDL_NetLibName; |
366 |
||
105 | 367 |
function SDLNet_AllocSocketSet(maxsockets: LongInt): PSDLNet_SocketSet; cdecl; external SDL_NetLibName; |
368 |
function SDLNet_ResolveHost(var address: TIPaddress; host: PCHar; port: Word): LongInt; cdecl; external SDL_NetLibName; |
|
4 | 369 |
function SDLNet_TCP_Accept(server: PTCPsocket): PTCPSocket; cdecl; external SDL_NetLibName; |
370 |
function SDLNet_TCP_Open(var ip: TIPaddress): PTCPSocket; cdecl; external SDL_NetLibName; |
|
105 | 371 |
function SDLNet_TCP_Send(sock: PTCPsocket; data: Pointer; len: LongInt): LongInt; cdecl; external SDL_NetLibName; |
372 |
function SDLNet_TCP_Recv(sock: PTCPsocket; data: Pointer; len: LongInt): LongInt; cdecl; external SDL_NetLibName; |
|
4 | 373 |
procedure SDLNet_TCP_Close(sock: PTCPsocket); cdecl; external SDL_NetLibName; |
374 |
procedure SDLNet_FreeSocketSet(_set: PSDLNet_SocketSet); cdecl; external SDL_NetLibName; |
|
105 | 375 |
function SDLNet_AddSocket(_set: PSDLNet_SocketSet; sock: PTCPSocket): LongInt; cdecl; external SDL_NetLibName; |
376 |
function SDLNet_CheckSockets(_set: PSDLNet_SocketSet; timeout: LongInt): LongInt; cdecl; external SDL_NetLibName; |
|
4 | 377 |
|
316 | 378 |
procedure SDLNet_Write16(value: Word; buf: pointer); cdecl; external SDL_NetLibName; |
379 |
procedure SDLNet_Write32(value: LongWord; buf: pointer); cdecl; external SDL_NetLibName; |
|
380 |
function SDLNet_Read16(buf: pointer): Word; cdecl; external SDL_NetLibName; |
|
381 |
function SDLNet_Read32(buf: pointer): LongWord; cdecl; external SDL_NetLibName; |
|
4 | 382 |
|
383 |
implementation |
|
384 |
||
385 |
function SDL_MustLock(Surface: PSDL_Surface): Boolean; |
|
386 |
begin |
|
387 |
Result:= ( surface^.offset <> 0 ) |
|
388 |
or(( surface^.flags and (SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL)) <> 0) |
|
389 |
end; |
|
390 |
||
391 |
end. |