Files
lean-sdl3/SDL.lean
T

67 lines
1.8 KiB
Lean4
Raw Normal View History

2025-09-20 16:11:27 -07:00
namespace SDL
def SDL_INIT_VIDEO : UInt32 := 0x00000020
def SDL_WINDOW_SHOWN : UInt32 := 0x00000004
def SDL_RENDERER_ACCELERATED : UInt32 := 0x00000002
def SDL_QUIT : UInt32 := 0x100
def SDL_SCANCODE_W : UInt32 := 26
def SDL_SCANCODE_A : UInt32 := 4
def SDL_SCANCODE_S : UInt32 := 22
def SDL_SCANCODE_D : UInt32 := 7
def SDL_SCANCODE_LEFT : UInt32 := 80
def SDL_SCANCODE_RIGHT : UInt32 := 79
def SDL_SCANCODE_SPACE : UInt32 := 44
def SDL_SCANCODE_ESCAPE : UInt32 := 41
@[extern "sdl_init"]
opaque init : UInt32 → IO UInt32
2025-09-23 21:21:42 -07:00
@[extern "sdl_ttf_init"]
opaque ttfInit : IO Bool
2025-09-20 16:11:27 -07:00
@[extern "sdl_quit"]
opaque quit : IO Unit
@[extern "sdl_create_window"]
opaque createWindow : String → Int32 → Int32 → UInt32 → IO UInt32
@[extern "sdl_create_renderer"]
opaque createRenderer : Unit → IO UInt32
@[extern "sdl_set_render_draw_color"]
opaque setRenderDrawColor : UInt8 → UInt8 → UInt8 → UInt8 → IO Int32
@[extern "sdl_render_clear"]
opaque renderClear : IO Int32
@[extern "sdl_render_present"]
opaque renderPresent : IO Unit
@[extern "sdl_render_fill_rect"]
opaque renderFillRect : Int32 → Int32 → Int32 → Int32 → IO Int32
@[extern "sdl_delay"]
opaque delay : UInt32 → IO Unit
@[extern "sdl_poll_event"]
opaque pollEvent : IO UInt32
@[extern "sdl_get_ticks"]
opaque getTicks : IO UInt32
@[extern "sdl_get_key_state"]
opaque getKeyState : UInt32 → IO Bool
@[extern "sdl_load_texture"]
opaque loadTexture : String → IO UInt32
2025-09-23 21:34:45 -07:00
@[extern "sdl_load_font"]
opaque loadFont : String → UInt32 → IO Bool
2025-09-23 22:08:54 -07:00
@[extern "sdl_render_texture"]
opaque renderTexture (x : Int32) (y : Int32) (w : Int32) (h : Int32) : IO Int32
2025-09-20 16:11:27 -07:00
2025-09-23 21:57:36 -07:00
@[extern "sdl_render_text"]
opaque renderText (message : String) (x : Int32) (y : Int32) (red : UInt8) (green : UInt8) (blue : UInt8) (alpha : UInt8) : IO Int32
2025-09-20 16:11:27 -07:00
end SDL