public class GameView extends View implements GameManager
Constructor and Description |
---|
GameView() |
Modifier and Type | Method and Description |
---|---|
protected void |
addCamera(Camera camera)
Add a camera.
|
static void |
classInit()
Shoud be called before the object get initialized.
|
void |
drawString(java.lang.String msg,
int xPos,
int yPos,
boolean openbatch)
Draw a string using the last active color.
|
void |
drawString(java.lang.String msg,
int xPos,
int yPos,
com.badlogic.gdx.graphics.Color color)
Draw a string in a color.
|
void |
drawText(java.lang.String text,
int xPos,
int yPos,
com.badlogic.gdx.graphics.Color color)
Draw multi-lines with this method
|
void |
enter()
Should be called when the manager becomes active.
|
com.badlogic.gdx.graphics.g2d.SpriteBatch |
getBatch()
Game view dependent batch
|
java.util.ArrayList<Camera> |
getCameras()
Returns a camera.
|
Controller |
getController() |
float |
getEqualizationScale()
The equalizationScale is a factor which scales the GUI/HUD to have the same relative size with different resolutions.
|
LoadMenu |
getLoadMenu()
Get a menu which can be used for loading maps.
|
com.badlogic.gdx.graphics.glutils.ShapeRenderer |
getShapeRenderer() |
com.badlogic.gdx.scenes.scene2d.Stage |
getStage()
The libGDX scene2d stage
|
void |
init(Controller controller)
Loades some files and set up everything.
|
boolean |
isInitalized() |
void |
onEnter()
override to specify what should happen when the mangager becomes active
|
void |
render()
Main method which is called every time and renders everything.
|
void |
resize(int width,
int height)
should be called when the window get resized
|
Point |
screenToGameFlat(int x,
int y)
Returns deepest layer
|
Intersection |
screenToGameRaytracing(int x,
int y)
Returns the position belonging to a point on the screen.
|
float |
screenXtoGame(int x,
Camera camera)
Reverts the perspective and transforms it into a coordiante which can be used in the game logic.
|
float |
screenYtoGame(int y,
Camera camera)
Reverts the projection and transforms it into a coordiante which can be used in the game logic.
|
void |
update(float delta)
Updates every camera and everything else which must be updated.
|
getOrientation, getShader, init, setOrientation
public static void classInit()
public void init(Controller controller)
controller
- public void update(float delta)
delta
- time since last update in ms.public void render()
public float getEqualizationScale()
public float screenXtoGame(int x, Camera camera)
x
- the x position on the screencamera
- the camera where the position is onpublic float screenYtoGame(int y, Camera camera)
y
- the y position on the screen. y downcamera
- the camera where the position is onpublic Point screenToGameFlat(int x, int y)
x
- y
- public Intersection screenToGameRaytracing(int x, int y)
x
- the x position on the screeny
- the y position on the screenpublic void drawString(java.lang.String msg, int xPos, int yPos, boolean openbatch)
msg
- xPos
- yPos
- openbatch
- treu if begin/end shoould be calledpublic void drawString(java.lang.String msg, int xPos, int yPos, com.badlogic.gdx.graphics.Color color)
msg
- xPos
- yPos
- color
- public void drawText(java.lang.String text, int xPos, int yPos, com.badlogic.gdx.graphics.Color color)
text
- xPos
- space from leftyPos
- space from topcolor
- the colro of the text.public com.badlogic.gdx.graphics.glutils.ShapeRenderer getShapeRenderer()
getShapeRenderer
in class View
public Controller getController()
public java.util.ArrayList<Camera> getCameras()
public LoadMenu getLoadMenu()
protected void addCamera(Camera camera)
camera
- public void resize(int width, int height)
width
- height
- public com.badlogic.gdx.scenes.scene2d.Stage getStage()
public com.badlogic.gdx.graphics.g2d.SpriteBatch getBatch()
public boolean isInitalized()
isInitalized
in interface GameManager
public void onEnter()
onEnter
in interface GameManager
public final void enter()
GameManager
GameManager.onEnter()
.enter
in interface GameManager
GameManager.onEnter()