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-14 04:05:02 -04:00
|
|
|
USING: errors freetype gadgets-layouts gadgets-listener
|
|
|
|
gadgets-theme generic help io kernel listener lists math memory
|
|
|
|
namespaces opengl prettyprint sdl sequences shells styles
|
|
|
|
threads words ;
|
2005-07-20 00:28:07 -04:00
|
|
|
|
|
|
|
SYMBOL: first-time
|
|
|
|
|
2005-10-08 01:15:14 -04:00
|
|
|
global [ first-time on ] bind
|
2005-05-03 19:10:20 -04:00
|
|
|
|
2005-10-14 04:05:02 -04:00
|
|
|
: init-world ( -- )
|
2005-10-08 01:15:14 -04:00
|
|
|
global [
|
2005-10-14 04:05:02 -04:00
|
|
|
first-time get [
|
|
|
|
<world> world set
|
|
|
|
world get solid-interior
|
|
|
|
@{ 800 600 0 }@ world get set-gadget-dim
|
|
|
|
<hand> hand set
|
|
|
|
first-time off
|
|
|
|
] when
|
2005-10-08 01:15:14 -04:00
|
|
|
] bind ;
|
2005-08-26 00:55:56 -04:00
|
|
|
|
2005-10-07 20:26:21 -04:00
|
|
|
: check-running
|
2005-10-28 15:37:28 -04:00
|
|
|
world get world-running?
|
|
|
|
[ "The UI is already running" throw ] 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-14 04:05:02 -04:00
|
|
|
[
|
|
|
|
init-world check-running
|
2005-10-28 15:37:28 -04:00
|
|
|
world get rect-dim first2
|
|
|
|
[ listener-application run-world ] with-gl-screen
|
2005-10-14 04:05:02 -04:00
|
|
|
] with-freetype ;
|