-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
51 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,31 @@ | ||
/eventhandler_vars ( /type 0 /key 0 /action 0 ) def | ||
getcanvas getconsole setcanvas getfont exch setcanvas setfont | ||
|
||
/eventhandler { | ||
eventhandler_vars setdict | ||
|
||
/type exch def | ||
/key exch def | ||
|
||
key edit .input | ||
|
||
action | ||
} def | ||
|
||
/setrpos { | ||
getpos rot add exch rot add exch setpos | ||
} def | ||
|
||
# - - - - - - - - - - - - - - - | ||
|
||
/edit ( | ||
/x 0 | ||
/y 0 | ||
/width 0 | ||
/height 0 | ||
/background nil | ||
/x_shift 0 | ||
/cursor_index 0 | ||
/cursor_x [ 0 ] | ||
/buf [ ] | ||
|
||
/init { | ||
/height exch def | ||
/width exch def | ||
getpos | ||
/y exch def | ||
/x exch def | ||
/background width height newcanvas def | ||
getcolor | ||
0x90000000 setcolor | ||
width height fillrect | ||
setcolor | ||
getregion | ||
x y width height setregion | ||
background getcanvas blt | ||
setregion | ||
x y setpos | ||
getcanvas background blt | ||
} | ||
|
||
/text { | ||
buf encodeutf8 | ||
/widget ( | ||
/draw1 { | ||
10 y setpos | ||
text show | ||
} | ||
) def | ||
|
||
/input { | ||
/key exch def | ||
|
||
key 0x0d eq { | ||
debug | ||
text | ||
return | ||
} if | ||
|
||
buf [ key ] add! pop | ||
cursor_x -1 get x add y setpos | ||
key show | ||
cursor_x [ getpos pop x sub ] add! pop | ||
/win ( | ||
/y 20 | ||
/text "XX" | ||
/draw2 { | ||
debug | ||
10 y setpos | ||
text show | ||
/y y 20 add def | ||
/text text " XX" add def | ||
} | ||
) def | ||
|
||
# - - - - - - - - - - - - - - - | ||
|
||
/console-font getcanvas getconsole setcanvas getfont exch setcanvas def | ||
|
||
/dejavu-sans-24 "dejavu-sans-24.fnt" readfile newfont def | ||
|
||
/title "ABC 12345ijklmn xyz # * % & § öäüß €" def | ||
|
||
/katze "katze_%04u.jpg" [ getcanvas dim pop ] format readfile | ||
dup nil eq { console-font setfont 0 20 setpos 0xff0000 setcolor "Error: no backgound image" show return } if | ||
unpackimage def | ||
|
||
0 0 setpos | ||
getcanvas katze blt | ||
|
||
dejavu-sans-24 setfont | ||
|
||
getcanvas dim pop title dim pop sub 2 div 50 setpos | ||
|
||
0x90000000 setcolor | ||
-10 -5 setrpos | ||
title dim 10 add exch 20 add exch fillrect | ||
10 5 setrpos | ||
|
||
0xffffff setcolor | ||
title show | ||
win widget setparent | ||
|
||
100 460 setpos | ||
600 30 edit .init | ||
/win_i ( ) def | ||
win_i win setparent | ||
|
||
/eventhandler seteventhandler | ||
win_i .draw2 | ||
win_i .draw2 | ||
win_i .draw2 | ||
|
||
0 0 setpos | ||
win_i .draw1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters