Paste: texture graft
Author: | rationalrevolt |
Mode: | factor |
Date: | Sun, 29 Nov 2015 12:21:10 |
Plain Text |
TUPLE: i-gadget < gadget
image texture ;
: <i-gadget> ( path -- gadget )
[ i-gadget new ] dip load-image >>image ;
M: i-gadget pref-dim*
image>> dim>> [ 20 + ] map ;
M: i-gadget graft*
dup find-gl-context
dup image>> { 0 0 } <texture> >>texture drop ;
M: i-gadget ungraft*
dup find-gl-context
dup texture>> dispose
f >>texture drop ;
M: i-gadget draw-gadget*
[ { 10 10 } ] dip texture>> [ draw-texture ] curry with-translation ;
"vocab:images/sprites/game_drop.png" <i-gadget> gadget.
"vocab:images/sprites/game_drop.png" <i-gadget> "i-gadget" open-window
New Annotation