changeset 334:98534108b854

Add width and height accessors to texture objects in SDL module
author Michael Pavone <pavone@retrodev.com>
date Mon, 30 Mar 2015 19:12:40 -0700
parents 577406b25f89
children 79a14e41b79a
files modules/sdl.tp
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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