2005-05-03 19:10:20 -04:00
|
|
|
! Copyright (C) 2005 Slava Pestov.
|
|
|
|
! See http://factor.sf.net/license.txt for BSD license.
|
2005-07-20 00:28:07 -04:00
|
|
|
IN: help
|
2005-08-26 00:55:56 -04:00
|
|
|
DEFER: <tutorial-button>
|
2005-07-20 00:28:07 -04:00
|
|
|
|
2005-05-03 19:10:20 -04:00
|
|
|
IN: gadgets
|
2005-07-20 00:28:07 -04:00
|
|
|
USING: generic help io kernel listener math namespaces
|
2005-08-26 00:55:56 -04:00
|
|
|
prettyprint sdl sequences styles threads words shells ;
|
2005-07-20 00:28:07 -04:00
|
|
|
|
|
|
|
SYMBOL: stack-display
|
|
|
|
|
|
|
|
: ui.s ( -- )
|
2005-08-21 14:25:05 -04:00
|
|
|
stack-display get dup pane-clear [ .s ] with-stream* ;
|
2005-07-20 00:28:07 -04:00
|
|
|
|
2005-08-26 00:55:56 -04:00
|
|
|
: listener-thread
|
|
|
|
pane get [
|
|
|
|
[ ui.s ] listener-hook set <tutorial-button> gadget. tty
|
|
|
|
] with-stream* ;
|
|
|
|
|
|
|
|
: listener-application
|
|
|
|
<pane> dup pane set <scroller>
|
|
|
|
<pane> dup stack-display set <scroller>
|
|
|
|
5/6 <x-splitter> add-layer
|
|
|
|
[ clear listener-thread ] in-thread
|
|
|
|
pane get request-focus ;
|
|
|
|
|
2005-07-20 00:28:07 -04:00
|
|
|
: init-world
|
|
|
|
global [
|
|
|
|
<world> world set
|
2005-08-26 00:55:56 -04:00
|
|
|
{ 700 800 0 } world get set-gadget-dim
|
2005-07-20 00:28:07 -04:00
|
|
|
|
|
|
|
{{
|
2005-07-27 20:13:11 -04:00
|
|
|
[[ background { 255 255 255 } ]]
|
2005-08-26 00:55:56 -04:00
|
|
|
[[ rollover-bg { 236 230 232 } ]]
|
2005-07-27 20:13:11 -04:00
|
|
|
[[ bevel-1 { 160 160 160 } ]]
|
|
|
|
[[ bevel-2 { 216 216 216 } ]]
|
|
|
|
[[ foreground { 0 0 0 } ]]
|
2005-07-20 00:28:07 -04:00
|
|
|
[[ reverse-video f ]]
|
|
|
|
[[ font "Sans Serif" ]]
|
|
|
|
[[ font-size 12 ]]
|
|
|
|
[[ font-style plain ]]
|
|
|
|
}} world get set-gadget-paint
|
2005-08-26 00:55:56 -04:00
|
|
|
|
2005-07-20 00:28:07 -04:00
|
|
|
<plain-gadget> add-layer
|
2005-08-26 00:55:56 -04:00
|
|
|
|
|
|
|
listener-application
|
|
|
|
] bind ;
|
2005-07-20 00:28:07 -04:00
|
|
|
|
|
|
|
SYMBOL: first-time
|
|
|
|
|
|
|
|
global [ first-time on ] bind
|
2005-05-03 19:10:20 -04:00
|
|
|
|
2005-07-20 00:28:07 -04:00
|
|
|
: ?init-world
|
|
|
|
first-time get [ init-world first-time off ] when ;
|
2005-08-26 00:55:56 -04:00
|
|
|
|
2005-05-03 19:10:20 -04:00
|
|
|
IN: shells
|
|
|
|
|
2005-08-26 00:55:56 -04:00
|
|
|
: ui-title
|
|
|
|
[ "Factor " % version % " - " % "image" get % ] "" make ;
|
|
|
|
|
2005-05-03 19:10:20 -04:00
|
|
|
: ui ( -- )
|
|
|
|
#! Start the Factor graphics subsystem with the given screen
|
|
|
|
#! dimensions.
|
2005-07-13 18:08:54 -04:00
|
|
|
ttf-init
|
2005-07-11 22:47:38 -04:00
|
|
|
?init-world
|
2005-08-23 23:28:54 -04:00
|
|
|
world get rect-dim 2unseq 0 SDL_RESIZABLE [
|
2005-07-19 17:40:32 -04:00
|
|
|
[
|
2005-08-26 00:55:56 -04:00
|
|
|
ui-title dup SDL_WM_SetCaption
|
2005-05-03 23:50:04 -04:00
|
|
|
start-world
|
|
|
|
run-world
|
2005-05-03 19:10:20 -04:00
|
|
|
] with-screen
|
|
|
|
] with-scope ;
|