Question on Map rendering #642
Replies: 1 comment
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022). |
Beta Was this translation helpful? Give feedback.
-
This post has been migrated automatically from the old LITIENGINE forum (2018 - 2022).
Posted: 2019-01-24 17:09:47
User: Gamebuster19901 [] (age: 1386 days 🔥; posts: 1)
How do I get things to render from the top left of the screen? Both my map and some text I'm trying to render are rendering relative to the center.
Also, how do I reduce the size of my map, it's rendering way too large.
It's rendering like this:
https://i.imgur.com/gm9RzCL.png
Map:
https://i.imgur.com/ReXkeMK.png
Screen source code:
`
```javapackage com.gamebuster19901.pewds.gui.screens;import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.util.Random;
import com.gamebuster19901.pewds.util.resource.ResourceManager;
import com.gamebuster19901.pewds.util.resource.ResourceLocation;
import de.gurkenlabs.litiengine.Game;
import de.gurkenlabs.litiengine.gui.screens.GameScreen;
public class MainMenu extends GameScreen{
private final Font font = ResourceManager.getFont(new ResourceLocation("VT323")).deriveFont(32f);
private final Random random = new Random();
String text = "THIS IS SOME TEST TEXT";
int i = 0;
@OverRide
public void render(Graphics2D graphics) {
super.render(graphics);
graphics.setFont(font);
graphics.setColor(Color.RED);
Game.graphics().renderText(graphics, text.substring(0, (i % text.length()) + 1), i % 100, i % 100);
graphics.setColor(new Color(random.nextInt()));
Game.graphics().renderText(graphics, "Top Left?", 0,0);
i++;
}
}````
Beta Was this translation helpful? Give feedback.
All reactions