[Sneak Peek] Graphics User Interface For SA-MP (using Textdraws)
#1

Hello guys, I'll show you a little bit of my upcoming release.
Thanks to the Clickable Textdraws by SA-MP Team!

The GUI System is made of three Main parts:
  • The Designing part (bit like CSS)
  • The Creation part (Initial creations of the elements)
  • The Callback processing part. (Where you deal with player's clicks, items etc..)
This code:
pawn Код:
DESIGN(numericupdown)
    @COLOR(0xFFFFFF22)
    @BGCOLOR(0x00000066)
    @FONTCOLOR(0xFFFFFFFF)
DESIGNe

DESIGN(window)
    @COLOR(0x00E03422)
    @BGCOLOR(0x00000066)
    @FONTCOLOR(0xFFFFFFFF)
    @SIZE(320, 190)
    @LOCATION(160, 200)
DESIGNe

DESIGN(button)
    @BGCOLOR(0x444444AA)
DESIGNe

new ControlPanel;

public OnFilterScriptInit()
{
    ControlPanel =
    CreateWindow(window, "Filthy & Dirty Privillages");
   
    CreateNumericUpDown(ControlPanel, numericupdown, "numeric_weather", 0, 0, 1, 100, 170, 220);
    CreateButton(ControlPanel, button, "Set Weather", "setweather", 170, 240, 100, 23);
   
    CreateNumericUpDown(ControlPanel, numericupdown, "numeric_time", 0, 0, 1, 23, 170, 275);
    CreateButton(ControlPanel, button, "Set Time", "settime", 170, 295, 100, 23);
   
    CreateNumericUpDown(ControlPanel, numericupdown, "numeric_car", 400, 400, 1, 611, 170, 325);
    CreateButton(ControlPanel, button, "Spawn Car", "spawncar", 170, 345, 100, 23);
   
    CreateNumericUpDown(ControlPanel, numericupdown, "numeric_money", 0, -10000, 500, 10000, 290, 220);
    CreateButton(ControlPanel, button, "Give Money", "givemoney", 290, 240, 100, 23);
   
    CreateNumericUpDown(ControlPanel, numericupdown, "numeric_score", 0, -1000, 50, 1000, 290, 275);
    CreateButton(ControlPanel, button, "Give Score", "givescore", 290, 295, 100, 23);
   
    return true;
}

public OnPlayerClickButton(playerid, Event[])
{
    if(!strcmp(Event, "setweather"))
    return SetWeather(GetNumericValue(playerid, "numeric_weather"));
   
    if(!strcmp(Event, "settime"))
    return SetWorldTime(GetNumericValue(playerid, "numeric_time"));
   
    if(!strcmp(Event, "spawncar"))
    {
        if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "You already have a car!");
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        new VID = CreateVehicle(GetNumericValue(playerid, "numeric_car"), X, Y, Z, 0, -1, -1, 0);
        PutPlayerInVehicle(playerid, VID, 0);
        return true;
    }
   
    if(!strcmp(Event, "givemoney"))
    return GivePlayerMoney(playerid, GetNumericValue(playerid, "numeric_money"));
   
    if(!strcmp(Event, "givescore"))
    return SetPlayerScore(playerid, GetPlayerScore(playerid) + GetNumericValue(playerid, "numeric_score"));
   
    return true;
}
Does this:
[ame]http://www.youtube.com/watch?v=iWKkRTb-C-I[/ame]

Features:
Designing the Elements are made easy, some examples:

pawn Код:
DESIGN
    @COLOR()
    @BGCOLOR()
    @BGIMAGE()
    @FONT()
    @FONTOUTLINE()
    @FONTCOLOR()
    @FONTSHADOW()
    @FONTSIZEX()
    @FONTSIZEY()
    @FONTSIZE(x,y)
    @SIZE(x,y)
    @HEIGHT()
    @WIDTH()
    @LOCATION(x,y)
    @LOCATIONX()
    @LOCATIONY()
DESIGNc

//and more to come....
To-do:
  • CreateListBox
  • CreatePanel
  • CreateImageBox
  • CreateCheckBox
  • Sliders, Dropdown lists, ...
  • More Callbacks: OnCheckBoxStateChange, OnPlayerChooseItem, etc..
  • And much more..
Tell me how is it and what you would like to see in it!
Reply
#2

Looks pretty useful. Great work, can't wait for the release!
Reply
#3

It actually looks really good. I'm looking forward to use this if and when you release it. Although you should've posted this in the Screenshots section. Very good work.
Reply
#4

Ofcourse.
Reply
#5

So awesome!
Reply
#6

The clickable textdraw thingy is great, I'm pretty sure it'll let people experience SA-MP the way they never did before. Good luck on the project, I'll try to make some of my own ideas as well
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)