gamejam2024/core/src/com/monjaro/gamejam/Game.java

48 lines
878 B
Java
Raw Normal View History

2024-04-20 12:58:06 +01:00
package com.monjaro.gamejam;
import com.badlogic.gdx.ApplicationAdapter;
2024-04-20 14:40:06 +01:00
import com.badlogic.gdx.Gdx;
2024-04-20 12:58:06 +01:00
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.ScreenUtils;
public class Game extends ApplicationAdapter {
2024-04-20 14:40:06 +01:00
private SpriteBatch batch;
private Texture img;
private static int TICKS_PER_SECOND;
private double tickProgress = 0;
2024-04-20 12:58:06 +01:00
@Override
2024-04-20 14:40:06 +01:00
public void create() {
2024-04-20 12:58:06 +01:00
batch = new SpriteBatch();
img = new Texture("badlogic.jpg");
}
2024-04-20 14:40:06 +01:00
public void tick() {
}
2024-04-20 12:58:06 +01:00
@Override
2024-04-20 14:40:06 +01:00
public void render() {
Gdx.graphics.getDeltaTime();
while (tickProgress >= 1) { //tick as many times as needed
tick();
tickProgress--;
}
2024-04-20 12:58:06 +01:00
ScreenUtils.clear(1, 0, 0, 1);
batch.begin();
batch.draw(img, 0, 0);
batch.end();
}
@Override
2024-04-20 14:40:06 +01:00
public void dispose() {
2024-04-20 12:58:06 +01:00
batch.dispose();
img.dispose();
}
2024-04-20 14:40:06 +01:00
2024-04-20 12:58:06 +01:00
}