Skip to content

Commit

Permalink
DemoCube: Toggle between new and old timing options with TAB
Browse files Browse the repository at this point in the history
This demonstrates the potential effects of part-cw#330 nicely both in
terms of slow refreshs and also the decaying behavior
  • Loading branch information
mgorges committed Oct 1, 2020
1 parent f0b69b1 commit 15446ca
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions apps/DemoCube/main.scm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;; rotating cube example

(define alpha 0.)
(define alphaincrement 0.5)
(define alphaincrement 1.)
(define beta 30.)
(define betaincrement 0.)

Expand Down Expand Up @@ -95,6 +95,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(set! alphaincrement (- alphaincrement))
(set! betaincrement (- betaincrement)))

(define legacy-time #f)

(main
;; initialization
(lambda (w h)
Expand All @@ -110,8 +112,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(glCore-registerhook render-custom)
)
;; events
(lambda (t x y)
(if (= t EVENT_KEYPRESS) (begin
(lambda (t x y)
(if (= t EVENT_KEYPRESS) (begin
(if (= x EVENT_KEYTAB)
(begin
(if legacy-time
(glgui-timings-set! frame-period-max: 0.5 frame-period-min: 0.05)
(glgui-timings-at-10msec!)
)
(set! legacy-time (not legacy-time))
))
(if (= x EVENT_KEYESCAPE) (terminate))))
(glgui-event gui t x y)
)
Expand Down

0 comments on commit 15446ca

Please sign in to comment.