Textdraw box size
#1

Hi, I made a health bar for serversided health system. It looks exactly like the real health bar on 1280 x 800 resolution, but when I change the resolution to a smaller one it becomes narrower.
1280 x 800 - https://gyazo.com/736f5cfa5df33a457ccb9319967bf3d0
800 x 600 - https://gyazo.com/97b89fb5909d93b584276f1d73263151
On lower resolutions it looks really bad because I need it to cover the original health and armor bar.
However if I create the health bar with progress bars v2 include then it becomes a little bit bigger when I change the resolution, but it still looks a lot better than if it gets smaller.
This the code:
Код:
Textdraw0[playerid] = CreatePlayerTextDraw(playerid, 610.000000, 68.700012, "that's the black box behind everything");
PlayerTextDrawLetterSize(playerid, Textdraw0[playerid], 0.000000, 0.492222);
PlayerTextDrawTextSize(playerid, Textdraw0[playerid], 544.500000, 0.000000);
PlayerTextDrawAlignment(playerid, Textdraw0[playerid], 1);
PlayerTextDrawColor(playerid, Textdraw0[playerid], 0);
PlayerTextDrawUseBox(playerid, Textdraw0[playerid], true);
PlayerTextDrawBoxColor(playerid, Textdraw0[playerid], 255);
PlayerTextDrawSetShadow(playerid, Textdraw0[playerid], 0);
PlayerTextDrawSetOutline(playerid, Textdraw0[playerid], 0);
PlayerTextDrawFont(playerid, Textdraw0[playerid], 0);

Textdraw1[playerid] = CreatePlayerTextDraw(playerid, 608.000000, 70.939971, "this is the darker red part which is behind the box that fills it");
PlayerTextDrawLetterSize(playerid, Textdraw1[playerid], 0.000000, 0.067777);
PlayerTextDrawTextSize(playerid, Textdraw1[playerid], 546.500000, 0.000000);
PlayerTextDrawAlignment(playerid, Textdraw1[playerid], 1);
PlayerTextDrawColor(playerid, Textdraw1[playerid], 0);
PlayerTextDrawUseBox(playerid, Textdraw1[playerid], true);
PlayerTextDrawBoxColor(playerid, Textdraw1[playerid], (0xB4191DFF & 0xFFFFFF00) | (0x66 & ((0xB4191DFF & 0x000000FF) / 2)));
PlayerTextDrawSetShadow(playerid, Textdraw1[playerid], 0);
PlayerTextDrawSetOutline(playerid, Textdraw1[playerid], 0);
PlayerTextDrawFont(playerid, Textdraw1[playerid], 0);

Textdraw2[playerid] = CreatePlayerTextDraw(playerid, 608.000000, 70.939971, "this is what fills the dark red box");
PlayerTextDrawLetterSize(playerid, Textdraw2[playerid], 0.000000, 0.067777);
PlayerTextDrawTextSize(playerid, Textdraw2[playerid], 546.500000, 0.000000);
PlayerTextDrawAlignment(playerid, Textdraw2[playerid], 1);
PlayerTextDrawColor(playerid, Textdraw2[playerid], 0);
PlayerTextDrawUseBox(playerid, Textdraw2[playerid], true);
PlayerTextDrawBoxColor(playerid, Textdraw2[playerid], 0xB4191DFF);
PlayerTextDrawSetShadow(playerid, Textdraw2[playerid], 0);
PlayerTextDrawSetOutline(playerid, Textdraw2[playerid], 0);
PlayerTextDrawFont(playerid, Textdraw2[playerid], 0);
Is there anything I can do about it?
Reply
#2

Use only integer values for position, e.g. 69.0 instead of 68.7. This ensures best compatibility. Also 1280x800 is a 16:10 aspect ratio while 800x600 is a 4:3 ratio. You may need to use GetPlayerCameraAspectRatio to get it just right, but I think it ought to work without it as well.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
Use only integer values for position, e.g. 69.0 instead of 68.7. This ensures best compatibility. Also 1280x800 is a 16:10 aspect ratio while 800x600 is a 4:3 ratio. You may need to use GetPlayerCameraAspectRatio to get it just right, but I think it ought to work without it as well.
OK, I tried integers for positions, but that didn't help. Well, I think I'll just stick to the progress bars include then.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)