PDA

View Full Version : SelectTextDraw - TextDraws in same line(bug?)


CyNiC
03/04/2012, 04:16 PM
Firstly, I use TextDrawTextSize + TextDrawSetSelectable and each word is one textdraw.

I have a problem with horizontal textdraws(columns), just the first column works, I can't figure out how to make the another columns selectable.

On the first image is alright, my cursor is over the first column.
http://img403.imageshack.us/img403/681/samp054vz.png
In this another, my cursor is over the second column.
http://img849.imageshack.us/img849/8727/samp055su.png

for(new col = 0; col < 7; col++)
{
for(new i = 0; i < 15; i++)
{
HColName[col][i] = CreatePlayerTextDraw(playerid, HColPos[col][0], HColPos[col][1], "/Comando");
PlayerTextDrawBackgroundColor(playerid, HColName[col][i], 255);
PlayerTextDrawFont(playerid, HColName[col][i], 2);
PlayerTextDrawLetterSize(playerid, HColName[col][i], 0.180000, 1.200000);
PlayerTextDrawColor(playerid, HColName[col][i], -1);
PlayerTextDrawSetOutline(playerid, HColName[col][i], 0);
PlayerTextDrawSetProportional(playerid, HColName[col][i], 1);
PlayerTextDrawSetShadow(playerid, HColName[col][i], 1);
PlayerTextDrawTextSize(playerid, HColName[col][i], 50.000000, 10.000000);
PlayerTextDrawSetSelectable(playerid, HColName[col][i], 1);
PlayerTextDrawShow(playerid, HColName[col][i]);
}
}

Hiddos
03/04/2012, 04:38 PM
Are they really not selectable or does the color not change when you hover over them? Textdraws not lighting up usually has something to do with (Player)TextDrawTextSize, even though it seems pretty correct.

CyNiC
03/04/2012, 04:56 PM
Is really not selectable, I clicked in everything, just worked for the first one.
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
print("test");
return 1;
}

Psymetrix
03/04/2012, 05:21 PM
Try this;

for(new col = 0; col < 7; col++)
{
for(new i = 0; i < 15; i++)
{
HColName[col][i] = CreatePlayerTextDraw(playerid, HColPos[col][0], HColPos[col][1], "/Comando");
PlayerTextDrawBackgroundColor(playerid, HColName[col][i], 255);
PlayerTextDrawFont(playerid, HColName[col][i], 2);
PlayerTextDrawLetterSize(playerid, HColName[col][i], 0.180000, 1.200000);
PlayerTextDrawColor(playerid, HColName[col][i], -1);
PlayerTextDrawSetOutline(playerid, HColName[col][i], 0);
PlayerTextDrawSetProportional(playerid, HColName[col][i], 1);
PlayerTextDrawSetShadow(playerid, HColName[col][i], 1);
PlayerTextDrawTextSize(playerid, HColName[col][i], HColPos[col][0] + 50.000000, 10.000000);
PlayerTextDrawSetSelectable(playerid, HColName[col][i], 1);
PlayerTextDrawShow(playerid, HColName[col][i]);
}
}

Using on-screen-keyboard so I can't really explain.

CyNiC
03/04/2012, 05:42 PM
It works and I already knew, but using large text size the previous columns are highlighted too.

Cursor on the third column:
http://img72.imageshack.us/img72/9371/samp056ck.png

EDIT:

Now it works perfectly, I remade the calculations, for each column the textsize X was duplicated, thank you, Psymetrix.

for(new cmdid = 1, col, i, str[10]; cmdid < MAX_COMMANDS; cmdid++)
{
format(str, sizeof str, "cmd_%d", cmdid);
if(dini_Isset("comandos.brz", str))
{
if(i) HColName[col][i] = CreatePlayerTextDraw(playerid, HColPos[col][0], HColPos[col][1] + float(i) * 12, dini_Get("comandos.brz", str));
else HColName[col][i] = CreatePlayerTextDraw(playerid, HColPos[col][0], HColPos[col][1], dini_Get("comandos.brz", str));
PlayerTextDrawBackgroundColor(playerid, HColName[col][i], 80);
PlayerTextDrawFont(playerid, HColName[col][i], 2);
PlayerTextDrawLetterSize(playerid, HColName[col][i], 0.23000, 1.200000);
PlayerTextDrawColor(playerid, HColName[col][i], -1);
PlayerTextDrawSetOutline(playerid, HColName[col][i], 1);
PlayerTextDrawSetProportional(playerid, HColName[col][i], 1);
PlayerTextDrawTextSize(playerid, HColName[col][i], 70.000000 + float(col) * 70.0, 15.000000);
PlayerTextDrawSetSelectable(playerid, HColName[col][i], 1);
PlayerTextDrawShow(playerid, HColName[col][i]);
i++;
if(i == 10) col++, i = 0;
continue;
}
break;
}