diff options
author | David Thompson <dthompson2@worcester.edu> | 2015-11-09 20:06:09 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2015-11-09 20:06:09 -0500 |
commit | 903054e3f91457d57c87ffcc196b2d8615ff62bb (patch) | |
tree | 79201426439c6c9613d61f1baef27d4b69393c51 | |
parent | 6a2fe97bff4ded0fa6d43353d9c7cb61fda98d82 (diff) |
examples: Add shape example.
* examples/shapes.scm: New file.
* examples/images/country-sky.png: New file.
* examples/images/country-trees.png: New file.
* examples/Makefile.am (nobase_dist_examples_DATA): Add them.
* examples/images/AUTHORS: Credit ansimuz.
-rw-r--r-- | examples/Makefile.am | 3 | ||||
-rw-r--r-- | examples/images/AUTHORS | 5 | ||||
-rw-r--r-- | examples/images/country-sky.png | bin | 0 -> 4039 bytes | |||
-rw-r--r-- | examples/images/country-trees.png | bin | 0 -> 8406 bytes | |||
-rw-r--r-- | examples/shapes.scm | 79 |
5 files changed, 86 insertions, 1 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am index 4796503..551bb57 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -22,11 +22,14 @@ nobase_dist_examples_DATA = \ font.scm \ framebuffer.scm \ joystick.scm \ + shapes.scm \ simple.scm \ tilemap.scm \ life.scm \ mines/mines.scm \ images/bullet.png \ + images/country-sky.png \ + images/country-trees.png \ images/p1_front.png \ images/princess.png \ images/stars.png \ diff --git a/examples/images/AUTHORS b/examples/images/AUTHORS index 5cb516e..9390a88 100644 --- a/examples/images/AUTHORS +++ b/examples/images/AUTHORS @@ -7,4 +7,7 @@ http://opengameart.org/content/liberated-pixel-cup-base-assets-sprites-map-tiles Kenney http://opengameart.org/content/platformer-art-complete-pack-often-updated http://opengameart.org/content/puzzle-game-art -http://opengameart.org/content/space-shooter-art
\ No newline at end of file +http://opengameart.org/content/space-shooter-art + +ansimuz +http://opengameart.org/content/country-side-platform-tiles diff --git a/examples/images/country-sky.png b/examples/images/country-sky.png Binary files differnew file mode 100644 index 0000000..9f1f7fc --- /dev/null +++ b/examples/images/country-sky.png diff --git a/examples/images/country-trees.png b/examples/images/country-trees.png Binary files differnew file mode 100644 index 0000000..29a1209 --- /dev/null +++ b/examples/images/country-trees.png diff --git a/examples/shapes.scm b/examples/shapes.scm new file mode 100644 index 0000000..abaf371 --- /dev/null +++ b/examples/shapes.scm @@ -0,0 +1,79 @@ +;;; Sly +;;; Copyright (C) 2015 David Thompson <dthompson2@worcester.edu> +;;; +;;; This program is free software: you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation, either version 3 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see +;;; <http://www.gnu.org/licenses/>. + +(use-modules (sly game) + (sly window) + (sly utils) + (sly signal) + (sly math rect) + (sly math vector) + (sly render) + (sly render camera) + (sly render color) + (sly render shader) + (sly render shape) + (sly render sprite) + (sly render texture)) + +(load "common.scm") + +(define crate-texture + (load-texture "images/crate.png")) + +(define sky-background + (load-sprite "images/country-sky.png")) + +(define forest-background + (load-sprite "images/country-trees.png")) + +(define background + (scale 1/10 + (move (vector3 0 0 -10) + (render-begin + (render-sprite sky-background) + (render-sprite forest-background))))) + +(define unit-cube + (make-cube 1 #:texture crate-texture)) + +(define cubes + (move (vector3 0 0 -3) + (render-begin + (move (vector3 2 0 0) unit-cube) + unit-cube + (move (vector3 -2 0 0) unit-cube)))) + +(define camera + (3d-camera #:area (make-rect 0 0 640 480))) + +(define-signal scene + (signal-let ((rotation (signal-map (lambda (x) (/ x 48)) + (signal-timer)))) + (with-camera camera + (render-begin + background + ;; Spinnin' cubes! + (with-depth-test #t + (rotate-x (* rotation 2) + (rotate-y rotation cubes))))))) + +(with-window (make-window #:title "Shapes!") + (run-game-loop scene)) + +;;; Local Variables: +;;; compile-command: "../pre-inst-env guile shapes.scm" +;;; End: |