Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.dermetfan.someLibgdxTests;
- import com.badlogic.gdx.graphics.Texture;
- public abstract class Assets {
- public static Texture player, ball, something;
- public static void load() {
- player = new Texture("img/player.png");
- ball = new Texture("img/ball.png");
- something = new Texture("img/something.png");
- }
- public static void dispose() {
- player.dispose();
- ball.dispose();
- something.dispose();
- }
- }
- // loading and disposing
- public class MyLibgdxGame extends Game {
- @Override
- public void create() {
- Assets.load();
- }
- // ...
- @Override
- public void dispose() {
- super.dispose();
- Assets.dispose();
- }
- }
- // usage is simple:
- public class IUseAssets {
- public void inThisMethod() {
- int width = Assets.player.getWidth();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment