From 46544b7dba0081f22e686f70c606a338c7fa52dd Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 21 Sep 2015 19:44:10 -0400 Subject: render: Reimplement rendering engine using functional combinators. Warning: This is a huge commit. I completely gutted the old scene graph and replaced it with a somewhat monadic rendering combinator module instead. The interface remains purely functional, but replaces the data type with procedures in the rendering monad instead. This opens the door for rendering *anything*, not just meshes. Now I can implement particle systems and other non-static things. --- examples/simple.scm | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'examples/simple.scm') diff --git a/examples/simple.scm b/examples/simple.scm index e4de293..0f3760b 100644 --- a/examples/simple.scm +++ b/examples/simple.scm @@ -1,5 +1,5 @@ ;;; Sly -;;; Copyright (C) 2013, 2014 David Thompson +;;; Copyright (C) 2013, 2014, 2015 David Thompson ;;; ;;; This program is free software: you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as @@ -19,22 +19,23 @@ (sly window) (sly utils) (sly signal) + (sly math rect) (sly math vector) + (sly render) (sly render camera) - (sly render model) - (sly render sprite) (sly render color) - (sly render scene)) + (sly render shader) + (sly render sprite) + (sly render texture)) (load "common.scm") -(define model - (model-move (vector2 320 240) - (load-sprite "images/p1_front.png"))) - -(define camera (orthographic-camera 640 480)) +(define sprite (load-sprite "images/p1_front.png")) -(define-signal scene (make-scene camera model)) +(define-signal scene + (with-camera (2d-camera #:area (make-rect 0 0 640 480)) + (move (vector2 320 240) + (render-sprite sprite)))) (with-window (make-window #:title "Simple Sprite Demo") (run-game-loop scene)) -- cgit v1.2.3