Updates
HabboRails
- Remade the entire GUI Engine.
- Fixed Window Flickering
- Improved code to be ported to Mac later.
- Fixed Window backbuffer.
Before - LoadControlData:
Code:
for(int i = 0; i < keyvalue.GetMapValue().count(); i++)
{
std::string key = keys[i];
KeyValueData kvd = keyvalue.GetMapValue().get(key);
if(kvd.GetType() == String || kvd.GetType() == Object) // prop
{
if(key == "ControlName" && kvd.GetStringValue() == "Frame")
{
//control = (Control*)&CreateFrame();
//Sleep(1000);
control = new CBasicFrame();
control->SetText("oi");
}
else if(key == "ControlName" && parent)
{
std::string controlName = kvd.GetStringValue();
if(controlName == "Label")
{
control = new Label();
}
else if(controlName == "Button")
{
control = new Button();
}
else if(controlName == "TextEntry")
{
control = new TextEntry();
}
else if(controlName == "FadePanel" || controlName == "PropertySheet")
{
control = new CFadePanel();
}
else if(controlName == "ListView")
{
control = new ListView();
}
if(control && index != 0)
parent->AddControl(control);
}
else if(key == "ControlName?" && parent)
{
//CFadePanel c;
Control* c = new CFadePanel();
//((Control*)this)->AddControl(c);
parent->AddControl(c);
c->SetLocation(Point(10, 36));
c->SetSize(Size(100, 100));
control = c;
//((Control*)this)->AddControl((Control*)&c);
///((Control*)&frame)->AddControl((Control*)&c);
//((Control*)&c)->SetLocation(Point(10, 36));
//((Control*)&c)->SetSize(Size(100, 100));
//CFadePanel c;
//control = (Control*)&CFadePanel();
//parent->AddControl(c);
//c.CreateHandle(parent->hwnd);
//parent->AddControl((Control*)&c);
//control = (Control*)&c;
//Sleep(1000);
}
else if(key == "xpos" && parent && control && control->ready)
{
Gdiplus::Point p = control->GetLocation();
control->SetLocation(Gdiplus::Point(parseInt((char*)kvd.GetStringValue().c_str()), control->Y));
}
else if(key == "ypos" && parent && control && control->ready)
{
Gdiplus::Point p = control->GetLocation();
control->SetLocation(Gdiplus::Point(control->X, parseInt((char*)kvd.GetStringValue().c_str())));
}
else if(key == "wide" && parent && control && control->ready)
{
Gdiplus::Size s = control->GetSize();
control->SetSize(Gdiplus::Size(parseInt((char*)kvd.GetStringValue().c_str()), s.Height));
}
else if(key == "visible" && control && control->ready)
{
int cmd = SW_SHOWDEFAULT;
if(kvd.GetStringValue() == "0")
cmd = SW_HIDE;
ShowWindow(control->hwnd, cmd);
}
else if(key == "tall" && parent && control && control->ready)
{
Gdiplus::Size s = control->GetSize();
control->SetSize(Gdiplus::Size(s.Width, parseInt((char*)kvd.GetStringValue().c_str())));
}
else if(key == "fieldName" && parent && control && control->ready)
{
control->Name = kvd.GetStringValue();
}
/*else if(key == "textAlignment")
{
((Label*)control)->
}*/
if(control)
control->SetProperty(key, kvd);
}
else // subframe
{
Control* subcontrol = this->ParseControl(control, kvd, i);
}
}
After - LoadControlData:
Code:
KeyValues* ourForm = kv->GetValue(pathName);
if(ourForm)
{
int controlCount = 0;
char** keys = ourForm->GetKeys(controlCount);
for(int i = 0; i < controlCount; i++)
{
char* key = keys[i];
KeyValues* controlData = ourForm->GetValue(key);
if(strcmp(key, "styles") == 0)
{
delete keys[i];
continue;
}
int paramCount = 0;
char** params = controlData->GetKeys(paramCount);
Element* element = 0;
for(int j = 0; j < paramCount; j++)
{
char* param = params[j];
//char* value = controlData->GetString(param);
if(strcmp(param, "ControlName") == 0)
{
element = this->CreateElementByName(controlData->GetString(param));
}
if(element)
{
element->SetProp(param, controlData->GetValue(param));
element->SetElementProp(param, controlData->GetValue(param));
}
delete [] params[j];
}
if(element)
this->AddElement(element);
delete [] params;
delete [] keys[i];
}
delete [] keys;
}
Still need to fix some memory leaks and make the other core controls (there's only Button, TextEntry, Label and ProgressBar)

@Kaan2106
I'm glad to see you like Atom, thanks.
It has no GUI too.