mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-08-17 16:57:11 +00:00
Account Manager: Username, Password, Register
Settings: Game Path, Cache Path, Profile Path, Branch Options, Show Console Updated Game logo for dark mode Set icons for Account Manager and Settings windows
This commit is contained in:
parent
20613340ef
commit
f273bc3d90
@ -44,7 +44,6 @@ add_executable(${PROJECT_NAME} WIN32
|
|||||||
src/Logger.cpp include/Logger.h
|
src/Logger.cpp include/Logger.h
|
||||||
src/gui/Gui.cpp
|
src/gui/Gui.cpp
|
||||||
include/Json.h
|
include/Json.h
|
||||||
src/gui/gifs.cpp src/gui/gifs.h
|
|
||||||
src/Network/HttpAPI.cpp include/HttpAPI.h
|
src/Network/HttpAPI.cpp include/HttpAPI.h
|
||||||
src/Network/Server.cpp include/Server.h
|
src/Network/Server.cpp include/Server.h
|
||||||
src/Network/Login.cpp src/Network/Update.cpp
|
src/Network/Login.cpp src/Network/Update.cpp
|
||||||
|
132
src/gui/Gui.cpp
132
src/gui/Gui.cpp
@ -31,7 +31,6 @@ class MyMainFrame : public wxFrame {
|
|||||||
public:
|
public:
|
||||||
MyMainFrame();
|
MyMainFrame();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Here you put the frame functions:
|
// Here you put the frame functions:
|
||||||
bool DarkMode = wxSystemSettings::GetAppearance().IsDark();
|
bool DarkMode = wxSystemSettings::GetAppearance().IsDark();
|
||||||
@ -51,6 +50,9 @@ class MyAccountFrame : public wxFrame {
|
|||||||
private:
|
private:
|
||||||
// Here you put the frame functions:
|
// Here you put the frame functions:
|
||||||
bool DarkMode = wxSystemSettings::GetAppearance().IsDark();
|
bool DarkMode = wxSystemSettings::GetAppearance().IsDark();
|
||||||
|
void OnClickRegister(wxCommandEvent& event);
|
||||||
|
void OnClickLogout(wxCommandEvent& event);
|
||||||
|
wxDECLARE_EVENT_TABLE();
|
||||||
};
|
};
|
||||||
|
|
||||||
/////////// SettingsFrame class ///////////
|
/////////// SettingsFrame class ///////////
|
||||||
@ -67,7 +69,7 @@ class MySettingsFrame : public wxFrame {
|
|||||||
enum { ID_Hello = 1 };
|
enum { ID_Hello = 1 };
|
||||||
|
|
||||||
|
|
||||||
/////////// Event Table ///////////
|
/////////// MainFrame Event Table ///////////
|
||||||
wxBEGIN_EVENT_TABLE(MyMainFrame, wxFrame)
|
wxBEGIN_EVENT_TABLE(MyMainFrame, wxFrame)
|
||||||
EVT_BUTTON(39, MyMainFrame::OnClickAccount)
|
EVT_BUTTON(39, MyMainFrame::OnClickAccount)
|
||||||
EVT_BUTTON(40, MyMainFrame::OnClickSettings)
|
EVT_BUTTON(40, MyMainFrame::OnClickSettings)
|
||||||
@ -75,12 +77,18 @@ wxBEGIN_EVENT_TABLE(MyMainFrame, wxFrame)
|
|||||||
EVT_BUTTON(42, MyMainFrame::OnClickLogo)
|
EVT_BUTTON(42, MyMainFrame::OnClickLogo)
|
||||||
wxEND_EVENT_TABLE()
|
wxEND_EVENT_TABLE()
|
||||||
|
|
||||||
|
/////////// AccountFrame Event Table ///////////
|
||||||
|
wxBEGIN_EVENT_TABLE(MyAccountFrame, wxFrame)
|
||||||
|
EVT_BUTTON(43, MyAccountFrame::OnClickRegister)
|
||||||
|
EVT_BUTTON(44, MyAccountFrame::OnClickLogout)
|
||||||
|
wxEND_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////// OnInit function to show frame ///////////
|
/////////// OnInit function to show frame ///////////
|
||||||
bool MyApp::OnInit() {
|
bool MyApp::OnInit() {
|
||||||
auto* MainFrame = new MyMainFrame();
|
auto* MainFrame = new MyMainFrame();
|
||||||
MainFrame->SetIcon(wxIcon("BeamMP.png",wxBITMAP_TYPE_PNG));
|
MainFrame->SetIcon(wxIcon("beammp_original.png",wxBITMAP_TYPE_PNG));
|
||||||
|
|
||||||
// Set MainFrame properties:
|
// Set MainFrame properties:
|
||||||
MainFrame->SetSize(1000, 650);
|
MainFrame->SetSize(1000, 650);
|
||||||
@ -101,6 +109,10 @@ bool MyApp::OnInit() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isSignedIn () {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/////////// MainFrame Function ///////////
|
/////////// MainFrame Function ///////////
|
||||||
MyMainFrame::MyMainFrame() :
|
MyMainFrame::MyMainFrame() :
|
||||||
wxFrame(nullptr, wxID_ANY, "BeamMP Launcher V3", wxDefaultPosition,wxDefaultSize,
|
wxFrame(nullptr, wxID_ANY, "BeamMP Launcher V3", wxDefaultPosition,wxDefaultSize,
|
||||||
@ -158,7 +170,12 @@ MyMainFrame::MyMainFrame() :
|
|||||||
auto* HorizontalLine3 = new wxStaticLine(this, wxID_ANY, wxPoint(10, 550), wxSize(950, 1));
|
auto* HorizontalLine3 = new wxStaticLine(this, wxID_ANY, wxPoint(10, 550), wxSize(950, 1));
|
||||||
|
|
||||||
/////////// Account ///////////
|
/////////// Account ///////////
|
||||||
auto* bitmap = new wxBitmapButton(this, 39, wxBitmapBundle(wxImage("default.png", wxBITMAP_TYPE_PNG).Scale(45,45, wxIMAGE_QUALITY_HIGH)), wxPoint(20, 560), wxSize(45,45));
|
auto* bitmap = new wxBitmapButton(this, 39, wxBitmapBundle(wxImage("deer.png", wxBITMAP_TYPE_PNG).Scale(45,45, wxIMAGE_QUALITY_HIGH)), wxPoint(20, 560), wxSize(45,45));
|
||||||
|
|
||||||
|
if (isSignedIn())
|
||||||
|
bitmap->SetBitmap(wxBitmapBundle(wxImage("deer.png", wxBITMAP_TYPE_PNG).Scale(45,45, wxIMAGE_QUALITY_HIGH)));
|
||||||
|
else
|
||||||
|
bitmap->SetBitmap(wxBitmapBundle(wxImage("default.png", wxBITMAP_TYPE_PNG).Scale(45,45, wxIMAGE_QUALITY_HIGH)));
|
||||||
|
|
||||||
/////////// Buttons ///////////
|
/////////// Buttons ///////////
|
||||||
auto btnSettings = new wxButton(this, 40, wxT("Settings"), wxPoint(730,570), wxSize(110, 25));
|
auto btnSettings = new wxButton(this, 40, wxT("Settings"), wxPoint(730,570), wxSize(110, 25));
|
||||||
@ -189,7 +206,7 @@ MyMainFrame::MyMainFrame() :
|
|||||||
HorizontalLine3->SetForegroundColour("white");
|
HorizontalLine3->SetForegroundColour("white");
|
||||||
|
|
||||||
//Logo:
|
//Logo:
|
||||||
auto* logo = new wxBitmapButton(this, 42, wxBitmapBundle(wxImage("BeamMPwhite.png", wxBITMAP_TYPE_PNG).Scale(100,100, wxIMAGE_QUALITY_HIGH)), wxPoint(850, -15), wxSize(100,100), wxBORDER_NONE);
|
auto* logo = new wxBitmapButton(this, 42, wxBitmapBundle(wxImage("beammp_original.png", wxBITMAP_TYPE_PNG).Scale(100,100, wxIMAGE_QUALITY_HIGH)), wxPoint(850, -15), wxSize(100,100), wxBORDER_NONE);
|
||||||
logo->SetBackgroundColour(wxColour(40, 40, 40));
|
logo->SetBackgroundColour(wxColour(40, 40, 40));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,13 +225,41 @@ MyAccountFrame::MyAccountFrame() : wxFrame(nullptr, wxID_ANY, "Account Manager",
|
|||||||
wxImage::AddHandler(handler);
|
wxImage::AddHandler(handler);
|
||||||
wxStaticBitmap *image;
|
wxStaticBitmap *image;
|
||||||
image = new wxStaticBitmap( this, wxID_ANY, wxBitmapBundle(wxImage("default.png", wxBITMAP_TYPE_PNG).Scale(120,120, wxIMAGE_QUALITY_HIGH)), wxPoint(180,20), wxSize(120, 120));
|
image = new wxStaticBitmap( this, wxID_ANY, wxBitmapBundle(wxImage("default.png", wxBITMAP_TYPE_PNG).Scale(120,120, wxIMAGE_QUALITY_HIGH)), wxPoint(180,20), wxSize(120, 120));
|
||||||
auto* txtName = new wxStaticText(this, wxID_ANY, wxT("Name: NA"), wxPoint(210, 200));
|
|
||||||
auto btnLogout = new wxButton(this, wxID_ANY, wxT("Logout"), wxPoint(185,550), wxSize(110, 25));
|
|
||||||
|
|
||||||
/////////// UI Colors ///////////
|
if (isSignedIn()) {
|
||||||
if (DarkMode) {
|
image->SetBitmap(wxBitmapBundle(wxImage("deer.png", wxBITMAP_TYPE_PNG).Scale(120,120, wxIMAGE_QUALITY_HIGH)));
|
||||||
//Text:
|
|
||||||
txtName->SetForegroundColour("white");
|
auto* txtName = new wxStaticText(this, wxID_ANY, wxT("Username: BeamMP"), wxPoint(180, 200));
|
||||||
|
auto* txtEmail = new wxStaticText(this, wxID_ANY, wxT("Email: beamMP@gmail.com"), wxPoint(180, 250));
|
||||||
|
auto btnLogout = new wxButton(this, 44, wxT("Logout"), wxPoint(185,550), wxSize(110, 25));
|
||||||
|
|
||||||
|
/////////// UI Colors ///////////
|
||||||
|
if (DarkMode) {
|
||||||
|
//Text:
|
||||||
|
txtName->SetForegroundColour("white");
|
||||||
|
txtEmail->SetForegroundColour("white");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
image->SetBitmap(wxBitmapBundle(wxImage("default.png", wxBITMAP_TYPE_PNG).Scale(120,120, wxIMAGE_QUALITY_HIGH)));
|
||||||
|
|
||||||
|
auto* txtLogin = new wxStaticText(this, wxID_ANY, wxT("Login with your BeamMP account."), wxPoint(150, 200));
|
||||||
|
|
||||||
|
auto* ctrlUsername = new wxTextCtrl (this, wxID_ANY, wxT(""), wxPoint(131, 230), wxSize(220,25));
|
||||||
|
auto* ctrlPassword = new wxTextCtrl (this, wxID_ANY, wxT(""), wxPoint(131, 300), wxSize(220,25), wxTE_PASSWORD);
|
||||||
|
ctrlUsername->SetHint("Username / Email");
|
||||||
|
ctrlPassword->SetHint("Password");
|
||||||
|
|
||||||
|
auto btnLogin = new wxButton(this, wxID_ANY, wxT("Login"), wxPoint(120,375), wxSize(110, 25));
|
||||||
|
auto btnRegister = new wxButton(this, 43, wxT("Register"), wxPoint(250,375), wxSize(110, 25));
|
||||||
|
|
||||||
|
|
||||||
|
/////////// UI Colors ///////////
|
||||||
|
if (DarkMode) {
|
||||||
|
//Text:
|
||||||
|
txtLogin->SetForegroundColour("white");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,23 +268,52 @@ MySettingsFrame::MySettingsFrame() :
|
|||||||
wxFrame(nullptr, wxID_ANY, "Settings", wxDefaultPosition,wxDefaultSize,
|
wxFrame(nullptr, wxID_ANY, "Settings", wxDefaultPosition,wxDefaultSize,
|
||||||
wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX) {
|
wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX) {
|
||||||
|
|
||||||
auto* txtName = new wxStaticText(this, wxID_ANY, wxT("settings1"), wxPoint(200, 200));
|
|
||||||
auto* txtName2 = new wxStaticText(this, wxID_ANY, wxT("settings12"), wxPoint(200, 200));
|
auto* txtDirectory = new wxStaticText(this, wxID_ANY, wxT("Game Directory: "), wxPoint(30, 100));
|
||||||
|
auto* ctrlDirectory = new wxTextCtrl (this, wxID_ANY, wxT("D:/PATH/BeamNG.exe"), wxPoint(130, 100), wxSize(220,20), wxBORDER_NONE);
|
||||||
|
auto* bitmapGame = new wxBitmapButton(this, wxID_ANY, wxBitmapBundle(wxImage("explorer.png", wxBITMAP_TYPE_PNG).Scale(20,20, wxIMAGE_QUALITY_HIGH)), wxPoint(350, 100), wxSize(20,20), wxBORDER_NONE);
|
||||||
|
|
||||||
|
auto* txtProfileDirectory = new wxStaticText(this, wxID_ANY, wxT("Profile Directory: "), wxPoint(30, 175));
|
||||||
|
auto* ctrlProfileDirectory = new wxTextCtrl (this, wxID_ANY, wxT("D:/PATH/BeamNG.exe"), wxPoint(130, 175), wxSize(220,20));
|
||||||
|
auto* bitmapProfile = new wxBitmapButton(this, wxID_ANY, wxBitmapBundle(wxImage("explorer.png", wxBITMAP_TYPE_PNG).Scale(20,20, wxIMAGE_QUALITY_HIGH)), wxPoint(350, 175), wxSize(20,20), wxBORDER_NONE);
|
||||||
|
|
||||||
|
auto* txtCacheDirectory = new wxStaticText(this, wxID_ANY, wxT("Cache Directory: "), wxPoint(30, 250));
|
||||||
|
auto* ctrlCacheDirectory = new wxTextCtrl (this, wxID_ANY, wxT("D:/PATH/Cache"), wxPoint(130, 250), wxSize(220,20));
|
||||||
|
auto* bitmapCache = new wxBitmapButton(this, wxID_ANY, wxBitmapBundle(wxImage("explorer.png", wxBITMAP_TYPE_PNG).Scale(20,20, wxIMAGE_QUALITY_HIGH)), wxPoint(350, 250), wxSize(20,20), wxBORDER_NONE);
|
||||||
|
|
||||||
|
auto* txtBranch = new wxStaticText(this, wxID_ANY, wxT("Branch: "), wxPoint(30, 325));
|
||||||
|
wxArrayString BranchChoices;
|
||||||
|
BranchChoices.Add("Public");
|
||||||
|
BranchChoices.Add("Development");
|
||||||
|
BranchChoices.Add("Early Access");
|
||||||
|
auto* choiceController = new wxChoice (this, wxID_ANY, wxPoint(85, 325), wxSize(120, 20), BranchChoices);
|
||||||
|
choiceController->Select(0);
|
||||||
|
|
||||||
|
auto* checkConsole = new wxCheckBox (this, wxID_ANY, " Show Console", wxPoint(30, 400));
|
||||||
|
|
||||||
/////////// UI Colors ///////////
|
/////////// UI Colors ///////////
|
||||||
if (DarkMode) {
|
if (DarkMode) {
|
||||||
//Text:
|
//Text:
|
||||||
txtName->SetForegroundColour("white");
|
txtDirectory->SetForegroundColour("white");
|
||||||
txtName2->SetForegroundColour("white");
|
txtProfileDirectory->SetForegroundColour("white");
|
||||||
|
txtCacheDirectory->SetForegroundColour("white");
|
||||||
|
txtBranch->SetForegroundColour("white");
|
||||||
|
checkConsole->SetForegroundColour("white");
|
||||||
|
|
||||||
|
//Style:
|
||||||
|
ctrlCacheDirectory->SetWindowStyle(wxBORDER_NONE);
|
||||||
|
ctrlProfileDirectory->SetWindowStyle(wxBORDER_NONE);
|
||||||
|
ctrlDirectory->SetWindowStyle(wxBORDER_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////// OnClickAccount Event ///////////
|
/////////// OnClick Account Event ///////////
|
||||||
void MyMainFrame::OnClickAccount(wxCommandEvent& event WXUNUSED(event)) {
|
void MyMainFrame::OnClickAccount(wxCommandEvent& event WXUNUSED(event)) {
|
||||||
|
|
||||||
auto* AccountFrame = new MyAccountFrame();
|
auto* AccountFrame = new MyAccountFrame();
|
||||||
AccountFrame->SetSize(500, 650);
|
AccountFrame->SetSize(500, 650);
|
||||||
AccountFrame->Center();
|
AccountFrame->Center();
|
||||||
|
AccountFrame->SetIcon(wxIcon("beammp_original.png",wxBITMAP_TYPE_PNG));
|
||||||
|
|
||||||
if (wxSystemSettings::GetAppearance().IsDark()) {
|
if (wxSystemSettings::GetAppearance().IsDark()) {
|
||||||
AccountFrame->SetBackgroundColour(wxColour(40, 40, 40));
|
AccountFrame->SetBackgroundColour(wxColour(40, 40, 40));
|
||||||
@ -253,12 +327,13 @@ void MyMainFrame::OnClickAccount(wxCommandEvent& event WXUNUSED(event)) {
|
|||||||
AccountFrame->Show(true);
|
AccountFrame->Show(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////// OnClickSettings Event ///////////
|
/////////// OnClick Settings Event ///////////
|
||||||
void MyMainFrame::OnClickSettings(wxCommandEvent& event WXUNUSED(event)) {
|
void MyMainFrame::OnClickSettings(wxCommandEvent& event WXUNUSED(event)) {
|
||||||
|
|
||||||
auto* SettingsFrame = new MySettingsFrame();
|
auto* SettingsFrame = new MySettingsFrame();
|
||||||
SettingsFrame->SetSize(500, 650);
|
SettingsFrame->SetSize(500, 650);
|
||||||
SettingsFrame->Center();
|
SettingsFrame->Center();
|
||||||
|
SettingsFrame->SetIcon(wxIcon("beammp_original.png",wxBITMAP_TYPE_PNG));
|
||||||
|
|
||||||
if (wxSystemSettings::GetAppearance().IsDark()) {
|
if (wxSystemSettings::GetAppearance().IsDark()) {
|
||||||
SettingsFrame->SetBackgroundColour(wxColour(40, 40, 40));
|
SettingsFrame->SetBackgroundColour(wxColour(40, 40, 40));
|
||||||
@ -272,12 +347,25 @@ void MyMainFrame::OnClickSettings(wxCommandEvent& event WXUNUSED(event)) {
|
|||||||
SettingsFrame->Show(true);
|
SettingsFrame->Show(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////// OnClickLogoEvent ///////////
|
/////////// OnClick Logo Event ///////////
|
||||||
void MyMainFrame::OnClickLogo(wxCommandEvent& event WXUNUSED(event)) {
|
void MyMainFrame::OnClickLogo(wxCommandEvent& event WXUNUSED(event)) {
|
||||||
wxLaunchDefaultApplication("https://beammp.com");
|
wxLaunchDefaultApplication("https://beammp.com");
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////// OnClickLaunch Event ///////////
|
/////////// OnClick Register Event ///////////
|
||||||
|
void MyAccountFrame::OnClickRegister(wxCommandEvent& event WXUNUSED(event)) {
|
||||||
|
|
||||||
|
wxLaunchDefaultApplication("https://forum.beammp.com/signup");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////// OnClick Logout Event ///////////
|
||||||
|
void MyAccountFrame::OnClickLogout(wxCommandEvent& event WXUNUSED(event)) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/////////// OnClick Launch Event ///////////
|
||||||
void MyMainFrame::OnClickLaunch(wxCommandEvent& event WXUNUSED(event)) {
|
void MyMainFrame::OnClickLaunch(wxCommandEvent& event WXUNUSED(event)) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -303,13 +391,11 @@ void MyMainFrame::OnClickLaunch(wxCommandEvent& event WXUNUSED(event)) {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////// MAIN FUNCTION ///////////
|
/////////// MAIN FUNCTION ///////////
|
||||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {
|
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {
|
||||||
wxDisableAsserts();
|
wxDisableAsserts();
|
||||||
wxLog::SetLogLevel(wxLOG_Info);
|
wxLog::SetLogLevel(wxLOG_Info);
|
||||||
new MyApp();
|
new MyApp();
|
||||||
return wxEntry(hInstance, hPrevInstance, lpCmdLine, nShowCmd);
|
return wxEntry(hInstance, hPrevInstance, lpCmdLine, nShowCmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2544
src/gui/gifs.cpp
2544
src/gui/gifs.cpp
File diff suppressed because it is too large
Load Diff
@ -1,11 +0,0 @@
|
|||||||
///
|
|
||||||
/// Created by Anonymous275 on 7/17/21
|
|
||||||
/// Copyright (c) 2021-present Anonymous275 read the LICENSE file for more info.
|
|
||||||
///
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class gif {
|
|
||||||
public:
|
|
||||||
static const unsigned char Logo[30427];
|
|
||||||
};
|
|
Loading…
x
Reference in New Issue
Block a user