Skip to content

Commit

Permalink
Replace dv_gui_opengl with libgui
Browse files Browse the repository at this point in the history
  • Loading branch information
dvsku committed Jun 4, 2024
1 parent 7c46fcd commit 6bd13d7
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 40 deletions.
10 changes: 4 additions & 6 deletions dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ SET(FETCHCONTENT_QUIET OFF)
SET(FETCHCONTENT_UPDATES_DISCONNECTED ON)

###############################################################################
## dv_gui_opengl
## libgui

FetchContent_Declare(
dv_gui_opengl
URL https://github.com/dvsku/dv_gui_opengl/archive/3d706e2009e308508ce5a04d72805464a48af518.zip
libgui
URL https://github.com/dvsku/libgui/archive/refs/heads/master.zip
)

FetchContent_MakeAvailable(dv_gui_opengl)

SET(DV_GUI_INCLUDES "${dv_gui_opengl_SOURCE_DIR}/include" PARENT_SCOPE)
FetchContent_MakeAvailable(libgui)

###############################################################################
## libevp
Expand Down
3 changes: 1 addition & 2 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ TARGET_LINK_OPTIONS(dvsku_toolkit PRIVATE "/SUBSYSTEM:WINDOWS")

TARGET_INCLUDE_DIRECTORIES(dvsku_toolkit PRIVATE "${TOOLKIT_LIBRARIES_DIR}")
TARGET_INCLUDE_DIRECTORIES(dvsku_toolkit PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src")
TARGET_INCLUDE_DIRECTORIES(dvsku_toolkit PRIVATE "${DV_GUI_INCLUDES}")
TARGET_INCLUDE_DIRECTORIES(dvsku_toolkit PRIVATE "${LIBEVP_INCLUDES}")

TARGET_LINK_LIBRARIES(dvsku_toolkit PRIVATE dv_gui_opengl2)
TARGET_LINK_LIBRARIES(dvsku_toolkit PRIVATE libgui_opengl2)
TARGET_LINK_LIBRARIES(dvsku_toolkit PRIVATE libevp)
4 changes: 2 additions & 2 deletions source/src/dt_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ using namespace dvsku;
///////////////////////////////////////////////////////////////////////////////
// PUBLIC

dt_app::dt_app(const dvsku::dv_window_settings& settings)
: dv_window(settings), m_systems(*this), m_gui(*this)
dt_app::dt_app(const dvsku::gui_window_settings& settings)
: gui_window(settings), m_systems(*this), m_gui(*this)
{
set_resizable(false);
}
Expand Down
6 changes: 3 additions & 3 deletions source/src/dt_app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
#include "systems/dt_system_mngr.hpp"
#include "gui/dt_gui_mngr.hpp"

#include <dv_gui_opengl/dv_gui_opengl.hpp>
#include <libgui.hpp>

namespace dvsku_toolkit {
class dt_app : public dvsku::dv_window {
class dt_app : public dvsku::gui_window {
public:
dt_app() = delete;
dt_app(const dt_app&) = delete;
dt_app(dt_app&&) = delete;

dt_app(const dvsku::dv_window_settings& settings);
dt_app(const dvsku::gui_window_settings& settings);

dt_app& operator=(const dt_app&) = delete;
dt_app& operator=(dt_app&&) = delete;
Expand Down
2 changes: 1 addition & 1 deletion source/src/dvsku_toolkit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using namespace dvsku_toolkit;

INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, INT nCmdShow) {
try {
dvsku::dv_window_settings settings;
dvsku::gui_window_settings settings;
settings.width = 600U;
settings.height = 275U;
settings.title = DT_APP_NAME;
Expand Down
12 changes: 6 additions & 6 deletions source/src/gui/dt_comp_pack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dt_comp_pack::dt_comp_pack(dt_app& app)
m_progress = 0.0f;
m_app.get_systems().core.is_working = true;

m_app.set_taskbar_status(dvsku::dv_taskbar_status::normal);
m_app.set_taskbar_status(dvsku::gui_taskbar_status::normal);
m_app.set_taskbar_progress(0U);
};
m_context.finish_callback = [this](libevp::evp_result result) {
Expand All @@ -26,14 +26,14 @@ dt_comp_pack::dt_comp_pack(dt_app& app)
m_app.get_systems().core.has_errors = false;
m_app.get_systems().core.errors = "";

m_app.set_taskbar_status(dvsku::dv_taskbar_status::no_progress);
m_app.set_taskbar_status(dvsku::gui_taskbar_status::no_progress);
m_app.set_taskbar_progress(0U);

if (result.status == libevp::evp_result_status::ok) {
dvsku::dv_util_sound::success();
dvsku::util_sound::success();
}
else if (result.status == libevp::evp_result_status::error) {
dvsku::dv_util_sound::warning();
dvsku::util_sound::warning();

if (!result.message.empty()) {
m_app.get_systems().core.has_errors = true;
Expand Down Expand Up @@ -65,7 +65,7 @@ void dt_comp_pack::render() {

ImGui::SameLine(0.0f, 5.0f);
if (ImGui::Button("Select##Input", { 125.0f, 21.0f })) {
m_input = dvsku::dv_util_dialog::select_dir("Input dir", m_input);
m_input = dvsku::util_dialog::select_dir("Input dir", m_input);
}

ImGui::Indent(3.0f);
Expand All @@ -77,7 +77,7 @@ void dt_comp_pack::render() {

ImGui::SameLine(0.0f, 5.0f);
if (ImGui::Button("Select##Output", { 125.0f, 21.0f })) {
m_output = dvsku::dv_util_dialog::save_file("Output evp", m_output, true, { "EVP (*.evp)", "*.evp" });
m_output = dvsku::util_dialog::save_file("Output evp", m_output, true, { "EVP (*.evp)", "*.evp" });
}

ImGui::Dummy({ 0.0f, 3.0f });
Expand Down
12 changes: 6 additions & 6 deletions source/src/gui/dt_comp_unpack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dt_comp_unpack::dt_comp_unpack(dt_app& app)
m_progress = 0.0f;
m_app.get_systems().core.is_working = true;

m_app.set_taskbar_status(dvsku::dv_taskbar_status::normal);
m_app.set_taskbar_status(dvsku::gui_taskbar_status::normal);
m_app.set_taskbar_progress(0U);
};
m_context.finish_callback = [this](libevp::evp_result result) {
Expand All @@ -26,14 +26,14 @@ dt_comp_unpack::dt_comp_unpack(dt_app& app)
m_app.get_systems().core.has_errors = false;
m_app.get_systems().core.errors = "";

m_app.set_taskbar_status(dvsku::dv_taskbar_status::no_progress);
m_app.set_taskbar_status(dvsku::gui_taskbar_status::no_progress);
m_app.set_taskbar_progress(0U);

if (result.status == libevp::evp_result_status::ok) {
dvsku::dv_util_sound::success();
dvsku::util_sound::success();
}
else if (result.status == libevp::evp_result_status::error) {
dvsku::dv_util_sound::warning();
dvsku::util_sound::warning();

if (!result.message.empty()) {
m_app.get_systems().core.has_errors = true;
Expand Down Expand Up @@ -65,7 +65,7 @@ void dt_comp_unpack::render() {

ImGui::SameLine(0.0f, 5.0f);
if (ImGui::Button("Select##Input", { 125.0f, 21.0f })) {
m_input = dvsku::dv_util_dialog::open_file("Input evp", m_input, { "EVP (*.evp)", "*.evp" });
m_input = dvsku::util_dialog::open_file("Input evp", m_input, { "EVP (*.evp)", "*.evp" });
}

ImGui::Indent(3.0f);
Expand All @@ -77,7 +77,7 @@ void dt_comp_unpack::render() {

ImGui::SameLine(0.0f, 5.0f);
if (ImGui::Button("Select##Output", { 125.0f, 21.0f })) {
m_output = dvsku::dv_util_dialog::select_dir("Output dir", m_output);
m_output = dvsku::util_dialog::select_dir("Output dir", m_output);
}

ImGui::Dummy({ 0.0f, 10.0f });
Expand Down
4 changes: 2 additions & 2 deletions source/src/gui/dt_modal_errors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ using namespace dvsku;
dt_modal_errors::dt_modal_errors(dt_app& app)
: dt_gui_base(app) {}

dv_command_state dt_modal_errors::render() {
dv_command_state state = dv_command_state::repeat;
gui_command_state dt_modal_errors::render() {
gui_command_state state = gui_command_state::repeat;

ImGui::OpenPopup("Errors##Modal");

Expand Down
4 changes: 2 additions & 2 deletions source/src/gui/dt_modal_errors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "gui/dt_gui_base.hpp"

#include <dv_gui_opengl/dv_gui_opengl.hpp>
#include <libgui.hpp>

namespace dvsku_toolkit {
class dt_modal_errors : public dt_gui_base {
Expand All @@ -17,6 +17,6 @@ namespace dvsku_toolkit {
dt_modal_errors& operator=(dt_modal_errors&&) = delete;

public:
dvsku::dv_command_state render();
dvsku::gui_command_state render();
};
}
2 changes: 1 addition & 1 deletion source/src/systems/dt_sys_command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using namespace dvsku;
// PUBLIC

void dt_sys_command::prepare() {
set_command(dt_commands::flag_show_error_window, dv_command([this]() {
set_command(dt_commands::flag_show_error_window, gui_command([this]() {
return m_app.get_gui().modal_errors.render();
}));
}
Expand Down
6 changes: 3 additions & 3 deletions source/src/systems/dt_sys_command.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "systems/dt_system_base.hpp"

#include <dv_gui_opengl/dv_gui_opengl.hpp>
#include <libgui/systems/gui_sys_command.hpp>

namespace dvsku_toolkit {
class dt_app;
Expand All @@ -11,7 +11,7 @@ namespace dvsku_toolkit {
flag_show_error_window
};

class dt_sys_command : public dt_system_base, public dvsku::dv_sys_command<dt_commands> {
class dt_sys_command : public dt_system_base, public dvsku::gui_sys_command<dt_commands> {
public:
dt_sys_command() = delete;
dt_sys_command(const dt_sys_command&) = delete;
Expand All @@ -21,7 +21,7 @@ namespace dvsku_toolkit {
dt_sys_command& operator=(dt_sys_command&&) = delete;

dt_sys_command(dt_app& app)
: dt_system_base(app), dv_sys_command<dt_commands>() {};
: dt_system_base(app), gui_sys_command<dt_commands>() {};

public:
void prepare();
Expand Down
2 changes: 1 addition & 1 deletion source/src/systems/dt_sys_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ using namespace dvsku_toolkit;
dt_sys_core::dt_sys_core(dt_app& app)
: dt_system_base(app)
{
app_version = dvsku::dv_version(DT_VERSION_MAJOR, DT_VERSION_MINOR, DT_VERSION_REV);
app_version = dvsku::version(DT_VERSION_MAJOR, DT_VERSION_MINOR, DT_VERSION_REV);
};
10 changes: 5 additions & 5 deletions source/src/systems/dt_sys_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

#include "systems/dt_system_base.hpp"

#include <dv_gui_opengl/dv_gui_opengl.hpp>
#include <libgui.hpp>
#include <mutex>

namespace dvsku_toolkit {
class dt_app;

class dt_sys_core : public dt_system_base {
public:
dvsku::dv_version app_version;
bool is_working = false;
bool has_errors = false;
std::string errors = "";
dvsku::version app_version;
bool is_working = false;
bool has_errors = false;
std::string errors = "";

std::mutex mutex;

Expand Down

0 comments on commit 6bd13d7

Please sign in to comment.