Mercurial > repos > tabletprog
diff samples/freetype.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 | e70f9d3f19f8 |
children |
line wrap: on
line diff
--- a/samples/freetype.tp Sat Mar 28 14:21:22 2015 -0700 +++ b/samples/freetype.tp Sun Mar 29 09:43:24 2015 -0700 @@ -186,11 +186,11 @@ //FIXME: This will probably only work on little endian machines bytearr set: dstIdx (pixels get: idx) dstIdx <- dstIdx + 1 - bytearr set: dstIdx (color r) + bytearr set: dstIdx 255u8 //(color r) dstIdx <- dstIdx + 1 - bytearr set: dstIdx (color g) + bytearr set: dstIdx 255u8 (color g) dstIdx <- dstIdx + 1 - bytearr set: dstIdx (color b) + bytearr set: dstIdx 255u8 (color b) dstIdx <- dstIdx + 1 idx <- idx + 1 @@ -227,11 +227,11 @@ //FIXME: This will probably only work on little endian machines bytearr set: dstIdx (pixels get: idx) dstIdx <- dstIdx + 1 - bytearr set: dstIdx (color r) + bytearr set: dstIdx 255u8 //(color r) dstIdx <- dstIdx + 1 - bytearr set: dstIdx (color g) + bytearr set: dstIdx 255u8 (color g) dstIdx <- dstIdx + 1 - bytearr set: dstIdx (color b) + bytearr set: dstIdx 255u8 (color b) dstIdx <- dstIdx + 1 idx <- idx + 1 @@ -260,6 +260,7 @@ foreach: glyphs :idx glyph { glyphDict set: (glyph charCode) glyph } + drawTex colorMod!: color _pixelFactor <- ((face unitsPerEm) f64) * 72.0 / (fontSize * (dpi f64)) option value: #{ texture <- drawTex