Closed zacherysun closed 3 years ago
You can draw text with the render::text()
function (call in PaintTraverse hook). You can hard code the width to get it to the left or right of the screen or you can use get_screen_size(int& width, int& height)
and then subtract the size of the text from the width and draw it there (might require some guessing). You can also get the screen width and height through the directx device and then even draw the text through directx which is arguably better when it comes to performance, but that would require an EndScene or Present hook.
int width;
int height;
interfaces::surface->get_screen_size(width, height);
render::text(width - 10 /*10 for example, subtract size of text*/, 10, /*font*/, "text", true, /*color*/ );
Thanks
Wrong! (but not at all)
Use get_screen_size
with get_text_size
right to left: screen_width - text_width
middle: screen_width - text_width / 2
Wrong! (but not at all)
Use
get_screen_size
withget_text_size
right to left:
screen_width - text_width
middle:screen_width - text_width / 2
int w, h;
std::string text = "your text";
render::text(w - render::get_text_size(render::fonts::watermark_font, text).x - 10, 10, render::fonts::watermark_font, text, false, color::white());
Wrong! (but not at all) Use
get_screen_size
withget_text_size
right to left:screen_width - text_width
middle:screen_width - text_width / 2
int w, h; std::string text = "your text"; render::text(w - render::get_text_size(render::fonts::watermark_font, text).x - 10, 10, render::fonts::watermark_font, text, false, color::white());
where's get_screen_size... but yeah, that's how you use it.
So does anyone know how to align text to the left(right to left)?
example