![]() |
Hello, how can I fix the resolution problem?
Code: Код: Код:
pFont->Print("Hello, this is a test!", D3DCOLOR_ARGB(255, 255, 255, 0), 500, 500, false);Screenshots: 1024x768: http://host-it.tk/Upload/5527f0d63c5cc/sa_mp_007.png 1920x1080: http://host-it.tk/Upload/5527f0d6a1e78/sa_mp_005.png |
int Resolution[2];
SF->getGame()->getScreenResolution(&Resolution[0], &Resolution[1]); Font->Print("Hello, this is a test!", D3DCOLOR_ARGB(255, 255, 255, 0), Resolution[0] / 2, Resolution[1] / 2, false); |
in the center
char buf[32] = "Hello, this is a test!"; Font->Print(buf, D3DCOLOR_ARGB(255, 255, 255, 0), Resolution[0] / 2 - Font->DrawLenght(buf, false) / 2, Resolution[1] / 2 - Font->DrawHeight()/2, false); |
But u can use Game coordinates and then convert to Window coords/
|
Цитата:
|
My problem is:
I draw a box (my "coordinates") Код: Код:
SF->getRender()->DrawBorderedBox(1300, 700, 600, 300, D3DCOLOR_ARGB(255, 0, 0, 0), 3, D3DCOLOR_ARGB(50, 255, 255, 255));But... how can convert for every screen resolution? @SR_team @Dark_Knight /edit: My solution.. (not the best :D ) Код: Код:
int Resolution[2]; |
Код:
[CODE] int resolution[2]; SF->getGame()->getScreenResolution(&resolution[0], &resolution[1]); kX = resolution[0] / 640; kY = resolution[1] / 448; SF->getRender()->DrawBorderedBox(pos1 * kX, pos2 * kY, size1 * kX, size2 * kY, D3DCOLOR_ARGB(255, 0, 0, 0), 3, D3DCOLOR_ARGB(50, 255, 255, 255)); // 0 |
[QUOTE="spiceman"]
Код: [CODE] int resolution[2]; SF->getGame()->getScreenResolution(&resolution[0], &resolution[1]); kX = resolution[0] / 640; kY = resolution[1] / 448; SF->getRender()->DrawBorderedBox(pos1 * kX, pos2 * kY, size1 * kX, size2 * kY, D3DCOLOR_ARGB(255, 0, 0, 0), 3, D3DCOLOR_ARGB(50, 255, 255, 255)); // 0 |
Цитата:
ведь k = resolution / game_resolution = point / game_point допустим, мое разрешение экрана 1440x900, мне нужно нарисовать в центре точку. середина по горизонтали по игровым координатам = 320px k = 1440 / 640 = 2.25 x = k * 320 = 720 ( 1440 / 2 = 720 ) 1440 / 640 = 720 / 320 = 2.25 |
| Время: 02:45 |