rvmod Posted July 8, 2015 Share Posted July 8, 2015 The title says it all. Link to comment Share on other sites More sharing options...
DaBOSS54320 Posted July 8, 2015 Share Posted July 8, 2015 Here's my way of printing text... for this you'll need to include the <cstdio> header for the sprintf function. In initialization: char text[100]; In a loop: sprintf(text,"Text in the center of the screen"); UI::SET_TEXT_CENTRE(TRUE); UI::SET_TEXT_SCALE(0.5f,0.5f); UI::SET_TEXT_COLOUR(255,255,255,255); UI::_SET_TEXT_ENTRY("STRING"); UI::_ADD_TEXT_COMPONENT_STRING(text); UI::_DRAW_TEXT(0.5f,0.5f); The key parts of that for drawing it in the center of the screen are drawing the text in 0.5f,0.5f (the center) and also using the SET_TEXT_CENTRE function to have it be center aligned. rvmod 1 Link to comment Share on other sites More sharing options...
rvmod Posted July 8, 2015 Author Share Posted July 8, 2015 Here's my way of printing text... for this you'll need to include the <cstdio> header for the sprintf function. In initialization: char text[100]; In a loop: sprintf(text,"Text in the center of the screen"); UI::SET_TEXT_CENTRE(TRUE); UI::SET_TEXT_SCALE(0.5f,0.5f); UI::SET_TEXT_COLOUR(255,255,255,255); UI::_SET_TEXT_ENTRY("STRING"); UI::_ADD_TEXT_COMPONENT_STRING(text); UI::_DRAW_TEXT(0.5f,0.5f); The key parts of that for drawing it in the center of the screen are drawing the text in 0.5f,0.5f (the center) and also using the SET_TEXT_CENTRE function to have it be center aligned. The text just vanishes, just after a millisecond. Link to comment Share on other sites More sharing options...
frodzet Posted July 8, 2015 Share Posted July 8, 2015 (edited) The text just vanishes, just after a millisecond. He just told you to put it in a loop.. It's displayed every tick. Edited July 8, 2015 by frodzet Link to comment Share on other sites More sharing options...
rvmod Posted July 8, 2015 Author Share Posted July 8, 2015 Here's my way of printing text... for this you'll need to include the <cstdio> header for the sprintf function. In initialization: char text[100]; In a loop: sprintf(text,"Text in the center of the screen"); UI::SET_TEXT_CENTRE(TRUE); UI::SET_TEXT_SCALE(0.5f,0.5f); UI::SET_TEXT_COLOUR(255,255,255,255); UI::_SET_TEXT_ENTRY("STRING"); UI::_ADD_TEXT_COMPONENT_STRING(text); UI::_DRAW_TEXT(0.5f,0.5f); The key parts of that for drawing it in the center of the screen are drawing the text in 0.5f,0.5f (the center) and also using the SET_TEXT_CENTRE function to have it be center aligned. How to shift my text a little upwards (on the Y axis)? Link to comment Share on other sites More sharing options...
ImMatt Posted July 8, 2015 Share Posted July 8, 2015 (edited) Here's my way of printing text... for this you'll need to include the <cstdio> header for the sprintf function. In initialization: char text[100]; In a loop: sprintf(text,"Text in the center of the screen"); UI::SET_TEXT_CENTRE(TRUE); UI::SET_TEXT_SCALE(0.5f,0.5f); UI::SET_TEXT_COLOUR(255,255,255,255); UI::_SET_TEXT_ENTRY("STRING"); UI::_ADD_TEXT_COMPONENT_STRING(text); UI::_DRAW_TEXT(0.5f,0.5f); The key parts of that for drawing it in the center of the screen are drawing the text in 0.5f,0.5f (the center) and also using the SET_TEXT_CENTRE function to have it be center aligned. How to shift my text a little upwards (on the Y axis)? On the UI::_DRAW_TEXT(0.5f,0.5f); change the second 0.5f to lets just say 1.0f, that will make it higher. Just play around with the numbers and see what you like. Edited July 8, 2015 by ImMatt rvmod 1 Link to comment Share on other sites More sharing options...
DaBOSS54320 Posted July 8, 2015 Share Posted July 8, 2015 ^ I believe that's the wrong way actually... I think 0.0f is the top. The origin is the top left, a positive X coordinate goes to the right, and a positive Y coordinate goes down. Colata 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now