{ "d" c:double }
{ "B" c:bool }
{ "v" c:void }
- { "*" c:c-string }
+ { "*" c:void* }
{ "?" unknown_type }
{ "@" id }
{ "#" Class }
objc-methods get set-at ;
: each-method-in-class ( class quot -- )
- [ { uint } [ class_copyMethodList ] [ ] with-out-parameters ] dip
+ [ { uint } [ class_copyMethodList ] with-out-parameters ] dip
over 0 = [ 3drop ] [
[ <direct-void*-array> ] dip
[ each ] [ drop (free) ] 2bi
[ init-texture texture-coords>> gl-texture-coord-pointer ] tri
swap gl-fill-rect ;
+: set-blend-mode ( texture -- )
+ image>> dup has-alpha?
+ [ premultiplied-alpha?>> [ GL_ONE GL_ONE_MINUS_SRC_ALPHA glBlendFunc ] when ]
+ [ drop GL_BLEND glDisable ] if ;
+
+: reset-blend-mode ( texture -- )
+ image>> dup has-alpha?
+ [ premultiplied-alpha?>> [ GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA glBlendFunc ] when ]
+ [ drop GL_BLEND glEnable ] if ;
+
: draw-textured-rect ( dim texture -- )
[
- [ image>> has-alpha? [ GL_BLEND glDisable ] unless ]
+ [ set-blend-mode ]
[ (draw-textured-rect) GL_TEXTURE_2D 0 glBindTexture ]
- [ image>> has-alpha? [ GL_BLEND glEnable ] unless ]
- tri
+ [ reset-blend-mode ] tri
] with-texturing ;
: texture-coords ( texture -- coords )
[ [ max-texture-size tesselate ] dip <multi-texture> ] if ;
: get-texture-float ( target level enum -- value )
- { float } [ glGetTexLevelParameterfv ] [ ] with-out-parameters ; inline
+ { float } [ glGetTexLevelParameterfv ] with-out-parameters ; inline
: get-texture-int ( target level enum -- value )
- { int } [ glGetTexLevelParameteriv ] [ ] with-out-parameters ; inline
+ { int } [ glGetTexLevelParameteriv ] with-out-parameters ; inline