It's kinda weird how it works. It is implemented weirdly. If you do it normally.
t
.CharacterSize = 100;t
.Position = new Vector2f
(200,
200);......Draw.drawRectangle(w, gBounds, Color
.Yellow);w
.Draw(new Vertex
[] { new Vertex
(new Vector2f
(0,
200), Color
.White),
new Vertex
(new Vector2f
(900,
200), Color
.White) }, PrimitiveType
.Lines);w
.Draw(t
); And here is what it looks like. As you can see there is some white space at the top. And the getGlobalBounds() returns not 200, 200 but 201, 224. That's because of the empty space at the top. If you notice the getLocanBounds() x and y are 1, 24. So you can use that to position it properly. IDK why the it doesn't do it right the first time.
Here is what I use to position it properly.
t
.CharacterSize = 100;setPosition
(t,
new Vector2f
(200,
200));......public void setPosition
(Text text, Vector2f pos
){ Vector2f offsets
= new Vector2f
(text
.GetLocalBounds().Left, text
.GetLocalBounds().Top); text
.Position = new Vector2f
(pos
.X - offsets
.X, pos
.Y - offsets
.Y);} And here is what it looks like.