Rev 1055 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
package com.gebauz.darts2go.gamestates;
import com.gebauz.bauzoid.game.Game;
import com.gebauz.bauzoid.gamestates.BaseGameState;
import com.gebauz.darts2go.GameConsts;
import com.gebauz.darts2go.game.GameLogic;
public class MainGameState
extends BaseGameState
{
private GameLogic mGameLogic =
null;
public MainGameState
(Game game
)
{
super(game
);
setFading
(true,
true);
mGameLogic =
new GameLogic
(game
);
}
@
Override
public void initAsync
(String param
)
{
mGameLogic.
initAsync();
}
@
Override
public void init
(String param
)
{
mGameLogic.
init();
/*com.gebauz.bauzoid.graphics.sprite.SpriteParameters p1 = new com.gebauz.bauzoid.graphics.sprite.SpriteParameters();
p1.x = 3;
p1.y = 5;
p1.w = 13;
p1.h = 10;
p1.pivotX = 2;
p1.pivotY = 5;
p1.angle = 21.5f;
p1.mirrorX = false;
p1.mirrorY = false;
Matrix4 t = p1.getTransform();
float tX = 5;
float tY = 2;
Vector2 test1 = p1.spriteToWorld(tX, tY);
Vector4 test2 = t.transform(new Vector4(tX, tY, 0, 1));
Gdx.app.log("", "--------------");
Gdx.app.log("", "P1: " + test1.x + ", " + test1.y);
Gdx.app.log("", "P2: " + test2.x + ", " + test2.y + ", " + test2.z + ", " + test2.w);
Gdx.app.log("", "---");
// transform back
Vector2 backTest1 = p1.worldToSprite(test1.x, test1.y);
Vector4 backTest2 = t.getInverse().transform(new Vector4(test2.x, test2.y, 0, 1));
Gdx.app.log("", "Orig: " + tX + ", " + tY);
Gdx.app.log("", "RevTest1: " + backTest1.x + ", " + backTest1.y);
Gdx.app.log("", "RevTest2: " + backTest2.x + ", " + backTest2.y + ", " + backTest2.z + ", " + backTest2.w);
Gdx.app.log("", "--------------");*/
}
@
Override
public void exit
()
{
if (mGameLogic
!=
null)
{
mGameLogic.
exit();
mGameLogic =
null;
}
}
@
Override
public void update
(float deltaTime
)
{
mGameLogic.
update(deltaTime
);
}
@
Override
public void render
()
{
getGraphics
().
clear(0,
0,
0, 0.0f
);
getRenderStates
().
projection.
setOrtho(
0.0f,
GameConsts.
VIRTUAL_SCREEN_WIDTH-
1,
GameConsts.
VIRTUAL_SCREEN_HEIGHT-
1,
0.0f,
0.0f,
1.0f
);
mGameLogic.
render();
}
}