Hi,
I am a noob too, starting to play with opengl using the redbook and
factor so here is an example of how to make an animation using timers.
I couldn't figure out how to do it using <slate>. It is probably not
the best solution and it flicks (I still don't know how to do
double-buffering in factor).
Hope its usefull.
[]s,
Ricardo Boccato Alves.
TUPLE: test-gadget offset ;
: <test-gadget> ( -- gadget )
test-gadget construct-gadget
dup 0 swap set-test-gadget-offset ;
M: test-gadget pref-dim* ( gadget -- dim )
drop { 600 600 } ;
M: test-gadget draw-gadget* ( gadget -- )
test-gadget-offset dup 2array
origin get
v+
[ blue gl-color
{ 30 30 } { 100 100 } gl-fill-rect
] with-translation ;
M: test-gadget tick ( object -- )
[ [ test-gadget-offset 10 + ] keep set-test-gadget-offset ] keep
relayout-1 ;
: test-window ( -- )
[
<test-gadget>
[ 100 1 add-timer ] keep
"Test" open-window
] with-ui ;
On Tue, Mar 4, 2008 at 8:08 AM, Ben Schlingelhof
<[EMAIL PROTECTED]> wrote:
> I discovered Factor about a month ago and am trying very much to fall
> in love with it. As usual at the very beginning of a new relationship,
> I'm rather confused. Loved Forth in 1989, so I have a faint memory of
> stack-based programming. Still everything in Factor is new, promising,
> and utterly strange. Enough story, you guys love beginners questions,
> so here it goes:
>
> I managed to paint a nice square on the screen:
>
> : display ( -- )
> blue gl-color
> { 30 30 } { 100 100 } gl-fill-rect
> ;
>
> : test-window ( -- )
> [
> [ display ] <slate>
> { 600 600 } over set-slate-dim
> "Test" open-window
> ] with-ui ;
>
> MAIN: test-window.
>
> How do I get it to move? I had a look at the timers, confusion.
>
> Second question: Is there a possibility to disable the alt-5 shortcut?
> I'm on a german mac, that is the [ . Rather inconvenient.
>
> Ben
>
> --
> Ben Schlingelhof
> benseins.de
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Factor-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk