SDL console fix
parent
96edb600fe
commit
f5fe5fd692
|
@ -137,6 +137,7 @@ global [
|
|||
over str-length 0 = [
|
||||
2drop 3drop 0
|
||||
] [
|
||||
>r >r lookup-font r> r>
|
||||
TTF_RenderUNICODE_Blended
|
||||
[ draw-surface ] keep
|
||||
[ surface-w ] keep
|
||||
|
|
|
@ -342,8 +342,8 @@ M: alien handle-event ( event -- ? )
|
|||
] ifte ;
|
||||
|
||||
: set-console-font ( font ptsize )
|
||||
cons lookup-font dup console-font set
|
||||
TTF_FontHeight line-height set ;
|
||||
cons dup console-font set
|
||||
lookup-font TTF_FontHeight line-height set ;
|
||||
|
||||
: init-console ( -- )
|
||||
TTF_Init
|
||||
|
|
|
@ -11,7 +11,7 @@ TUPLE: editor line delegate ;
|
|||
editor-line [ line-text get ] bind ;
|
||||
|
||||
: set-editor-text ( text editor -- )
|
||||
editor-line [ line-text set ] bind ;
|
||||
editor-line [ set-line-text ] bind ;
|
||||
|
||||
C: editor ( text -- )
|
||||
0 0 0 0 <rectangle> <gadget> over set-editor-delegate
|
||||
|
@ -34,4 +34,5 @@ C: field ( text -- field )
|
|||
[[ [ lose-focus ] [ dup black foreground set-paint-property redraw ] ]]
|
||||
[[ [ button-down 1 ] [ my-hand request-focus ] ]]
|
||||
[[ [ "RETURN" ] [ drop "foo!" USE: stdio print ] ]]
|
||||
[[ [ "BACKSPACE" ] [ dup gadget-children car editor-line [ backspace ] bind redraw ] ]]
|
||||
}} over set-gadget-gestures ;
|
||||
|
|
|
@ -138,6 +138,6 @@ M: string shape-h ( text -- h )
|
|||
drop font get lookup-font TTF_FontHeight ;
|
||||
|
||||
M: string draw-shape ( text -- )
|
||||
>r x get y get font get lookup-font r>
|
||||
>r x get y get font get r>
|
||||
foreground get 3unlist make-color
|
||||
draw-string drop ;
|
||||
|
|
Loading…
Reference in New Issue