mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2026-02-16 10:40:46 +00:00
added wxWidgets
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -0,0 +1,3 @@
|
||||
[submodule "wxWidgets"]
|
||||
path = wxWidgets
|
||||
url = https://github.com/wxWidgets/wxWidgets.git
|
||||
|
||||
@@ -7,6 +7,8 @@ if (WIN32)
|
||||
STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
||||
endif(WIN32)
|
||||
|
||||
add_subdirectory(wxWidgets)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
|
||||
@@ -15,7 +17,10 @@ add_executable(${PROJECT_NAME}
|
||||
src/main.cpp
|
||||
src/Launcher.cpp include/Launcher.h
|
||||
src/Logger.cpp include/Logger.h
|
||||
)
|
||||
src/Gui.cpp
|
||||
src/gifs.cpp src/gifs.h)
|
||||
|
||||
|
||||
if (WIN32)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
@@ -24,9 +29,10 @@ if (WIN32)
|
||||
include_directories(${VcpkgRoot}/include)
|
||||
link_directories(${VcpkgRoot}/lib)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${VcpkgRoot}/lib/discord-rpc.lib
|
||||
ZLIB::ZLIB OpenSSL::SSL OpenSSL::Crypto ws2_32)
|
||||
ZLIB::ZLIB OpenSSL::SSL OpenSSL::Crypto ws2_32 wx::net wx::core wx::base)
|
||||
elseif (UNIX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s")
|
||||
target_link_libraries(${PROJECT_NAME} wx::net wx::core wx::base)
|
||||
else(WIN32) #MINGW
|
||||
add_definitions("-D_WIN32_WINNT=0x0600")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -s --static")
|
||||
|
||||
@@ -8,5 +8,5 @@
|
||||
|
||||
class Log {
|
||||
public:
|
||||
static void Init(int argc, char* argv[]);
|
||||
static void Init();
|
||||
};
|
||||
|
||||
91
src/Gui.cpp
Normal file
91
src/Gui.cpp
Normal file
@@ -0,0 +1,91 @@
|
||||
///
|
||||
/// Created by Anonymous275 on 12/27/21
|
||||
/// Copyright (c) 2021-present Anonymous275 read the LICENSE file for more info.
|
||||
///
|
||||
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
|
||||
#include <wx/wxprec.h>
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
#include <wx/animate.h>
|
||||
#include <wx/mstream.h>
|
||||
#include "gifs.h"
|
||||
|
||||
#endif
|
||||
class MyApp : public wxApp {
|
||||
public:
|
||||
virtual bool OnInit();
|
||||
};
|
||||
class MyFrame : public wxFrame {
|
||||
public:
|
||||
MyFrame();
|
||||
private:
|
||||
void OnHello(wxCommandEvent& event);
|
||||
void OnExit(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
static wxSize FixedSize;
|
||||
};
|
||||
enum {
|
||||
ID_Hello = 1
|
||||
};
|
||||
wxSize MyFrame::FixedSize(370,400);
|
||||
|
||||
bool MyApp::OnInit() {
|
||||
auto *frame = new MyFrame();
|
||||
frame->Show(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
MyFrame::MyFrame()
|
||||
: wxFrame(nullptr, wxID_ANY, "BeamMP V3.0", wxDefaultPosition, FixedSize) {
|
||||
//SetMaxSize(FixedSize);
|
||||
//SetMinSize(FixedSize);
|
||||
Center();
|
||||
|
||||
//27 35 35
|
||||
|
||||
wxColour Colour(27,35,35,1);
|
||||
SetBackgroundColour(Colour);
|
||||
|
||||
auto* menuFile = new wxMenu;
|
||||
menuFile->Append(ID_Hello, "&Hello...\tCtrl-H",
|
||||
"Help string shown in status bar for this menu item");
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(wxID_EXIT);
|
||||
auto* menuHelp = new wxMenu;
|
||||
menuHelp->Append(wxID_ABOUT);
|
||||
auto* menuBar = new wxMenuBar;
|
||||
|
||||
menuBar->SetOwnBackgroundColour(Colour);
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(menuHelp, "&Help");
|
||||
//SetMenuBar(menuBar);
|
||||
|
||||
auto* m_ani = new wxAnimationCtrl(this, wxID_ANY);
|
||||
wxMemoryInputStream stream(gif::Logo, sizeof(gif::Logo));
|
||||
if (m_ani->Load(stream)) m_ani->Play();
|
||||
|
||||
|
||||
|
||||
Bind(wxEVT_MENU, &MyFrame::OnHello, this, ID_Hello);
|
||||
Bind(wxEVT_MENU, &MyFrame::OnAbout, this, wxID_ABOUT);
|
||||
Bind(wxEVT_MENU, &MyFrame::OnExit, this, wxID_EXIT);
|
||||
}
|
||||
void MyFrame::OnExit(wxCommandEvent& event) {
|
||||
Close(true);
|
||||
}
|
||||
void MyFrame::OnAbout(wxCommandEvent& event) {
|
||||
wxMessageBox("This is a wxWidgets Hello World example",
|
||||
"About Hello World", wxOK | wxICON_INFORMATION);
|
||||
}
|
||||
void MyFrame::OnHello(wxCommandEvent& event) {
|
||||
wxLogMessage("Hello world from wxWidgets!");
|
||||
}
|
||||
|
||||
|
||||
int Entry (int argc, char *argv[]) {
|
||||
new MyApp();
|
||||
return wxEntry(argc, argv);
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
Launcher::Launcher(int argc, char **argv) : DirPath(argv[0]) {
|
||||
DirPath = DirPath.substr(0, DirPath.find_last_of("\\/") + 1);
|
||||
Log::Init(argc, argv);
|
||||
Log::Init();
|
||||
WindowsInit();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,19 +5,21 @@
|
||||
|
||||
#include "Logger.h"
|
||||
INITIALIZE_EASYLOGGINGPP
|
||||
void Log::Init(int argc, char **argv) {
|
||||
el::Helpers::setArgs(argc, argv);
|
||||
el::Configurations Conf;
|
||||
using namespace el;
|
||||
void Log::Init() {
|
||||
Configurations Conf;
|
||||
Conf.setToDefault();
|
||||
std::string DFormat("%datetime{[%d/%M/%y %H:%m:%s]} %fbase:%line [%level] %msg");
|
||||
Conf.setGlobally(el::ConfigurationType::Format, "%datetime{[%d/%M/%y %H:%m:%s]} [%level] %msg");
|
||||
Conf.set(el::Level::Debug,el::ConfigurationType::Format, DFormat);
|
||||
Conf.set(el::Level::Trace,el::ConfigurationType::Format, DFormat);
|
||||
Conf.set(el::Level::Fatal,el::ConfigurationType::Format, DFormat);
|
||||
Conf.setGlobally(el::ConfigurationType::Filename, "Launcher.log");
|
||||
Conf.setGlobally(el::ConfigurationType::MaxLogFileSize, "2097152");
|
||||
el::Loggers::reconfigureAllLoggers(Conf);
|
||||
el::Loggers::addFlag(el::LoggingFlag::DisableApplicationAbortOnFatalLog);
|
||||
el::Loggers::addFlag(el::LoggingFlag::HierarchicalLogging);
|
||||
el::Loggers::setLoggingLevel(el::Level::Global);
|
||||
Conf.setGlobally(ConfigurationType::Format, "%datetime{[%d/%M/%y %H:%m:%s]} [%level] %msg");
|
||||
Conf.setGlobally(ConfigurationType::LogFlushThreshold, "2");
|
||||
Conf.set(Level::Verbose,ConfigurationType::Format, DFormat);
|
||||
Conf.set(Level::Debug,ConfigurationType::Format, DFormat);
|
||||
Conf.set(Level::Trace,ConfigurationType::Format, DFormat);
|
||||
Conf.set(Level::Fatal,ConfigurationType::Format, DFormat);
|
||||
Conf.setGlobally(ConfigurationType::Filename, "Launcher.log");
|
||||
Conf.setGlobally(ConfigurationType::MaxLogFileSize, "7340032");
|
||||
Loggers::reconfigureAllLoggers(Conf);
|
||||
Loggers::addFlag(LoggingFlag::DisableApplicationAbortOnFatalLog);
|
||||
Loggers::addFlag(LoggingFlag::HierarchicalLogging);
|
||||
Loggers::setLoggingLevel(Level::Global);
|
||||
}
|
||||
|
||||
2546
src/gifs.cpp
Normal file
2546
src/gifs.cpp
Normal file
File diff suppressed because it is too large
Load Diff
11
src/gifs.h
Normal file
11
src/gifs.h
Normal file
@@ -0,0 +1,11 @@
|
||||
///
|
||||
/// 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];
|
||||
};
|
||||
@@ -5,7 +5,9 @@
|
||||
|
||||
#include "Launcher.h"
|
||||
|
||||
int Entry (int argc, char *argv[]);
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
Launcher launcher(argc, argv);
|
||||
return 0;
|
||||
}
|
||||
return Entry(argc, argv);
|
||||
}
|
||||
|
||||
1
wxWidgets
Submodule
1
wxWidgets
Submodule
Submodule wxWidgets added at c61b6fad7d
Reference in New Issue
Block a user