Chanka Posted November 21, 2019 Share Posted November 21, 2019 (edited) Anyone having luck with drawing text on the UI? I have already seen an example for it in the SDK but that has not done anything when I try to adapt my code. Here's the function I'm trying to use to test it. void draw_text(char* str,float x, float y) { UI::SET_TEXT_SCALE(0.2, 0.2); UI::SET_TEXT_COLOR_RGBA(255, 255, 255, 255); UI::SET_TEXT_CENTRE(1); UI::SET_TEXT_DROPSHADOW(0, 0, 0, 0, 0); UI::DRAW_TEXT(GAMEPLAY::CREATE_STRING(10, "LITERAL_STRING", str), x, y); } I tried it by calling it once and calling it every frame possible, still did not appear on the screen Edited November 21, 2019 by Chanka Link to comment Share on other sites More sharing options...
Saltyq Posted November 24, 2019 Share Posted November 24, 2019 (edited) Post snippet of where you're calling it? Note that x/y is percentage based relative to your screen, ranging 0-1. You can use 1920x1080 as a base and do this to convert that: void draw_text(char* str,float x, float y) { float fX = x / (float)1920 float fY = y / (float)1080 UI::SET_TEXT_SCALE(0.2, 0.2); UI::SET_TEXT_COLOR_RGBA(255, 255, 255, 255); UI::SET_TEXT_CENTRE(1); UI::SET_TEXT_DROPSHADOW(0, 0, 0, 0, 0); UI::DRAW_TEXT(GAMEPLAY::CREATE_STRING(10, "LITERAL_STRING", str), fX, fY); // dont forget to change the x/y here too } It's also frame by frame, so make sure you're calling in loop. Edited November 24, 2019 by Saltyq 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