Commit 7aad6115 authored by bp's avatar bp

Added rosetta examples


git-svn-id: https://forth-ev.de/repos/bigforth@634 3b8d8251-53f3-0310-8f3b-fd1cb8370982
parent 7361810d
also minos
text-label ptr click-label
Variable click# click# off
: click-win ( -- ) screen self window new window with
X" There have been no clicks yet" text-label new
dup F bind click-label
^ S[ 1 click# +!
click# @ 0 <# #S s" Number of clicks: " holds #>
click-label assign ]S X" Click me" button new
&2 vabox new panel s" Clicks" assign show endwith ;
click-win
#! xbigforth
\ automatic generated code
\ do not edit
also editor also minos also forth
component class ccount
public:
early widget
early open
early dialog
early open-app
text-label ptr click#
( [varstart] ) cell var clicks ( [varend] )
how:
: open new DF[ 0 ]DF s" Click counter" open-component ;
: dialog new DF[ 0 ]DF s" Click counter" open-dialog ;
: open-app new DF[ 0 ]DF s" Click counter" open-application ;
class;
ccount implements
( [methodstart] ) ( [methodend] )
: widget ( [dumpstart] )
X" There have been no clicks yet" text-label new ^^bind click#
^^ S[ 1 clicks +!
clicks @ 0 <# #S s" Number of clicks: " holds #> click# assign ]S ( MINOS ) X" Click me" button new
&2 vabox new panel
( [dumpend] ) ;
: init ^>^^ assign widget 1 :: init ;
class;
: main
ccount open-app
$1 0 ?DO stop LOOP bye ;
script? [IF] main [THEN]
previous previous previous
import glconst import float
glconst also float also opengl also
#! xbigforth
\ automatic generated code
\ do not edit
also editor also minos also forth
include triangle.fs
component class triangle
public:
early widget
early open
early dialog
early open-app
( [varstart] ) ( [varend] )
how:
: open new DF[ 0 ]DF s" Triangle" open-component ;
: dialog new DF[ 0 ]DF s" Triangle" open-dialog ;
: open-app new DF[ 0 ]DF s" Triangle" open-application ;
class;
triangle implements
( [methodstart] ) ( [methodend] )
: widget ( [dumpstart] )
GL[ ^ glcanvas with
0 0 w @ h @ glViewport
GL_PROJECTION glMatrixMode
glLoadIdentity
-30e 30e -30e 30e -30e 30e glOrtho
GL_MODELVIEW glMatrixMode
0.3e 0.3e 0.3e 0.0e glClearColor
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT or glClear
GL_SMOOTH glShadeModel
glLoadIdentity
-15e -15e 0e glTranslatef
GL_TRIANGLES glBegin
1e 0e 0e glColor3f
0e 0e glVertex2f
0e 1e 0e glColor3f
30e 0e glVertex2f
0e 0e 1e glColor3f
0e 30e glVertex2f
glEnd
glFlush
endwith ]GL ( MINOS ) ^^ CK[ ( x y b n -- ) 2drop 2drop ]CK ( MINOS ) $280 $1 *hfil $1E0 $1 *vfil glcanvas new
&1 vabox new
( [dumpend] ) ;
: init ^>^^ assign widget 1 :: init ;
class;
: main
triangle open-app
$1 0 ?DO stop LOOP bye ;
script? [IF] main [THEN]
previous previous previous
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment