Add fc2dconfig program

This commit will add a new dependency: wxWidgets.
This commit is contained in:
Epicalert 2021-06-30 20:26:23 +08:00
parent 2206780a9b
commit 6d6658c610
No known key found for this signature in database
GPG key ID: CAA46F858D0979BD
2 changed files with 55 additions and 0 deletions

View file

@ -27,6 +27,9 @@ find_package( glm REQUIRED )
message (STATUS "Found glm at: " ${GLM_INCLUDE_DIRS} ) message (STATUS "Found glm at: " ${GLM_INCLUDE_DIRS} )
find_package( FreeGLUT REQUIRED ) find_package( FreeGLUT REQUIRED )
message (STATUS "Found FreeGLUT at: " ${GLUT_INCLUDE_DIR} ) message (STATUS "Found FreeGLUT at: " ${GLUT_INCLUDE_DIR} )
find_package( wxWidgets REQUIRED core base )
message (STATUS "Found wxWidgets at: " ${wxWidgets_USE_FILE} )
include( ${wxWidgets_USE_FILE} )
include_directories( ${OpenCV_INCLUDE_DIRS} ) include_directories( ${OpenCV_INCLUDE_DIRS} )
include_directories( ${OPENGL_INCLUDE_DIR} ) include_directories( ${OPENGL_INCLUDE_DIR} )
include_directories( ${GLEW_INCLUDE_DIRS} ) include_directories( ${GLEW_INCLUDE_DIRS} )
@ -65,3 +68,7 @@ add_executable( fc2d
) )
target_link_libraries( fc2d ${OpenCV_LIBS} ${OPENGL_LIBRARIES} ${WEBP_LIBRARIES} target_link_libraries( fc2d ${OpenCV_LIBS} ${OPENGL_LIBRARIES} ${WEBP_LIBRARIES}
FreeGLUT::freeglut GLEW::glew zip Boxer fmt ) FreeGLUT::freeglut GLEW::glew zip Boxer fmt )
add_executable( fc2dconfig
src/fc2dconfig.cpp
)
target_link_libraries( fc2dconfig ${wxWidgets_LIBRARIES} )

48
src/fc2dconfig.cpp Normal file
View file

@ -0,0 +1,48 @@
#include <config.hpp>
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
class ConfigurationApp : public wxApp {
public:
virtual bool OnInit();
};
class ConfigurationFrame : public wxFrame {
public:
ConfigurationFrame();
private:
void OnExit(wxCommandEvent& event);
};
wxIMPLEMENT_APP(ConfigurationApp);
bool ConfigurationApp::OnInit() {
// TODO: put config file creation here
ConfigurationFrame* frame = new ConfigurationFrame();
frame->Show(true);
return true;
}
ConfigurationFrame::ConfigurationFrame() : wxFrame(NULL, wxID_ANY, "Configure " PROJECT_NAME) {
wxPanel* panel = new wxPanel(this, wxID_ANY);
wxStaticText* placeholderText = new wxStaticText(panel, wxID_ANY, "There's nothing here right now, just click OK.");
wxButton* okButton = new wxButton(panel, wxID_OK, "OK");
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
sizer->Add(placeholderText, 0, wxALL | wxALIGN_LEFT, 10);
sizer->AddStretchSpacer(1);
sizer->Add(okButton, 0, wxALIGN_RIGHT | wxALL, 10);
panel->SetSizerAndFit(sizer);
Bind(wxEVT_BUTTON, &ConfigurationFrame::OnExit, this, wxID_OK);
}
void ConfigurationFrame::OnExit(wxCommandEvent& event) {
// TODO: write config file here
Close(true);
}