author | unc0rr |
Fri, 27 Oct 2006 22:07:38 +0000 | |
changeset 208 | a049157d673a |
parent 206 | 32fa6282efe2 |
child 308 | 806c3b55500d |
permissions | -rw-r--r-- |
4 | 1 |
(* |
2 |
* Hedgewars, a worms-like game |
|
105 | 3 |
* Copyright (c) 2004, 2005, 2006 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; |
|
58 |
SDL_KEYDOWN = 2; |
|
59 |
SDL_KEYUP = 3; |
|
60 |
SDL_QUITEV = 12; |
|
61 |
||
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; |
|
106 | 102 |
w, h : integer; |
4 | 103 |
pitch : Word; |
104 |
pixels: Pointer; |
|
107 | 105 |
offset: integer; |
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 |
||
161 |
TSDL_KeyboardEvent = record |
|
162 |
type_: Byte; |
|
163 |
which: Byte; |
|
164 |
state: Byte; |
|
165 |
keysym: TSDL_KeySym; |
|
166 |
end; |
|
167 |
||
168 |
TSDL_QuitEvent = record |
|
169 |
type_: Byte; |
|
170 |
end; |
|
171 |
PSDL_Event = ^TSDL_Event; |
|
172 |
TSDL_Event = record |
|
173 |
case Byte of |
|
174 |
SDL_NOEVENT: (type_: byte); |
|
175 |
SDL_KEYDOWN, SDL_KEYUP: (key: TSDL_KeyboardEvent); |
|
176 |
SDL_QUITEV: (quit: TSDL_QuitEvent); |
|
177 |
end; |
|
178 |
||
179 |
PByteArray = ^TByteArray; |
|
180 |
TByteArray = array[0..32767] of Byte; |
|
181 |
||
107 | 182 |
function SDL_Init(flags: Longword): integer; cdecl; external SDLLibName; |
4 | 183 |
procedure SDL_Quit; cdecl; external SDLLibName; |
192 | 184 |
function SDL_VideoDriverName(var namebuf; maxlen: integer): PChar; cdecl; external SDLLibName; |
4 | 185 |
|
186 |
procedure SDL_Delay(msec: Longword); cdecl; external SDLLibName; |
|
187 |
function SDL_GetTicks: Longword; cdecl; external SDLLibName; |
|
188 |
||
189 |
function SDL_MustLock(Surface: PSDL_Surface): Boolean; |
|
107 | 190 |
function SDL_LockSurface(Surface: PSDL_Surface): integer; cdecl; external SDLLibName; |
4 | 191 |
procedure SDL_UnlockSurface(Surface: PSDL_Surface); cdecl; external SDLLibName; |
192 |
||
193 |
function SDL_GetError: PChar; cdecl; external SDLLibName; |
|
194 |
||
107 | 195 |
function SDL_SetVideoMode(width, height, bpp: integer; flags: Longword): PSDL_Surface; cdecl; external SDLLibName; |
196 |
function SDL_CreateRGBSurface(flags: Longword; Width, Height, Depth: integer; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName; |
|
197 |
function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch: integer; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName; |
|
4 | 198 |
procedure SDL_FreeSurface(Surface: PSDL_Surface); cdecl; external SDLLibName; |
105 | 199 |
function SDL_SetColorKey(surface: PSDL_Surface; flag, key: Longword): LongInt; cdecl; external SDLLibName; |
4 | 200 |
|
105 | 201 |
function SDL_UpperBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): LongInt; cdecl; external SDLLibName; |
202 |
function SDL_FillRect(dst: PSDL_Surface; dstrect: PSDL_Rect; color: Longword): LongInt; cdecl; external SDLLibName; |
|
203 |
procedure SDL_UpdateRect(Screen: PSDL_Surface; x, y: LongInt; w, h: Longword); cdecl; external SDLLibName; |
|
107 | 204 |
function SDL_Flip(Screen: PSDL_Surface): integer; cdecl; external SDLLibName; |
4 | 205 |
|
206 |
procedure SDL_GetRGB(pixel: Longword; fmt: PSDL_PixelFormat; r, g, b: PByte); cdecl; external SDLLibName; |
|
107 | 207 |
function SDL_MapRGB(format: PSDL_PixelFormat; r, g, b: Byte): Longword; cdecl; external SDLLibName; |
4 | 208 |
|
209 |
function SDL_DisplayFormat(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName; |
|
35 | 210 |
function SDL_DisplayFormatAlpha(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName; |
4 | 211 |
|
212 |
function SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName; |
|
107 | 213 |
function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: integer): integer; cdecl; external SDLLibName; |
4 | 214 |
|
105 | 215 |
function SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName; |
107 | 216 |
function SDL_GetMouseState(x, y: PInteger): Byte; cdecl; external SDLLibName; |
4 | 217 |
function SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName; |
218 |
procedure SDL_WarpMouse(x, y: Word); cdecl; external SDLLibName; |
|
219 |
||
107 | 220 |
function SDL_PollEvent(event: PSDL_Event): integer; cdecl; external SDLLibName; |
4 | 221 |
|
107 | 222 |
function SDL_ShowCursor(toggle: integer): integer; cdecl; external SDLLibName; |
4 | 223 |
|
224 |
procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName; |
|
225 |
||
226 |
(* TTF *) |
|
227 |
||
228 |
const {$IFDEF WIN32} |
|
229 |
SDL_TTFLibName = 'SDL_ttf.dll'; |
|
230 |
{$ENDIF} |
|
231 |
{$IFDEF UNIX} |
|
232 |
SDL_TTFLibName = 'libSDL_ttf.so'; |
|
233 |
{$ENDIF} |
|
202 | 234 |
TTF_STYLE_NORMAL = 0; |
235 |
TTF_STYLE_BOLD = 1; |
|
236 |
TTF_STYLE_ITALIC = 2; |
|
4 | 237 |
|
238 |
type PTTF_Font = ^TTTF_font; |
|
239 |
TTTF_Font = record |
|
240 |
end; |
|
241 |
||
200 | 242 |
function TTF_Init: integer; cdecl; external SDL_TTFLibName; |
4 | 243 |
procedure TTF_Quit; cdecl; external SDL_TTFLibName; |
244 |
||
245 |
||
200 | 246 |
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
|
247 |
(* 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
|
248 |
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
|
249 |
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
|
250 |
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
|
251 |
|
200 | 252 |
function TTF_OpenFont(const filename: PChar; size: integer): PTTF_Font; cdecl; external SDL_TTFLibName; |
202 | 253 |
procedure TTF_SetFontStyle(font: PTTF_Font; style: integer); cdecl; external SDL_TTFLibName; |
4 | 254 |
|
255 |
(* SDL_mixer *) |
|
256 |
||
257 |
const {$IFDEF WIN32} |
|
258 |
SDL_MixerLibName = 'SDL_mixer.dll'; |
|
259 |
{$ENDIF} |
|
260 |
{$IFDEF UNIX} |
|
261 |
SDL_MixerLibName = 'libSDL_mixer.so'; |
|
262 |
{$ENDIF} |
|
263 |
||
174 | 264 |
const MIX_MAX_VOLUME = 128; |
265 |
||
4 | 266 |
type PMixChunk = ^TMixChunk; |
267 |
TMixChunk = record |
|
268 |
allocated: Longword; |
|
269 |
abuf : PByte; |
|
270 |
alen : Longword; |
|
271 |
volume : PByte; |
|
106 | 272 |
end; |
4 | 273 |
TMusic = (MUS_CMD, MUS_WAV, MUS_MOD, MUS_MID, MUS_OGG, MUS_MP3); |
274 |
TMix_Fading = (MIX_NO_FADING, MIX_FADING_OUT, MIX_FADING_IN); |
|
275 |
||
276 |
TMidiSong = record |
|
105 | 277 |
samples : LongInt; |
4 | 278 |
events : pointer; |
279 |
end; |
|
280 |
||
281 |
TMusicUnion = record |
|
282 |
case Byte of |
|
283 |
0: ( midi : TMidiSong ); |
|
284 |
1: ( ogg : pointer); |
|
285 |
end; |
|
286 |
||
287 |
PMixMusic = ^TMixMusic; |
|
288 |
TMixMusic = record |
|
289 |
end; |
|
290 |
||
105 | 291 |
function Mix_OpenAudio(frequency: LongInt; format: Word; channels: LongInt; chunksize: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
4 | 292 |
procedure Mix_CloseAudio; cdecl; external SDL_MixerLibName; |
293 |
||
174 | 294 |
function Mix_Volume(channel: LongInt; volume: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
295 |
function Mix_SetDistance(channel: LongInt; distance: Byte): LongInt; cdecl; external SDL_MixerLibName; |
|
105 | 296 |
function Mix_VolumeMusic(volume: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
4 | 297 |
|
174 | 298 |
function Mix_AllocateChannels(numchans: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
4 | 299 |
procedure Mix_FreeChunk(chunk: PMixChunk); cdecl; external SDL_MixerLibName; |
300 |
procedure Mix_FreeMusic(music: PMixMusic); cdecl; external SDL_MixerLibName; |
|
301 |
||
105 | 302 |
function Mix_LoadWAV_RW(src: PSDL_RWops; freesrc: LongInt): PMixChunk; cdecl; external SDL_MixerLibName; |
4 | 303 |
function Mix_LoadMUS(const filename: PChar): PMixMusic; cdecl; external SDL_MixerLibName; |
304 |
||
105 | 305 |
function Mix_Playing(channel: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
306 |
function Mix_PlayingMusic: LongInt; cdecl; external SDL_MixerLibName; |
|
4 | 307 |
|
105 | 308 |
function Mix_PlayChannelTimed(channel: LongInt; chunk: PMixChunk; loops: LongInt; ticks: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
309 |
function Mix_PlayMusic(music: PMixMusic; loops: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
|
310 |
function Mix_HaltChannel(channel: LongInt): LongInt; cdecl; external SDL_MixerLibName; |
|
4 | 311 |
|
312 |
(* SDL_image *) |
|
313 |
||
314 |
const {$IFDEF WIN32} |
|
315 |
SDL_ImageLibName = 'SDL_image.dll'; |
|
316 |
{$ENDIF} |
|
317 |
{$IFDEF UNIX} |
|
318 |
SDL_ImageLibName = 'libSDL_image.so'; |
|
319 |
{$ENDIF} |
|
320 |
||
321 |
function IMG_Load(const _file: PChar): PSDL_Surface; cdecl; external SDL_ImageLibName; |
|
322 |
||
323 |
(* SDL_net *) |
|
324 |
||
325 |
const {$IFDEF WIN32} |
|
326 |
SDL_NetLibName = 'SDL_net.dll'; |
|
327 |
{$ENDIF} |
|
328 |
{$IFDEF UNIX} |
|
329 |
SDL_NetLibName = 'libSDL_net.so'; |
|
330 |
{$ENDIF} |
|
331 |
||
332 |
type TIPAddress = record |
|
333 |
host: Longword; |
|
334 |
port: Word; |
|
335 |
end; |
|
336 |
||
337 |
PTCPSocket = ^TTCPSocket; |
|
338 |
TTCPSocket = record |
|
106 | 339 |
ready: LongInt; |
105 | 340 |
channel: LongInt; |
106 | 341 |
remoteAddress: TIPaddress; |
4 | 342 |
localAddress: TIPaddress; |
105 | 343 |
sflag: LongInt; |
4 | 344 |
end; |
345 |
PSDLNet_SocketSet = ^TSDLNet_SocketSet; |
|
346 |
TSDLNet_SocketSet = record |
|
347 |
numsockets, |
|
105 | 348 |
maxsockets: LongInt; |
4 | 349 |
sockets: PTCPSocket; |
350 |
end; |
|
351 |
||
105 | 352 |
function SDLNet_Init: LongInt; cdecl; external SDL_NetLibName; |
4 | 353 |
procedure SDLNet_Quit; cdecl; external SDL_NetLibName; |
354 |
||
105 | 355 |
function SDLNet_AllocSocketSet(maxsockets: LongInt): PSDLNet_SocketSet; cdecl; external SDL_NetLibName; |
356 |
function SDLNet_ResolveHost(var address: TIPaddress; host: PCHar; port: Word): LongInt; cdecl; external SDL_NetLibName; |
|
4 | 357 |
function SDLNet_TCP_Accept(server: PTCPsocket): PTCPSocket; cdecl; external SDL_NetLibName; |
358 |
function SDLNet_TCP_Open(var ip: TIPaddress): PTCPSocket; cdecl; external SDL_NetLibName; |
|
105 | 359 |
function SDLNet_TCP_Send(sock: PTCPsocket; data: Pointer; len: LongInt): LongInt; cdecl; external SDL_NetLibName; |
360 |
function SDLNet_TCP_Recv(sock: PTCPsocket; data: Pointer; len: LongInt): LongInt; cdecl; external SDL_NetLibName; |
|
4 | 361 |
procedure SDLNet_TCP_Close(sock: PTCPsocket); cdecl; external SDL_NetLibName; |
362 |
procedure SDLNet_FreeSocketSet(_set: PSDLNet_SocketSet); cdecl; external SDL_NetLibName; |
|
105 | 363 |
function SDLNet_AddSocket(_set: PSDLNet_SocketSet; sock: PTCPSocket): LongInt; cdecl; external SDL_NetLibName; |
364 |
function SDLNet_CheckSockets(_set: PSDLNet_SocketSet; timeout: LongInt): LongInt; cdecl; external SDL_NetLibName; |
|
4 | 365 |
|
154
5667e6f38704
Network protocol uses integers in network byte order
unc0rr
parents:
109
diff
changeset
|
366 |
procedure SDLNet_Write16(value: SmallInt; buf: pointer); cdecl; external SDL_NetLibName; |
5667e6f38704
Network protocol uses integers in network byte order
unc0rr
parents:
109
diff
changeset
|
367 |
procedure SDLNet_Write32(value: LongInt; buf: pointer); cdecl; external SDL_NetLibName; |
5667e6f38704
Network protocol uses integers in network byte order
unc0rr
parents:
109
diff
changeset
|
368 |
function SDLNet_Read16(buf: pointer): SmallInt; cdecl; external SDL_NetLibName; |
5667e6f38704
Network protocol uses integers in network byte order
unc0rr
parents:
109
diff
changeset
|
369 |
function SDLNet_Read32(buf: pointer): LongInt; cdecl; external SDL_NetLibName; |
4 | 370 |
|
371 |
implementation |
|
372 |
||
373 |
function SDL_MustLock(Surface: PSDL_Surface): Boolean; |
|
374 |
begin |
|
375 |
Result:= ( surface^.offset <> 0 ) |
|
376 |
or(( surface^.flags and (SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL)) <> 0) |
|
377 |
end; |
|
378 |
||
379 |
end. |