texture updating + pixels

This commit is contained in:
Greg Shuflin committed 2025-12-25 18:44:18 -08:00
1 parent 93262301b5
commit 71ddbdeb5a
3 files changed
+49 -2

No files matched your search

+16
View File
@@ -119,6 +119,10 @@ instance SDLSurface.instNonempty : Nonempty SDLSurface := SDLSurface.nonemptyTyp
namespace SDLSurface
private opaque Pixels.nonemptyType : NonemptyType
def Pixels: Type := Pixels.nonemptyType.type
instance PIxels.instNonempty : Nonempty Pixels := Pixels.nonemptyType.property
@[extern "sdl_Surface_get_format"]
opaque format : @& SDLSurface -> UInt32
@@ -128,6 +132,12 @@ opaque w : @& SDLSurface -> Int32
@[extern "sdl_Surface_get_h"]
opaque h : @& SDLSurface -> Int32
@[extern "sdl_Surface_get_pixels"]
opaque pixels : @& SDLSurface -> Pixels
@[extern "sdl_Surface_get_pitch"]
opaque pitch : @& SDLSurface -> Int32
end SDLSurface
@[extern "sdl_image_load"]
@@ -141,6 +151,12 @@ opaque createTexture (renderer: @& SDLRenderer) (pixelFormat: UInt32) (textureAc
opaque createTextureFromSurface
(renderer : @& SDLRenderer) (surface : @& SDLSurface) : SDLIO SDLTexture
-- TODO handle SDLRect argument
@[extern "sdl_update_texture"]
opaque updateTexture (texture: @& SDLTexture) (pixels: @& SDLSurface.Pixels) (pitch: Int32): SDLIO Bool
def loadImageTexture
(renderer : SDLRenderer) (path : System.FilePath)
: SDLIO SDLTexture := do