Skip to content

Commit 0c35cb8

Browse files
committed
新增game plane demo
1 parent 14f7bdd commit 0c35cb8

45 files changed

Lines changed: 1138 additions & 145 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

agave/README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Quick start
2+
3+
## Setup
4+
5+
$ cd ~/scheme # Where '~/scheme' is the path to your Scheme libraries
6+
$ git clone git://github.com/dharmatech/surfage.git
7+
$ bzr branch lp:~derick-eddington/scheme-libraries/xitomatl
8+
$ git clone git://github.com/dharmatech/dharmalab.git
9+
$ git clone git://github.com/dharmatech/agave.git
10+
11+
## Run a demo in Ypsilon
12+
13+
$ ypsilon ~/scheme/agave/demos/flexi-line.scm
14+
15+
## Run a demo in Ikarus
16+
17+
$ ikarus --r6rs-script ~/scheme/agave/demos/flexi-line.scm
18+
19+
## Make a demo load faster in Ikarus
20+
21+
$ ikarus --compile-dependencies ~/scheme/agave/demos/flexi-line.scm
22+
23+
# Introduction
24+
25+
Agave started out as a collection of OpenGL demos written for R6RS
26+
Scheme. Eventually it grew to include libraries which support basic
27+
OpenGL programming idioms.
28+
29+
All of the demos run in Ikarus and Ypsilon.
30+
31+
# Libraries
32+
33+
Some of the libraries are:
34+
35+
```
36+
| library | notes |
37+
|-----------------------------------+-------|
38+
| (agave glamour window) | |
39+
| (agave glamour mouse) | |
40+
| (agave glamour misc) | |
41+
| (agave glamour frames-per-second) | |
42+
| (agave color rgba) | |
43+
| (agave color hsva) | |
44+
| (agave color conversion) | |
45+
| (agave geometry pt) | |
46+
| (agave geometry pt-3d) | |
47+
```
48+
49+
The rest of the libraries are mostly support for the demos.
50+
51+
# Demos
52+
53+
A few demo highlights.
54+
55+
## springies
56+
57+
Long before [Sodaplay](http://sodaplay.com) existed, [Doug DeCarlo](http://www.cs.rutgers.edu/~decarlo/) wrote [xspringies](http://www.cs.rutgers.edu/~decarlo/software.html). Springies
58+
is an implementation of the engine in xspringies. Note that this is
59+
not a binding to any C library; this is an honest to goodness mass and
60+
spring simulation written in pure Scheme. To me, this is a
61+
demonstration that Scheme can be a high-performance language.
62+
63+
![](https://raw.githubusercontent.com/dharmatech/dharmatech.github.com/master/images/springies-belt-tire.png)
64+
65+
## cfdg
66+
67+
An implementation of the [Context Free Art](http://www.contextfreeart.org) semantics. It also renders
68+
the models. :-) Only a subset of the full ContextFree language is
69+
supported, but I picked a subset which allows for some nice pieces to
70+
be rendered.
71+
72+
Screenshot:
73+
74+
![](https://raw.githubusercontent.com/dharmatech/dharmatech.github.com/master/images/cfdg-game1-turn6.png)
75+
76+
## flexi-line
77+
78+
A port of a [demo](http://www.openprocessing.org/visuals/?visualID=323) I found on [Open Processing](http://www.openprocessing.org).
79+
80+
## empathy
81+
82+
A port of a [demo](http://www.openprocessing.org/visuals/?visualID=1182) by [Kyle McDonald](http://www.openprocessing.org/portal/?userID=838) I found on [Open Processing](http://www.openprocessing.org).
83+
84+
## ca
85+
86+
Simulator for the [generations](http://www.mirekw.com/ca/rullex_gene.html) family of cellular automata.

agave/glamour/misc.sls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
gl-clear-color-rgba
2626
)
2727

28-
(import (rnrs) (gles1) (glut) (agave color rgba))
28+
(import (rnrs) (gui gles1) (gui glut) (agave color rgba))
2929

3030
(define (initialize-glut)
3131
;(glut-init)

agave/glamour/window.sls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
(agave glamour window)
1717
(export window invert-y)
1818

19-
(import (rnrs) (gles1) (glut))
19+
(import (rnrs) (gui gles1) (gui glut))
2020

2121

2222
(define-syntax window

agave/processing/shapes-3d.sls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
(import (rnrs)
2626
(agave geometry pt-3d)
2727
(agave color rgba)
28-
(gles1)
28+
(gui gles1)
2929
(agave glamour misc)
3030
)
3131

agave/processing/shapes.sls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
(import (rnrs)
2626
(agave geometry pt)
2727
(agave color rgba)
28-
(gles1)
28+
(gui gles1)
2929
(agave glamour misc)
3030
)
3131

apps/calc.ss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
;作者:evilbinary on 11/19/16.
33
;邮箱:rootdebug@163.com
44
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5-
(import (scheme) (gles1) (glut) (imgui) )
5+
(import (scheme) (gui gles1) (gui glut) (gui imgui) )
66

77

88

@@ -21,7 +21,7 @@
2121
(let ((exp "") (clear #t))
2222
(glut-init)
2323
(imgui-init)
24-
(imgui-reset-style 11)
24+
(imgui-reset-style 7)
2525
;(android)
2626
;(imgui-scale (* 1.5 (android-get-density)) (* 1.5 (android-get-density)))
2727
(glut-touch-event (lambda (type x y)

apps/dominos.ss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1616

1717
(import (rnrs)
18-
(gles1)
19-
(glut)
18+
(gui gles1)
19+
(gui glut)
2020
(dharmalab misc limit-call-rate)
2121
(agave glamour misc)
2222
(agave glamour window)
@@ -33,7 +33,7 @@
3333
(initialize-glut)
3434

3535
(window
36-
(size 600 600)
36+
(size 800 600)
3737
(title "Box2d Lite - Dominos")
3838
(reshape (width height)
3939
(lambda (w h)

apps/draw-image.ss

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,58 @@
33
;作者:evilbinary on 01/08/17.
44
;邮箱:rootdebug@163.com
55
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6-
(import (scheme) (glut) (gles1) (imgui) )
6+
(import (scheme) (gui glut) (gui gles1) (gui imgui) )
77
(define (draw-image)
8-
(glut-init)
8+
(glut-init (lambda ()
9+
(let ((texture-id (imgui-load-texture "/sdcard/org.evilbinary.chez/number.png"))
10+
(rotation 2.0)
11+
(square-vertices (glut-vector 'float
12+
(vector
13+
-0.2 -0.2
14+
0.2 -0.2
15+
-0.2 0.2
16+
0.2 0.2
17+
)))
18+
(texture-array (glut-vector 'float
19+
(vector
20+
0.0 1.0
21+
1.0 1.0
22+
0.0 0.0
23+
1.0 0.0) ))
24+
)
25+
(glut-display (lambda()
26+
(glClearColor 0.5 0.5 0.5 1.0 );
27+
(glClear GL_COLOR_BUFFER_BIT);
28+
(glRotatef rotation 0.0 0.0 0.1)
29+
;;绘制矩形
30+
(glEnable GL_TEXTURE_2D); // 启用纹理映射
31+
(glBindTexture GL_TEXTURE_2D texture-id);
32+
(glEnableClientState GL_TEXTURE_COORD_ARRAY);
33+
34+
(glEnableClientState GL_VERTEX_ARRAY);
35+
(glVertexPointer 2 GL_FLOAT 0 square-vertices);
36+
(glTexCoordPointer 2 GL_FLOAT 0 texture-array);
37+
(glDrawArrays GL_TRIANGLE_STRIP 0 4);
38+
(glDisableClientState GL_VERTEX_ARRAY)
39+
(glDisable GL_TEXTURE_2D)
40+
(glDisable GL_TEXTURE_COORD_ARRAY)
41+
42+
)
43+
)
44+
45+
)
46+
))
947

1048
(glut-touch-event (lambda (type x y)
1149
(glut-log (format "type ~a ~a ~a" type x y ))
1250
))
1351
(glut-key-event (lambda (event)
1452
(glut-log (format "event ~a" event))
15-
16-
))
17-
(let ((texture-id (imgui-load-texture "./number.png"))
18-
(rotation 2.0)
19-
(square-vertices (glut-vector 'float
20-
(vector
21-
-0.2 -0.2
22-
0.2 -0.2
23-
-0.2 0.2
24-
0.2 0.2
25-
)))
26-
(texture-array (glut-vector 'float
27-
(vector
28-
0.0 1.0
29-
1.0 1.0
30-
0.0 0.0
31-
1.0 0.0) ))
32-
)
33-
(glut-display (lambda()
34-
(glClearColor 0.5 0.5 0.5 1.0 );
35-
(glClear GL_COLOR_BUFFER_BIT);
36-
(glRotatef rotation 0.0 0.0 0.1)
37-
;;绘制矩形
38-
(glEnable GL_TEXTURE_2D); // 启用纹理映射
39-
(glBindTexture GL_TEXTURE_2D texture-id);
40-
(glEnableClientState GL_TEXTURE_COORD_ARRAY);
53+
(if (= 4 (glut-event-get event 'keycode ))
54+
(begin (imgui-exit)
55+
(glut-exit)))
4156

42-
(glEnableClientState GL_VERTEX_ARRAY);
43-
(glVertexPointer 2 GL_FLOAT 0 square-vertices);
44-
(glTexCoordPointer 2 GL_FLOAT 0 texture-array);
45-
(glDrawArrays GL_TRIANGLE_STRIP 0 4);
46-
(glDisableClientState GL_VERTEX_ARRAY)
47-
(glDisable GL_TEXTURE_2D)
48-
(glDisable GL_TEXTURE_COORD_ARRAY)
49-
50-
)
51-
)
52-
53-
)
57+
))
5458
(glut-reshape (lambda(w h)
5559
(glut-log (format "reshape"))
5660
(glClearDepthf 1.0)

apps/draw-point.ss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
;作者:evilbinary on 11/19/16.
33
;邮箱:rootdebug@163.com
44
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5-
(import (scheme) (gles1) (glut) (imgui) (android) )
5+
(import (scheme) (gui gles1) (gui glut) (gui imgui) )
66
(define (gl-draw-point)
77
(define gx 0)
88
(define gy 0)
@@ -41,7 +41,7 @@
4141
;(glRotatef rotation 0.0 1.0 0.0 )
4242
(glPointSize 20.0)
4343
(glEnableClientState GL_VERTEX_ARRAY);
44-
(glDrawArrays GL_POINTS 0 1);
44+
(glDrawArrays GL_POINTS 0 3);
4545
(glDisableClientState GL_VERTEX_ARRAY)
4646

4747
)))

0 commit comments

Comments
 (0)