Fer anyone one with OCD that can't stand the text not being centre justified

It bothered me that the text was not centre justified so I sought a way to solve the issue.

There is a function to return the width value of text to be used in raylib’s DrawText(), its MeasureText(). I am not sure why it only evaluates and returns the width value, but its something at least.

// WIN THE GAME
int textWinGame = MeasureText(“You Won!”, 60);
DrawText(“You Won!”, (WindowDimensions[0] / 2) - (textWinGame / 2), WindowDimensions[1] / 2, 60, GREEN);

If we had used DrawTextEx(), it looks like MeasureTextEx() returns the width and height values.

4 Likes

Thanks for that!, that issue was bothering me a little bit :sweat_smile:

OCD Gang gather up!
Just kidding, this is more of a Graphic Design Principles thing than OCD thing.
Thank you.

Privacy & Terms