factor/library/ui/ui.factor

30 lines
725 B
Factor

! Copyright (C) 2005 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license.
IN: gadgets
USING: kernel namespaces sdl sequences ;
: title ( -- str )
"Factor " version append ;
SYMBOL: first-time?
global [ first-time? on ] bind
: first-time ( -- )
first-time? get [
world get gadget-paint [ console ] bind
global [ first-time? off ] bind
] when ;
IN: shells
: ui ( -- )
#! Start the Factor graphics subsystem with the given screen
#! dimensions.
t world get set-world-running?
world get shape-w world get shape-h 0 SDL_RESIZABLE
[
0 x set 0 y set [
title dup SDL_WM_SetCaption first-time run-world
] with-screen
] with-scope ;