Integrate wxWidgets application and enhance SFML project
- Added `wxwidgets` module with a basic application (menu and UI setup in `main.cpp`) and CMake configuration. - Updated `Paddle` class in SFML to support dynamic key bindings and movement logic via `Update` method. - Introduced `asset_ids.h` for centralized asset file definitions in SFML. - Enhanced `sfml/main.cpp` with animation logic and drawable management using `std::vector`. - Adjusted CMake configurations for SFML and added asset copying to runtime directory.
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
#include <wx/wx.h>
|
||||
|
||||
class App : public wxApp {
|
||||
public:
|
||||
bool OnInit() override;
|
||||
};
|
||||
|
||||
wxIMPLEMENT_APP(App);
|
||||
|
||||
class MainWindow : public wxFrame {
|
||||
public:
|
||||
MainWindow();
|
||||
|
||||
private:
|
||||
void OnShowMenuItemClick(wxCommandEvent& event);
|
||||
};
|
||||
|
||||
bool App::OnInit() {
|
||||
MainWindow* mainWindow = new MainWindow();
|
||||
mainWindow->Show();
|
||||
return true;
|
||||
}
|
||||
|
||||
enum AppIds {
|
||||
ID_LOWEST = 0,
|
||||
|
||||
ID_SHOW
|
||||
};
|
||||
|
||||
MainWindow::MainWindow() : wxFrame(nullptr, wxID_ANY, "Hello, world!")
|
||||
{
|
||||
wxMenu* fileMenu = new wxMenu();
|
||||
fileMenu->Append(ID_SHOW, "Show");
|
||||
fileMenu->Append(wxID_ABOUT);
|
||||
fileMenu->Append(wxID_EXIT);
|
||||
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
menuBar->Append(fileMenu, "&File");
|
||||
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
Bind(wxEVT_MENU, &MainWindow::OnShowMenuItemClick, this, ID_SHOW);
|
||||
|
||||
wxBoxSizer* mainVertical = new wxBoxSizer(wxVERTICAL);
|
||||
wxStaticText* label = new wxStaticText(this, wxID_ANY, "Hello, world!");
|
||||
mainVertical->Add(label);
|
||||
mainVertical->Add(new wxStaticText(this, wxID_ANY, "Internal Instance"));
|
||||
|
||||
wxBoxSizer* horizontal = new wxBoxSizer(wxHORIZONTAL);
|
||||
horizontal->Add(new wxButton(this, ID_SHOW, "Show"));
|
||||
horizontal->Add(new wxButton(this, ID_SHOW, "Show"));
|
||||
horizontal->Add(new wxButton(this, ID_SHOW, "Show"));
|
||||
horizontal->Add(new wxButton(this, ID_SHOW, "Show"));
|
||||
mainVertical->Add(horizontal);
|
||||
|
||||
SetSizer(mainVertical);
|
||||
}
|
||||
|
||||
void MainWindow::OnShowMenuItemClick(wxCommandEvent& event) {
|
||||
wxMessageBox("Hello, world!");
|
||||
}
|
||||
Reference in New Issue
Block a user