diff --git a/core/src/sagittarius/model/MouseInfo.java b/core/src/sagittarius/model/MouseInfo.java index 1793788..a5f77b9 100644 --- a/core/src/sagittarius/model/MouseInfo.java +++ b/core/src/sagittarius/model/MouseInfo.java @@ -1,29 +1,25 @@ package sagittarius.model; -import com.badlogic.gdx.graphics.g2d.Batch; -import com.badlogic.gdx.graphics.g2d.BitmapFont; -import com.badlogic.gdx.scenes.scene2d.Actor; - import sagittarius.view.GameScreen; -public class MouseInfo extends Actor { +public class MouseInfo extends BaseActor { -// ---------- ATTRIBUTEs ---------- - - private BitmapFont font = new BitmapFont(); // ---------- METHODs ---------- @Override - public void draw(Batch batch, float parentAlpha) { - super.draw(batch, parentAlpha); - - font.draw(batch, "screen=" + (int)GameScreen.screenCursor.x + "," + (int)GameScreen.screenCursor.y, - GameScreen.worldCursor.x, GameScreen.worldCursor.y + font.getCapHeight()); - - font.draw(batch, "world=" + (int)GameScreen.worldCursor.x + "," + (int)GameScreen.worldCursor.y, - GameScreen.worldCursor.x, GameScreen.worldCursor.y + font.getCapHeight()*2); + public void act(float delta) { + super.act(delta); + setX(GameScreen.worldCursor.x); + setY(GameScreen.worldCursor.y); + } + @Override + protected String getInfo() { + return + "screen=" + (int)GameScreen.screenCursor.x + "," + (int)GameScreen.screenCursor.y + "\n" + + "world=" + (int)GameScreen.worldCursor.x + "," + (int)GameScreen.worldCursor.y + ; } } diff --git a/core/src/sagittarius/view/BaseScreen.java b/core/src/sagittarius/view/BaseScreen.java index 696ee4f..7e29a1b 100644 --- a/core/src/sagittarius/view/BaseScreen.java +++ b/core/src/sagittarius/view/BaseScreen.java @@ -6,10 +6,10 @@ import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.Screen; public abstract class BaseScreen implements Screen { - + protected Stage mainStage; protected Stage uiStage; - + public BaseScreen() { mainStage = new Stage(); uiStage = new Stage(); @@ -18,26 +18,26 @@ public abstract class BaseScreen implements Screen { public abstract void initialize(); public abstract void update(float dt); - + @Override public void render(float dt) { - + + // update + update(dt); + // update Stages uiStage.act(dt); mainStage.act(dt); - - // update - update(dt); // clear screen Gdx.gl.glClearColor(0,0,0,1); Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT); - + // draw actors on screnn mainStage.draw(); uiStage.draw(); } - + @Override public void dispose() { uiStage.dispose(); mainStage.dispose(); diff --git a/core/src/sagittarius/view/GameScreen.java b/core/src/sagittarius/view/GameScreen.java index 90c313c..401dd12 100644 --- a/core/src/sagittarius/view/GameScreen.java +++ b/core/src/sagittarius/view/GameScreen.java @@ -59,6 +59,7 @@ public class GameScreen extends BaseScreen { uiStage.addActor(mouseInfo); mainStage.setDebugAll(true); // TODO: disable later + uiStage.setDebugAll(true); // TODO: disable later }