Mercurial > projects > ldc
annotate demos/sdl.d @ 1291:875afb7a93b6
Factor out some constants into the header so producers and consumers of
metadata stay in sync (and are more readable).
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Sat, 02 May 2009 20:42:58 +0200 |
parents | 0b9b286b67b6 |
children |
rev | line source |
---|---|
38
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
1 module sdl; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
2 |
42 | 3 version(build) pragma(link,"SDL"); |
38
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
4 |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
5 extern(C): |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
6 struct SDL_Rect { |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
7 short x, y; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
8 ushort w, h; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
9 } |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
10 struct SDL_PixelFormat { |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
11 //SDL_Palette *palette; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
12 void *palette; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
13 ubyte BitsPerPixel, BytesPerPixel, Rloss, Gloss, Bloss, Aloss, Rshift, Gshift, Bshift, Ashift; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
14 uint Rmask, Gmask, Bmask, Amask, colorkey; ubyte alpha; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
15 } |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
16 struct SDL_Surface { |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
17 uint flags; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
18 SDL_PixelFormat *format; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
19 int w, h; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
20 ushort pitch; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
21 void *pixels; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
22 int offset; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
23 void *hwdata; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
24 SDL_Rect clip_rect; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
25 uint unused; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
26 uint locked; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
27 void *map; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
28 uint format_version; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
29 int refcount; |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
30 } |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
31 uint SDL_MapRGBA(SDL_PixelFormat *format, ubyte r, ubyte g, ubyte b, ubyte a); |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
32 void SDL_GetRGBA(uint pixel, SDL_PixelFormat *fmt, ubyte *r, ubyte *g, ubyte *b, ubyte *a); |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
33 int SDL_LockSurface(SDL_Surface *); |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
34 void SDL_UnlockSurface(SDL_Surface *); |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
35 SDL_Surface * SDL_SetVideoMode(int width, int height, int bpp, uint flags); |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
36 int SDL_Flip(SDL_Surface *); |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
37 void SDL_Delay(uint); |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
38 int SDL_FillRect(SDL_Surface*,SDL_Rect*,uint); |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
39 enum : uint { |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
40 SDL_SWSURFACE=0, |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
41 SDL_HWSURFACE=1, |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
42 SDL_DOUBLEBUF=0x40000000, |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
43 SDL_FULLSCREEN=0x80000000 |
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
44 } |
42 | 45 enum { |
46 SDL_GL_RED_SIZE, | |
47 SDL_GL_GREEN_SIZE, | |
48 SDL_GL_BLUE_SIZE, | |
49 SDL_GL_ALPHA_SIZE, | |
50 SDL_GL_BUFFER_SIZE, | |
51 SDL_GL_DOUBLEBUFFER, | |
52 SDL_GL_DEPTH_SIZE, | |
53 SDL_GL_STENCIL_SIZE, | |
54 SDL_GL_ACCUM_RED_SIZE, | |
55 SDL_GL_ACCUM_GREEN_SIZE, | |
56 SDL_GL_ACCUM_BLUE_SIZE, | |
57 SDL_GL_ACCUM_ALPHA_SIZE, | |
58 SDL_GL_STEREO, | |
59 SDL_GL_MULTISAMPLEBUFFERS, | |
60 SDL_GL_MULTISAMPLESAMPLES, | |
61 SDL_GL_ACCELERATED_VISUAL, | |
62 SDL_GL_SWAP_CONTROL | |
63 } | |
64 int SDL_GL_LoadLibrary(char*); | |
65 void* SDL_GL_GetProcAddress(char*); | |
66 int SDL_GL_SetAttribute(int,int); | |
67 int SDL_GL_GetAttribute(int,int*); | |
68 void SDL_GL_SwapBuffers(); | |
69 void SDL_GL_UpdateRects(int,SDL_Rect*); | |
70 void SDL_GL_Lock(); | |
71 void SDL_GL_Unlock(); | |
72 enum : uint { | |
73 SDL_INIT_TIMER=0x00000001, | |
74 SDL_INIT_AUDIO=0x00000010, | |
75 SDL_INIT_VIDEO=0x00000020, | |
76 SDL_INIT_CDROM=0x00000100, | |
77 SDL_INIT_JOYSTICK=0x00000200, | |
78 SDL_INIT_NOPARACHUTE=0x00100000, | |
79 SDL_INIT_EVENTTHREAD=0x00200000, | |
80 SDL_INIT_EVERYTHING=0x0000FFFF | |
81 } | |
38
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
diff
changeset
|
82 |
42 | 83 int SDL_Init(uint); |
84 int SDL_InitSubSystem(uint); | |
85 int SDL_QuitSubSystem(uint); | |
86 int SDL_WasInit(uint); | |
87 void SDL_Quit(); |