Last active
December 20, 2015 19:08
-
-
Save noisesmith/6180538 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns clojure.gdx.myscreen | |
(:import (com.badlogic.gdx Gdx Screen) | |
(com.badlogic.gdx.scenes.scene2d Stage) | |
(com.badlogic.gdx.scenes.scene2d.ui Label Label$LabelStyle) | |
(com.badlogic.gdx.graphics Color) | |
(com.badlogic.gdx.graphics.g2d BitmapFont) | |
(com.badlogic.gdx.graphics.g2d SpriteBatch))) | |
(declare ^Stage stage) | |
(defn allocate [] | |
(let [sprites (SpriteBatch.) font (BitmapFont.)]) | |
(fn [] (.dispose sprite) (.dispose font))) | |
(defn screen [] | |
(let [stage (Stage.) | |
cleanup-memory (allocate)] | |
(proxy [Screen] [] | |
(show [] | |
(let [style (Label$LabelStyle. font (Color. 1.0 1.0 1.0 1.0)) | |
label (Label. "Hello Clojure!" style)] | |
(.addActor stage label))) | |
(render [delta] | |
(doto stage | |
(.act delta) | |
(.draw))) | |
(dispose | |
(cleanup-memory)) | |
(hide []) | |
(pause []) | |
(resize [w h]) | |
(resume [])))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment