Skip to content

Commit

Permalink
GdxSetup: Update generated main class to look more modern
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyperion committed Feb 28, 2024
1 parent 7bed7d3 commit aef2c9a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
package %PACKAGE%;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.ScreenUtils;

public class %MAIN_CLASS% extends ApplicationAdapter {
SpriteBatch batch;
Texture img;
float imgPosX;
float imgPosY;

@Override
public void create () {
batch = new SpriteBatch();
img = new Texture("badlogic.jpg");
img = new Texture("logo_dark.png");
imgPosX = (Gdx.graphics.getWidth() - img.getWidth()) / 2f;
imgPosY = (Gdx.graphics.getHeight() - img.getHeight()) / 2f;
}

@Override
public void render () {
ScreenUtils.clear(1, 0, 0, 1);
ScreenUtils.clear(0.14f, 0.14f, 0.14f, 1);
batch.begin();
batch.draw(img, 0, 0);
batch.draw(img, imgPosX, imgPosY);
batch.end();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public void build (ProjectBuilder builder, String outputDir, String appName, Str
}

// Assets
project.files.add(new ProjectFile("assets/badlogic.jpg", assetPath + "/badlogic.jpg", false));
project.files.add(new ProjectFile("assets/logo_dark.png", assetPath + "/logo_dark.png", false));

// android project
if (builder.modules.contains(ProjectType.ANDROID)) {
Expand Down

0 comments on commit aef2c9a

Please sign in to comment.