# HG changeset patch # User Michael Pavone # Date 1427767960 25200 # Node ID 98534108b8549352511d3bfe9ff616c25f53e21e # Parent 577406b25f899b7ad19017027fd54b03bb9ca2de Add width and height accessors to texture objects in SDL module diff -r 577406b25f89 -r 98534108b854 modules/sdl.tp --- a/modules/sdl.tp Sun Mar 29 09:43:24 2015 -0700 +++ b/modules/sdl.tp Mon Mar 30 19:12:40 2015 -0700 @@ -483,6 +483,10 @@ includeSystemHeader: "SDL.h" llProperty: renderer withType: (SDL_Renderer ptr) llProperty: texture withType: (SDL_Texture ptr) + llProperty: _width withType: int32_t + llProperty: _height withType: int32_t + llProperty: _format withType: uint32_t + llProperty: _access withType: int32_t llMessage: opaque withVars: { ptr <- cpointer ptr } andCode: { @@ -496,6 +500,7 @@ } andCode: :rendptr texptr{ renderer <- rendptr val texture <- texptr val + SDL_QueryTexture: texture (addr_of: _format) (addr_of: _access) (addr_of: _width) (addr_of: _height) self } @@ -630,6 +635,22 @@ mcall: value 2 option (mcall: r:g:b 4 sdl r g b) } } + + llMessage: width withVars: { + intret <- obj_int32 ptr + } andCode: { + intret <- make_object: (addr_of: obj_int32_meta) NULL 0 + intret num!: _width + intret + } + + llMessage: height withVars: { + intret <- obj_int32 ptr + } andCode: { + intret <- make_object: (addr_of: obj_int32_meta) NULL 0 + intret num!: _height + intret + } llMessage: destroy withVars: {} andCode: { SDL_DestroyTexture: texture