diff options
| author | Drew DeVault <sir@cmpwn.com> | 2021-12-09 14:36:32 +0100 |
|---|---|---|
| committer | Drew DeVault <sir@cmpwn.com> | 2021-12-09 14:36:32 +0100 |
| commit | 07046a3b2c2d0b6a5dfaaab70e5ea71e8334df1b (patch) | |
| tree | e134285c86f6052b9c19ae7755acafa0137e215b /sdl2/image/image.ha | |
| parent | Add README.md (diff) | |
| download | hare-chip8-07046a3b2c2d0b6a5dfaaab70e5ea71e8334df1b.tar.gz | |
sdl2::image: initial commit
Some additional things which were needed to make this work were also
added.
Diffstat (limited to 'sdl2/image/image.ha')
| -rw-r--r-- | sdl2/image/image.ha | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sdl2/image/image.ha b/sdl2/image/image.ha new file mode 100644 index 0000000..03301e9 --- /dev/null +++ b/sdl2/image/image.ha @@ -0,0 +1,28 @@ +// TODO: Flesh me out +// TODO: SDL_RWops +use sdl2; + +// Flags for [[init]]. +export type init_flags = enum int { + NONE = 0, + JPG = 0x00000001, + PNG = 0x00000002, + TIF = 0x00000004, + WEBP = 0x00000008, +}; + +// Loads dynamic libraries and prepares them for use. Flags should be one or +// more flags from IMG_InitFlags OR'd together. +// +// Returns the flags successfully initialized, or 0 on failure. +export @symbol("IMG_Init") fn init(flags: init_flags) int; + +// Unloads libraries loaded with [[init]] +export @symbol("IMG_Quit") fn quit() void; + +// Load an image from a file path. +export @symbol("IMG_Load") fn load(file: const *char) nullable *sdl2::surface; + +// Load an image directly into a render texture. +export @symbol("IMG_LoadTexture") fn load_texture(renderer: *sdl2::renderer, + file: const *char) nullable *sdl2::texture; |
