Created
March 22, 2021 14:22
-
-
Save tk3/e53a3141c352c9ebe3e99d273f3db870 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
name := "kata01" | |
version := "0.1" | |
scalaVersion := "2.13.5" | |
libraryDependencies ++= Seq ( | |
"com.badlogicgames.gdx" % "gdx-backend-lwjgl" % "1.9.12", | |
"com.badlogicgames.gdx" % "gdx-platform" % "1.9.12" classifier "natives-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
import com.badlogic.gdx.backends.lwjgl.{LwjglApplication, LwjglApplicationConfiguration} | |
object DesktopLauncher extends App { | |
val config = new LwjglApplicationConfiguration | |
new LwjglApplication(new MyGdxGame, config) | |
} |
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
import com.badlogic.gdx.graphics.g2d.SpriteBatch | |
import com.badlogic.gdx.graphics.{GL20, Texture} | |
import com.badlogic.gdx.{ApplicationAdapter, Gdx} | |
class MyGdxGame extends ApplicationAdapter { | |
lazy val batch = new SpriteBatch | |
lazy val img = new Texture("assets/hello.png") | |
override def create(): Unit = {} | |
override def render(): Unit = { | |
Gdx.gl.glClearColor(1, 0, 0, 1) | |
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT) | |
batch.begin() | |
batch.draw(img, 0, 0) | |
batch.end() | |
} | |
override def clone(): Unit = { | |
img.dispose() | |
batch.dispose() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment