2005-05-03 19:10:20 -04:00
|
|
|
! Copyright (C) 2005 Slava Pestov.
|
|
|
|
! See http://factor.sf.net/license.txt for BSD license.
|
|
|
|
IN: gadgets
|
2005-10-07 20:26:21 -04:00
|
|
|
USING: errors gadgets-layouts gadgets-listener gadgets-theme generic
|
2005-09-28 23:29:00 -04:00
|
|
|
help io kernel listener lists math memory namespaces prettyprint
|
|
|
|
sdl sequences shells styles threads words ;
|
2005-08-26 00:55:56 -04:00
|
|
|
|
2005-07-20 00:28:07 -04:00
|
|
|
: init-world
|
|
|
|
global [
|
2005-10-07 20:26:21 -04:00
|
|
|
world get clear-gadget
|
2005-09-28 23:29:00 -04:00
|
|
|
<gadget> dup solid-interior add-layer
|
2005-08-26 00:55:56 -04:00
|
|
|
listener-application
|
|
|
|
] bind ;
|
2005-07-20 00:28:07 -04:00
|
|
|
|
|
|
|
SYMBOL: first-time
|
|
|
|
|
2005-10-07 20:26:21 -04:00
|
|
|
global [
|
|
|
|
<world> world set
|
|
|
|
world get world-theme
|
|
|
|
<hand> hand set
|
|
|
|
@{ 800 600 0 }@ world get set-gadget-dim
|
|
|
|
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-10-07 20:26:21 -04:00
|
|
|
: check-running
|
|
|
|
world get [
|
|
|
|
dup world-running?
|
|
|
|
[ "The UI is already running" throw ] when
|
|
|
|
] when* ;
|
2005-08-26 00:55:56 -04:00
|
|
|
|
2005-09-03 22:28:46 -04:00
|
|
|
IN: shells
|
|
|
|
|
2005-05-03 19:10:20 -04:00
|
|
|
: ui ( -- )
|
|
|
|
#! Start the Factor graphics subsystem with the given screen
|
|
|
|
#! dimensions.
|
2005-10-07 20:26:21 -04:00
|
|
|
check-running
|
|
|
|
world get rect-dim first2 0 SDL_RESIZABLE
|
|
|
|
[ ?init-world run-world ] with-screen ;
|