-
Notifications
You must be signed in to change notification settings - Fork 10
/
defines.lua
58 lines (42 loc) · 1.25 KB
/
defines.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
-- Function definitions which were not output by
-- the C preprocessor
local sdl
local function registerdefines(sdl)
-- audio
function sdl.AUDIO_BITSIZE(x)
return bit.band(x, sdl.AUDIO_MASK_BITSIZE)
end
function sdl.AUDIO_ISFLOAT(x)
return bit.band(x, sdl.AUDIO_MASK_DATATYPE) ~= 0
end
function sdl.AUDIO_ISBIGENDIAN(x)
return bit.band(x, sdl.AUDIO_MASK_ENDIAN) ~= 0
end
function sdl.AUDIO_ISSIGNED(x)
return bit.band(x, sdl.AUDIO_MASK_SIGNED) ~= 0
end
function sdl.AUDIO_ISINT(x)
return not sdl.AUDIO_ISFLOAT(x)
end
function sdl.AUDIO_ISLITTLEENDIAN(x)
return not sdl.AUDIO_ISBIGENDIAN(x)
end
function sdl.AUDIO_ISUNSIGNED(x)
return not sdl.AUDIO_ISSIGNED(x)
end
function sdl.loadWAV(file, spec, audio_buf, audio_len)
return sdl.loadWAV_RW(sdl.RWFromFile(file, "rb"), 1, spec, audio_buf, audio_len)
end
-- surface
sdl.blitSurface = sdl.upperBlit
function sdl.MUSTLOCK(S)
return bit.band(S.flags, sdl.RLEACCEL)
end
function sdl.loadBMP(file)
return sdl.loadBMP_RW(sdl.RWFromFile(file, 'rb'), 1)
end
function sdl.saveBMP(surface, file)
return sdl.saveBMP_RW(surface, sdl.RWFromFile(file, 'wb'), 1)
end
end
return registerdefines