Switch to Kotlin
This commit is contained in:
@ -1,33 +0,0 @@
|
||||
package me.msoucy.ptures;
|
||||
|
||||
import com.badlogic.gdx.ApplicationAdapter;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
|
||||
public class PTures extends ApplicationAdapter {
|
||||
SpriteBatch batch;
|
||||
Texture img;
|
||||
|
||||
@Override
|
||||
public void create () {
|
||||
batch = new SpriteBatch();
|
||||
img = new Texture("badlogic.jpg");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render () {
|
||||
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
|
||||
public void dispose () {
|
||||
batch.dispose();
|
||||
img.dispose();
|
||||
}
|
||||
}
|
30
core/src/me/msoucy/ptures/PTures.kt
Normal file
30
core/src/me/msoucy/ptures/PTures.kt
Normal file
@ -0,0 +1,30 @@
|
||||
package me.msoucy.ptures
|
||||
|
||||
import com.badlogic.gdx.ApplicationAdapter
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.GL20
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
|
||||
class PTures : ApplicationAdapter() {
|
||||
internal lateinit var batch: SpriteBatch
|
||||
internal lateinit var img: Texture
|
||||
|
||||
override fun create() {
|
||||
batch = SpriteBatch()
|
||||
img = Texture("badlogic.jpg")
|
||||
}
|
||||
|
||||
override fun render() {
|
||||
Gdx.gl.glClearColor(1f, 0f, 0f, 1f)
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||
batch.begin()
|
||||
batch.draw(img, 0f, 0f)
|
||||
batch.end()
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
batch.dispose()
|
||||
img.dispose()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user