feat(platform): add platform specific popups

Please note! These changes have not yet been tested on POSIX platforms
(mac OR linux) so please do not expect them to work!
This commit is contained in:
illyum 2024-09-20 10:44:12 -06:00
parent 0eebacc28f
commit 91cf0d25d5
5 changed files with 66 additions and 0 deletions

View File

@ -50,6 +50,15 @@ INCLUDE_DIRECTORIES(engine/)
SET(EngineSources SET(EngineSources
engine/src/core/ICEApplication.cpp engine/src/core/ICEApplication.cpp
) )
IF (WIN32)
LIST(APPEND EngineSources
engine/src/platform/windows/WindowsPopup.cpp
)
ELSEIF (UNIX)
LIST(APPEND EngineSources
engine/src/platform/posix/PosixPopup.cpp
)
ENDIF()
SET(PrecompiledHeader "pch.h") SET(PrecompiledHeader "pch.h")

View File

@ -7,5 +7,6 @@
#include "src/core/Logger.hpp" #include "src/core/Logger.hpp"
#include "src/core/ICEApplication.hpp" #include "src/core/ICEApplication.hpp"
#include "src/platform/Platform.hpp"
#endif //ICENGINE_HPP #endif //ICENGINE_HPP

View File

@ -0,0 +1,14 @@
//
// Created by illyum on 9/20/2024.
//
#pragma once
#include <pch.hpp>
namespace Platform {
void ShowPopup(const char *message);
void ShowPopup(const char *title, const char *message);
void ShowPopup(const std::string &message);
void ShowPopup(const std::string &title, const std::string &message);
}

View File

@ -0,0 +1,17 @@
//
// Created by illyum on 9/20/2024.
//
#include "../Platform.hpp"
#include <pch.hpp>
namespace Platform {
void ShowPopup(const char* message) {
std::string command = "zenity --info --text=\"";
command += message;
command += "\"";
system(command.c_str());
}
}

View File

@ -0,0 +1,25 @@
//
// Created by illyum on 9/20/2024.
//
#include <pch.hpp>
#include "../Platform.hpp"
#include <windows.h>
namespace Platform {
void ShowPopup(const char *message) {
MessageBoxA(nullptr, message, "ICEngine", MB_OK);
}
void ShowPopup(const char *title, const char *message) {
MessageBoxA(nullptr, message, title, MB_OK);
}
void ShowPopup(const std::string &message) {
MessageBoxA(nullptr, message.c_str(), "ICEngine", MB_OK);
}
void ShowPopup(const std::string &title, const std::string &message) {
MessageBoxA(nullptr, message.c_str(), title.c_str(), MB_OK);
}
}