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 |
dispose()
should be called if removed from memory
|
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.
|
void |
exit()
Should get called when you leave the editor.
|
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.
|
int |
getOrientation()
Get the current orientation.
|
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
|
Intersection |
screenToGame(int x,
int y)
Returns the approximated game position belonging to a point on the screen.
|
Point |
screenToGameBasic(int x,
int y)
Returns deepest layer.
|
float |
screenXtoView(int screenX,
Camera camera)
Reverts the perspective and transforms it into a coordiante which can be used in the game logic.
|
float |
screenYtoView(int screenY,
Camera camera)
Reverts the projection and transforms it into a coordinate which can be used in the game logic.
|
void |
setOrientation(int orientation)
Set the new value for the current orientation.
|
void |
update(float dt)
Updates every camera and everything else which must be updated.
|
int |
viewToScreenX(int x,
Camera camera)
Not a homomorphism, which means f(a*b) !
|
int |
viewToScreenY(int y,
Camera camera)
Not a homomorphism, which means f(a*b) !
|
debugRendering, getShader, init, loadShaders
public static void classInit()
public void init(Controller controller)
controller
- public void update(float dt)
dt
- time since last update in ms.public void render()
public float getEqualizationScale()
public int getOrientation()
public void setOrientation(int orientation)
orientation
- 0 front, 1 from right, 2 from behind, 3 from left, 4 - undefinedpublic float screenXtoView(int screenX, Camera camera)
screenX
- the x position on the screencamera
- the camera where the position is onpublic float screenYtoView(int screenY, Camera camera)
screenY
- the y position on the screen. y-upcamera
- the camera where the position is onpublic Point screenToGameBasic(int x, int y)
x
- screen spacey
- screen space. y-uppublic Intersection screenToGame(int x, int y)
x
- the x position on the screen from lefty
- the y position on the screen from toppublic int viewToScreenX(int x, Camera camera)
x
- view spacecamera
- public int viewToScreenY(int y, Camera camera)
y
- view spacecamera
- public void drawString(java.lang.String msg, int xPos, int yPos, boolean openbatch)
msg
- xPos
- screen spaceyPos
- screen spaceopenbatch
- true if begin/end shoould be calledpublic void drawString(java.lang.String msg, int xPos, int yPos, com.badlogic.gdx.graphics.Color color)
msg
- xPos
- screen spaceyPos
- screen spacecolor
- 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()
public void exit()
GameManager
exit
in interface GameManager
public void dispose()
GameManager
dispose
in interface GameManager