ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Home
Upgrade
Credits
Help
Search
Awards
Achievements
 2217

[Question] drawText(const char *text, int font, float x, float y, float scaleX, float

by GHOSTED - 03-15-2019 - 03:36 PM
#1
Can someone explain how it works with the float XY and ScaleXY? I do not really understand that
DISCORD: xexghosted
Reply
#2
Its very simple kinda self explanatory...float x and float y are the position on the screen for example if x and y are set equal to 0.5f the text will be in the center of the screen.

float scaleX and float scaleY are the scale/size of the text

even you only know basic c++ it would take very little time and effort to work that out
Reply
#3
(03-15-2019 - 04:37 PM)Justtestingit Wrote: Its very simple kinda self explanatory...float x and float y are the position on the screen for example if x and y are set equal to 0.5f the text will be in the center of the screen.

float scaleX and float scaleY are the scale/size of the text

even you only know basic c++ it would take very little time and effort to work that out

Shit you don't even need basic c++ knowledge to know the x/y cords. lol. You learn about that shit in fkn pre school lol. Same concept just on-screen
Reply
#4
So their's your area to work with, by default COD's max res is 1280x720:
Width (x): 1280
Height (y): 720

The way you're writing that function, is a little over-done imo.

You could simplify it to something like:
Code:
void drawStr(const char *str, float x, float y, float fontSize, float *color, char *font) {
R_AddCmdDrawText(str, 0x7FFFFFFF, R_RegisterFont(font, 0), x, y, fontSize, fontSize, 0, color, 0);
}

Usage:
Code:
drawStr("My Awesome String", 1280 / 2 - 140, 720 / 2 - 360, 0.65, colWhite, "fonts/smallFont");

Hope this gave some extra insight :)
Reply
#5
(03-15-2019 - 11:00 PM)Dread Wrote: So their's your area to work with, by default COD's max res is 1280x720:
Width (x): 1280
Height (y): 720

The way you're writing that function, is a little over-done imo.

You could simplify it to something like:
Code:
void drawStr(const char *str, float x, float y, float fontSize, float *color, char *font) {
R_AddCmdDrawText(str, 0x7FFFFFFF, R_RegisterFont(font, 0), x, y, fontSize, fontSize, 0, color, 0);
}

Usage:
Code:
drawStr("My Awesome String", 1280 / 2 - 140, 720 / 2 - 360, 0.65, colWhite, "fonts/smallFont");

Hope this gave some extra insight :)


Ok looks simple,
Thanks <3
DISCORD: xexghosted
Reply

Users browsing: 2 Guest(s)