]> gitweb.factorcode.org Git - factor.git/commitdiff
SDL console fix
authorSlava Pestov <slava@factorcode.org>
Sat, 12 Feb 2005 00:35:50 +0000 (00:35 +0000)
committerSlava Pestov <slava@factorcode.org>
Sat, 12 Feb 2005 00:35:50 +0000 (00:35 +0000)
library/sdl/sdl-utils.factor
library/ui/console.factor
library/ui/fields.factor
library/ui/paint.factor

index 3f8ecfb1f1a7daa882d6eca4216b2afe42922ecf..5a8223175874e51ccfb5982c8d51e9b15bde20c0 100644 (file)
@@ -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
index bbf1283c92a2ad85b5b6565712c69dc648e4d62c..bd1c9e88573c8ef6e36df86ffacbbcddfe4d1c84 100644 (file)
@@ -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
index 8e394d66e9730935d261c4645305219fba267fa9..73696f2693f7bb77ca9d670381ff6514149b1288 100644 (file)
@@ -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 ;
index 960c62d89a4678f7b6ded53dc5c41ef4cee63c89..f91433989a8298ae690e161852b3e20749868d51 100644 (file)
@@ -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 ;