stuff
This commit is contained in:
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx;
|
|||||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
|
import com.badlogic.gdx.maps.tiled.TiledMapTile;
|
||||||
import netwerkprog.game.util.graphics.Renderable;
|
import netwerkprog.game.util.graphics.Renderable;
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
|
|
||||||
@@ -22,6 +23,8 @@ public class MapRenderer implements Renderable {
|
|||||||
public static TextureRegion WALL_TILE;
|
public static TextureRegion WALL_TILE;
|
||||||
public static TextureRegion PATH_TILE;
|
public static TextureRegion PATH_TILE;
|
||||||
|
|
||||||
|
private TextureRegion[][] sprites;
|
||||||
|
|
||||||
|
|
||||||
public MapRenderer(Map map, int tileWidth, SpriteBatch batch, OrthographicCamera camera) {
|
public MapRenderer(Map map, int tileWidth, SpriteBatch batch, OrthographicCamera camera) {
|
||||||
this.map = map;
|
this.map = map;
|
||||||
@@ -35,10 +38,12 @@ public class MapRenderer implements Renderable {
|
|||||||
private void makeTiles() {
|
private void makeTiles() {
|
||||||
Texture texture = new Texture(Gdx.files.internal(tilePath));
|
Texture texture = new Texture(Gdx.files.internal(tilePath));
|
||||||
TextureRegion[][] tiles = TextureRegion.split(texture, 32, 32);
|
TextureRegion[][] tiles = TextureRegion.split(texture, 32, 32);
|
||||||
|
|
||||||
FLOOR_TILE = tiles[1][6];
|
FLOOR_TILE = tiles[1][6];
|
||||||
WALL_TILE = tiles[0][4];
|
WALL_TILE = tiles[0][4];
|
||||||
PATH_TILE = tiles[4][6];
|
PATH_TILE = tiles[4][6];
|
||||||
|
|
||||||
|
this.sprites = new TextureRegion[map.getHeight()][map.getWidth()];
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTileWidth() {
|
public int getTileWidth() {
|
||||||
@@ -92,4 +97,8 @@ public class MapRenderer implements Renderable {
|
|||||||
cam.update();
|
cam.update();
|
||||||
batch.setProjectionMatrix(cam.combined);
|
batch.setProjectionMatrix(cam.combined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TextureRegion[][] getSprites() {
|
||||||
|
return sprites;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.OrthographicCamera;
|
|||||||
import com.badlogic.gdx.math.MathUtils;
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
import com.badlogic.gdx.utils.TimeUtils;
|
import com.badlogic.gdx.utils.TimeUtils;
|
||||||
import netwerkprog.game.client.MainGame;
|
import netwerkprog.game.client.MainGame;
|
||||||
|
import netwerkprog.game.util.application.InputTransform;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -119,6 +120,8 @@ public class GameInputProcessor implements InputProcessor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
|
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
|
||||||
|
float pointerX = InputTransform.getCursorToModelX((int)game.getScreenWidth(), (int)game.getScreenWidth(),screenX);
|
||||||
|
float pointerY = InputTransform.getCursorToModelY((int)game.getScreenHeight(),(int)game.getScreenHeight(),screenY);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
20
core/src/netwerkprog/game/client/map/Tile.java
Normal file
20
core/src/netwerkprog/game/client/map/Tile.java
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package netwerkprog.game.client.map;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
|
|
||||||
|
public class Tile {
|
||||||
|
private TextureRegion textureRegion;
|
||||||
|
private int xPos;
|
||||||
|
private int yPos;
|
||||||
|
|
||||||
|
public Tile(TextureRegion textureRegion, int xPos, int yPos) {
|
||||||
|
this.textureRegion = textureRegion;
|
||||||
|
this.xPos = xPos;
|
||||||
|
this.yPos = yPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains(int x, int y) {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user