From f921f922c059854bdac04fa7f6bfe18062cb95d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laure=CE=B7t?= Date: Fri, 9 Apr 2021 14:55:03 +0200 Subject: [PATCH] feat: added cursor coordinates diplay --- core/src/sagittarius/model/MouseInfo.java | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 core/src/sagittarius/model/MouseInfo.java diff --git a/core/src/sagittarius/model/MouseInfo.java b/core/src/sagittarius/model/MouseInfo.java new file mode 100644 index 0000000..20b67f0 --- /dev/null +++ b/core/src/sagittarius/model/MouseInfo.java @@ -0,0 +1,31 @@ +package sagittarius.model; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.graphics.g2d.BitmapFont; +import com.badlogic.gdx.scenes.scene2d.Actor; + +import sagittarius.SagittariusGame; +import sagittarius.view.GameScreen; + +public class MouseInfo extends Actor { + +// ---------- 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); + + } + +}