Added a bunch of new classes to help implement an inventory and a minimap
This commit is contained in:
BIN
assets/wood.png
BIN
assets/wood.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2.9 KiB |
@@ -4,6 +4,7 @@ import Collector.Main;
|
|||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Input;
|
import com.badlogic.gdx.Input;
|
||||||
import com.badlogic.gdx.graphics.g2d.Animation;
|
import com.badlogic.gdx.graphics.g2d.Animation;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||||
import com.badlogic.gdx.math.Vector3;
|
import com.badlogic.gdx.math.Vector3;
|
||||||
import Collector.Dimension.Chunks;
|
import Collector.Dimension.Chunks;
|
||||||
import Collector.Restrictions;
|
import Collector.Restrictions;
|
||||||
@@ -12,23 +13,23 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
public class InputController implements Restrictions {
|
public class InputController implements Restrictions {
|
||||||
|
|
||||||
private final Player player;
|
private Player player;
|
||||||
int i = 0;
|
private HashMap<String, Animation<TextureAtlas.AtlasRegion>> animations;
|
||||||
private final HashMap<String, Animation<com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion>> animations;
|
|
||||||
private Mouse mouse;
|
private Mouse mouse;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
public InputController(Player player, Mouse mouse) {
|
public InputController(Player player, Mouse mouse) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.mouse = mouse;
|
this.mouse = mouse;
|
||||||
animations = new HashMap<>();
|
animations = new HashMap<>();
|
||||||
animations.put("Up", new Animation<>(1 / 4f, player.textureAtlas.findRegions(player.getSpriteName() + "_" + "Up")));
|
animations.put("Up", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Up")));
|
||||||
animations.put("UpRight", new Animation<>(1 / 4f, player.textureAtlas.findRegions(player.getSpriteName() + "_" + "UpRight")));
|
animations.put("UpRight", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "UpRight")));
|
||||||
animations.put("UpLeft", new Animation<>(1 / 4f, player.textureAtlas.findRegions(player.getSpriteName() + "_" + "UpLeft")));
|
animations.put("UpLeft", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "UpLeft")));
|
||||||
animations.put("Down", new Animation<>(1 / 4f, player.textureAtlas.findRegions(player.getSpriteName() + "_" + "Down")));
|
animations.put("Down", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Down")));
|
||||||
animations.put("DownRight", new Animation<>(1 / 4f, player.textureAtlas.findRegions(player.getSpriteName() + "_" + "DownRight")));
|
animations.put("DownRight", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "DownRight")));
|
||||||
animations.put("DownLeft", new Animation<>(1 / 4f, player.textureAtlas.findRegions(player.getSpriteName() + "_" + "DownLeft")));
|
animations.put("DownLeft", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "DownLeft")));
|
||||||
animations.put("Left", new Animation<>(1 / 4f, player.textureAtlas.findRegions(player.getSpriteName() + "_" + "Left")));
|
animations.put("Left", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Left")));
|
||||||
animations.put("Right", new Animation<>(1 / 4f, player.textureAtlas.findRegions(player.getSpriteName() + "_" + "Right")));
|
animations.put("Right", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Right")));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleInput() {
|
public void handleInput() {
|
||||||
|
|||||||
@@ -1,31 +1,29 @@
|
|||||||
package Collector.Character;
|
package Collector.Character;
|
||||||
|
|
||||||
import Collector.Dimension.BlockMaterials;
|
import Collector.Restrictions;
|
||||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
import Collector.Dimension.Inventory;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
|
||||||
import com.badlogic.gdx.graphics.g2d.Animation;
|
import com.badlogic.gdx.graphics.g2d.Animation;
|
||||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
|
||||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import Collector.Restrictions;
|
|
||||||
|
|
||||||
public class Player implements Restrictions {
|
public class Player implements Restrictions {
|
||||||
public static int x;
|
public static int x;
|
||||||
public static int y;
|
public static int y;
|
||||||
private final String spriteName;
|
private String spriteName;
|
||||||
public TextureAtlas textureAtlas;
|
private TextureAtlas textureAtlas;
|
||||||
private static Animation<TextureAtlas.AtlasRegion> animation;
|
private Animation<TextureAtlas.AtlasRegion> animation;
|
||||||
public static Sprite sprite;
|
private Inventory playerInventory;
|
||||||
|
|
||||||
public Player(OrthographicCamera cam, int x, int y) {
|
public Player(int x, int y) {
|
||||||
|
//Player location
|
||||||
Player.x = x<<TILE_SHIFT;
|
Player.x = x<<TILE_SHIFT;
|
||||||
Player.y = y<<TILE_SHIFT;
|
Player.y = y<<TILE_SHIFT;
|
||||||
|
|
||||||
|
//Player Inventory
|
||||||
|
playerInventory = new Inventory();
|
||||||
|
|
||||||
|
//Player animation
|
||||||
spriteName = "man";
|
spriteName = "man";
|
||||||
|
|
||||||
sprite = new Sprite(new Texture("assets/wood.png"),TILE_SIZE,TILE_SIZE);
|
|
||||||
|
|
||||||
textureAtlas = new TextureAtlas("man.atlas");
|
textureAtlas = new TextureAtlas("man.atlas");
|
||||||
Array<TextureAtlas.AtlasRegion> keyFrames = textureAtlas.findRegions(spriteName + "_Down");
|
Array<TextureAtlas.AtlasRegion> keyFrames = textureAtlas.findRegions(spriteName + "_Down");
|
||||||
float frameDuration = 1 / 4f;
|
float frameDuration = 1 / 4f;
|
||||||
@@ -48,16 +46,23 @@ public class Player implements Restrictions {
|
|||||||
Player.y += y;
|
Player.y += y;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getSpriteName() {
|
public String getSpriteName() {
|
||||||
return spriteName;
|
return spriteName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Animation<TextureAtlas.AtlasRegion> getAnimation() {
|
public Animation<TextureAtlas.AtlasRegion> getAnimation() {
|
||||||
return animation;
|
return animation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAnimation(Animation<TextureAtlas.AtlasRegion> animationTemp) {
|
public void setAnimation(Animation<TextureAtlas.AtlasRegion> animationTemp) {
|
||||||
animation = animationTemp;
|
animation = animationTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void dispose(){
|
||||||
|
textureAtlas.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextureAtlas getTextureAtlas() {
|
||||||
|
return textureAtlas;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
package Collector.Dimension;
|
package Collector.Dimension;
|
||||||
|
|
||||||
import com.github.czyzby.kiwi.util.tuple.immutable.Triple;
|
import com.github.czyzby.kiwi.util.tuple.immutable.Triple;
|
||||||
import Collector.OpenSimplexNoise;
|
import Collector.ThirdPartyCode.OpenSimplexNoise;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ public class Chunks {
|
|||||||
public static OpenSimplexNoise gen1 = new OpenSimplexNoise(SEED + 1);
|
public static OpenSimplexNoise gen1 = new OpenSimplexNoise(SEED + 1);
|
||||||
public static OpenSimplexNoise gen2 = new OpenSimplexNoise(SEED);
|
public static OpenSimplexNoise gen2 = new OpenSimplexNoise(SEED);
|
||||||
|
|
||||||
public static void create() {
|
public static void createStructures() {
|
||||||
int i = 10;
|
int i = 10;
|
||||||
setBlock(3 + i, 2,1,"wall");
|
setBlock(3 + i, 2,1,"wall");
|
||||||
setBlock(4 + i, 2,1,"wall");
|
setBlock(4 + i, 2,1,"wall");
|
||||||
|
|||||||
23
core/src/main/java/Collector/Dimension/Inventory.java
Normal file
23
core/src/main/java/Collector/Dimension/Inventory.java
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package Collector.Dimension;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
|
||||||
|
public class Inventory {
|
||||||
|
private LinkedList<ItemStack> inventory = new LinkedList<ItemStack>();
|
||||||
|
|
||||||
|
public LinkedList<ItemStack> getInventory() {
|
||||||
|
return inventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInventory(LinkedList<ItemStack> inventory) {
|
||||||
|
this.inventory = inventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addItem(Block block){
|
||||||
|
inventory.add((ItemStack) block);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeItem(ItemStack itemStack){
|
||||||
|
inventory.remove(itemStack);
|
||||||
|
}
|
||||||
|
}
|
||||||
14
core/src/main/java/Collector/Dimension/ItemStack.java
Normal file
14
core/src/main/java/Collector/Dimension/ItemStack.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package Collector.Dimension;
|
||||||
|
|
||||||
|
import Collector.Dimension.Block;
|
||||||
|
|
||||||
|
public class ItemStack extends Block {
|
||||||
|
int value;
|
||||||
|
int quantity;
|
||||||
|
|
||||||
|
public ItemStack(String name, int value, int quantity) {
|
||||||
|
super(name);
|
||||||
|
this.value = value;
|
||||||
|
this.quantity = quantity;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,19 +15,20 @@ import Collector.Restrictions;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
public class WorldRenderer implements Restrictions {
|
public class WorldRenderer implements Restrictions {
|
||||||
private final Mouse mouse;
|
private Mouse mouse;
|
||||||
private final InputController inputController;
|
private InputController inputController;
|
||||||
|
private Player player;
|
||||||
|
|
||||||
public WorldRenderer(InputController inputController, Mouse mouse) {
|
public WorldRenderer(InputController inputController, Mouse mouse, Player player) {
|
||||||
this.inputController = inputController;
|
this.inputController = inputController;
|
||||||
this.mouse = mouse;
|
this.mouse = mouse;
|
||||||
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawWorld(Stage stage, int layer) {
|
public void drawWorld(SpriteBatch batch, int layer) {
|
||||||
for (Iterator<Triple<Integer, Integer, Integer>> iterator = Chunks.loadedChunks.keySet().iterator(); iterator.hasNext(); ) {
|
for (Triple<Integer, Integer, Integer> chunkpair : Chunks.loadedChunks.keySet()) {
|
||||||
Triple<Integer, Integer, Integer> chunkpair = iterator.next();
|
|
||||||
if (chunkpair.getThird() == layer) {
|
if (chunkpair.getThird() == layer) {
|
||||||
stage.getBatch().draw(
|
batch.draw(
|
||||||
BlockMaterials.textures.get(Chunks.loadedChunks.get(chunkpair).getName()),
|
BlockMaterials.textures.get(Chunks.loadedChunks.get(chunkpair).getName()),
|
||||||
chunkpair.getFirst() << TILE_SHIFT,
|
chunkpair.getFirst() << TILE_SHIFT,
|
||||||
chunkpair.getSecond() << TILE_SHIFT
|
chunkpair.getSecond() << TILE_SHIFT
|
||||||
@@ -36,21 +37,21 @@ public class WorldRenderer implements Restrictions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mouseCrosshair(Stage stage) {
|
private void mouseCrosshair(SpriteBatch batch) {
|
||||||
Vector3 mousePos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0);
|
Vector3 mousePos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0);
|
||||||
Main.cam.unproject(mousePos);
|
Main.cam.unproject(mousePos);
|
||||||
int x = mouse.getSelectedX(mousePos);
|
int x = mouse.getSelectedX(mousePos);
|
||||||
int y = mouse.getSelectedY(mousePos);
|
int y = mouse.getSelectedY(mousePos);
|
||||||
stage.getBatch().draw(mouse.getCrosshair(), x, y);
|
batch.draw(mouse.getCrosshair(), x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(Stage stage, float timeSinceLastUpdate) {
|
public void render(SpriteBatch batch, float timeSinceLastUpdate) {
|
||||||
//Higher means draws in a lower layer
|
//Higher means draws in a lower layer
|
||||||
drawWorld(stage,0);
|
drawWorld(batch,0);
|
||||||
stage.getBatch().draw(Player.getAnimation().getKeyFrame(timeSinceLastUpdate, true), Player.x, Player.y,TILE_SIZE,TILE_SIZE);
|
batch.draw(player.getAnimation().getKeyFrame(timeSinceLastUpdate, true), Player.x, Player.y,TILE_SIZE,TILE_SIZE);
|
||||||
drawWorld(stage,1);
|
drawWorld(batch,1);
|
||||||
mouseCrosshair(stage);
|
mouseCrosshair(batch);
|
||||||
inputController.handleInput();
|
inputController.handleInput();
|
||||||
stage.getBatch().setProjectionMatrix(stage.getCamera().combined);
|
batch.setProjectionMatrix(Main.cam.combined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import com.badlogic.gdx.graphics.GL30;
|
|||||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
import com.badlogic.gdx.utils.viewport.FitViewport;
|
import com.badlogic.gdx.utils.viewport.ExtendViewport;
|
||||||
import Collector.Character.InputController;
|
import Collector.Character.InputController;
|
||||||
import Collector.Character.Mouse;
|
import Collector.Character.Mouse;
|
||||||
import Collector.Character.Player;
|
import Collector.Character.Player;
|
||||||
@@ -20,7 +20,7 @@ public class Main extends ApplicationAdapter {
|
|||||||
private SpriteBatch batch;
|
private SpriteBatch batch;
|
||||||
private WorldRenderer worldRenderer;
|
private WorldRenderer worldRenderer;
|
||||||
private GUI gui;
|
private GUI gui;
|
||||||
private FitViewport fitViewport;
|
private ExtendViewport extendViewport;
|
||||||
public static float chunkLoadingTime = 0;
|
public static float chunkLoadingTime = 0;
|
||||||
float playerAnimationTime = 0f; //accumulator
|
float playerAnimationTime = 0f; //accumulator
|
||||||
public static OrthographicCamera cam;
|
public static OrthographicCamera cam;
|
||||||
@@ -32,18 +32,22 @@ public class Main extends ApplicationAdapter {
|
|||||||
@Override
|
@Override
|
||||||
public void create () {
|
public void create () {
|
||||||
Gdx.graphics.setWindowedMode(1024, 576);
|
Gdx.graphics.setWindowedMode(1024, 576);
|
||||||
|
|
||||||
|
//Declaring all objects needed for the game
|
||||||
cam = new OrthographicCamera(VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
|
cam = new OrthographicCamera(VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
|
||||||
fitViewport = new FitViewport(VIEWPORT_WIDTH, VIEWPORT_HEIGHT, cam);
|
extendViewport = new ExtendViewport(VIEWPORT_WIDTH, VIEWPORT_HEIGHT, cam);
|
||||||
mouse = new Mouse();
|
mouse = new Mouse();
|
||||||
gui = new GUI(fitViewport);
|
player = new Player(0, 0);
|
||||||
player = new Player(cam, 0, 0);
|
|
||||||
inputController = new InputController(player,mouse);
|
inputController = new InputController(player,mouse);
|
||||||
worldRenderer = new WorldRenderer(inputController,mouse);
|
worldRenderer = new WorldRenderer(inputController,mouse,player);
|
||||||
batch = new SpriteBatch();
|
batch = new SpriteBatch();
|
||||||
stage = new Stage(fitViewport,batch);
|
stage = new Stage();
|
||||||
|
gui = new GUI(stage);
|
||||||
|
|
||||||
|
Gdx.input.setInputProcessor(stage);
|
||||||
|
|
||||||
BlockMaterials.create();
|
BlockMaterials.create();
|
||||||
Chunks.create();
|
Chunks.createStructures();
|
||||||
|
|
||||||
//cam.translate(TILE_SIZE, TILE_SIZE);
|
//cam.translate(TILE_SIZE, TILE_SIZE);
|
||||||
cam.zoom = 25f;
|
cam.zoom = 25f;
|
||||||
@@ -62,9 +66,11 @@ public class Main extends ApplicationAdapter {
|
|||||||
playerAnimationTime += deltaTime;
|
playerAnimationTime += deltaTime;
|
||||||
chunkLoadingTime += deltaTime;
|
chunkLoadingTime += deltaTime;
|
||||||
|
|
||||||
|
gui.debugInfo(stage,mouse);
|
||||||
|
|
||||||
stage.act(deltaTime);
|
stage.act(deltaTime);
|
||||||
stage.getBatch().begin();
|
batch.begin();
|
||||||
worldRenderer.render(stage,playerAnimationTime);
|
worldRenderer.render(batch,playerAnimationTime);
|
||||||
|
|
||||||
if (chunkLoadingTime > RENDER_TIME) {
|
if (chunkLoadingTime > RENDER_TIME) {
|
||||||
chunkLoadingTime -= RENDER_TIME;
|
chunkLoadingTime -= RENDER_TIME;
|
||||||
@@ -72,10 +78,8 @@ public class Main extends ApplicationAdapter {
|
|||||||
World.unloadChunks();
|
World.unloadChunks();
|
||||||
}
|
}
|
||||||
|
|
||||||
stage.getCamera().update();
|
cam.update();
|
||||||
gui.render();
|
batch.end();
|
||||||
stage.getBatch().end();
|
|
||||||
|
|
||||||
stage.draw();
|
stage.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +87,8 @@ public class Main extends ApplicationAdapter {
|
|||||||
@Override
|
@Override
|
||||||
public void dispose () {
|
public void dispose () {
|
||||||
gui.dispose();
|
gui.dispose();
|
||||||
player.textureAtlas.dispose();
|
player.dispose();
|
||||||
stage.dispose();
|
stage.dispose();
|
||||||
|
batch.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package Collector;/*
|
package Collector.ThirdPartyCode;/*
|
||||||
* OpenSimplex Noise in Java.
|
* OpenSimplex Noise in Java.
|
||||||
* by Kurt Spencer
|
* by Kurt Spencer
|
||||||
*
|
*
|
||||||
@@ -1,34 +1,52 @@
|
|||||||
package Collector.UI;
|
package Collector.UI;
|
||||||
|
|
||||||
|
import Collector.Character.Mouse;
|
||||||
|
import Collector.Main;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.files.FileHandle;
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||||
|
import com.badlogic.gdx.math.Vector3;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
import com.badlogic.gdx.utils.Align;
|
||||||
import com.badlogic.gdx.utils.viewport.FitViewport;
|
import com.badlogic.gdx.utils.viewport.ExtendViewport;
|
||||||
import Collector.Restrictions;
|
import Collector.Restrictions;
|
||||||
|
|
||||||
public class GUI implements Restrictions {
|
public class GUI implements Restrictions {
|
||||||
private final Stage stage;
|
|
||||||
private final BitmapFont font;
|
private final BitmapFont font;
|
||||||
|
private ExtendViewport guiViewport;
|
||||||
|
private final Table table;
|
||||||
|
private final Label label;
|
||||||
|
|
||||||
public GUI(FitViewport fitViewport) {
|
public GUI(Stage stage) {
|
||||||
|
|
||||||
font = new BitmapFont();
|
font = new BitmapFont();
|
||||||
stage = new Stage(fitViewport);
|
table = new Table();
|
||||||
|
table.setDebug(true);
|
||||||
|
guiViewport = new ExtendViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight(),stage.getCamera());
|
||||||
|
stage.setViewport(guiViewport);
|
||||||
|
|
||||||
|
//Creating block selection debug menu
|
||||||
|
|
||||||
|
table.top().left();
|
||||||
|
label = new Label("x=N/A y=N/A", new Label.LabelStyle(font,Color.WHITE));
|
||||||
|
table.add(label);
|
||||||
|
|
||||||
|
//Creating Minimap
|
||||||
|
|
||||||
Label label = new Label("Start", new Label.LabelStyle(font, new Color(Color.WHITE)));
|
|
||||||
|
|
||||||
Gdx.input.setInputProcessor(stage);
|
|
||||||
stage.addActor(label);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render() {
|
public void debugInfo(Stage stage, Mouse mouse){
|
||||||
stage.act();
|
table.setFillParent(true);
|
||||||
stage.draw();
|
stage.addActor(table);
|
||||||
|
|
||||||
|
//Mouse position
|
||||||
|
Vector3 mousePos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0);
|
||||||
|
Main.cam.unproject(mousePos);
|
||||||
|
int x = mouse.getSelectedX(mousePos) >> TILE_SHIFT;
|
||||||
|
int y = mouse.getSelectedY(mousePos) >> TILE_SHIFT;
|
||||||
|
label.setText("x="+ x + " y=" + y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose(){
|
public void dispose(){
|
||||||
|
|||||||
4
core/src/main/java/Collector/UI/InventoryInterface.java
Normal file
4
core/src/main/java/Collector/UI/InventoryInterface.java
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
package Collector.UI;
|
||||||
|
|
||||||
|
public class InventoryInterface {
|
||||||
|
}
|
||||||
5
core/src/main/java/Collector/UI/MiniMap.java
Normal file
5
core/src/main/java/Collector/UI/MiniMap.java
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package Collector.UI;
|
||||||
|
|
||||||
|
public class MiniMap {
|
||||||
|
|
||||||
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2.9 KiB |
Reference in New Issue
Block a user