Mercurial > repos > tabletprog
diff modules/sdl.tp @ 333:577406b25f89
Added binding for SDL_SetTextureColorMod and SDL_GetTextureColorMod and updated the Freetype sample to use it for setting the color of text
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 29 Mar 2015 09:43:24 -0700 |
parents | ead24192ed45 |
children | 98534108b854 |
line wrap: on
line diff
--- a/modules/sdl.tp Sat Mar 28 14:21:22 2015 -0700 +++ b/modules/sdl.tp Sun Mar 29 09:43:24 2015 -0700 @@ -589,10 +589,47 @@ llMessage: blendMode withVars: { mode <- obj_uint32 ptr } andCode: { - mode <-make_object: (addr_of: obj_uint32_meta) NULL 0 + mode <- make_object: (addr_of: obj_uint32_meta) NULL 0 SDL_GetTextureBlendMode: texture (addr_of: (mode num)) mode } + + llMessage: colorMod! withVars: { + color <- object ptr + tmp <- object ptr + r <- obj_uint8 ptr + g <- obj_uint8 ptr + b <- obj_uint8 ptr + intret <- obj_int32 ptr + } andCode: :color { + tmp <- mcall: r 1 color + r <- (mcall: uint8 1 tmp) castTo: (obj_uint8 ptr) + tmp <- mcall: g 1 color + g <- (mcall: uint8 1 tmp) castTo: (obj_uint8 ptr) + tmp <- mcall: b 1 color + b <- (mcall: uint8 1 tmp) castTo: (obj_uint8 ptr) + intret <- make_object: (addr_of: obj_int32_meta) NULL 0 + intret num!: (SDL_SetTextureColorMod: texture (r num) (g num) (b num)) + intret + } + + llMessage: colorMod withVars: { + color <- object ptr + r <- obj_uint8 ptr + g <- obj_uint8 ptr + b <- obj_uint8 ptr + rescode <- int32_t + } andCode: { + r <- make_object: (addr_of: obj_uint8_meta) NULL 0 + g <- make_object: (addr_of: obj_uint8_meta) NULL 0 + b <- make_object: (addr_of: obj_uint8_meta) NULL 0 + rescode <- SDL_GetTextureColorMod: texture (addr_of: (r num)) (addr_of: (g num)) (addr_of: (b num)) + if: rescode { + mcall: none 1 option + } else: { + mcall: value 2 option (mcall: r:g:b 4 sdl r g b) + } + } llMessage: destroy withVars: {} andCode: { SDL_DestroyTexture: texture