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:
parent
0eebacc28f
commit
91cf0d25d5
@ -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")
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
14
engine/src/platform/Platform.hpp
Normal file
14
engine/src/platform/Platform.hpp
Normal 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);
|
||||||
|
}
|
17
engine/src/platform/posix/PosixPopup.cpp
Normal file
17
engine/src/platform/posix/PosixPopup.cpp
Normal 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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
25
engine/src/platform/windows/WindowsPopup.cpp
Normal file
25
engine/src/platform/windows/WindowsPopup.cpp
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user