add TimeStep, add tinyfilediaglogs
This commit is contained in:
@ -12,6 +12,7 @@ add_subdirectory(vendor/glad EXCLUDE_FROM_ALL)
|
|||||||
add_subdirectory(vendor/glm EXCLUDE_FROM_ALL)
|
add_subdirectory(vendor/glm EXCLUDE_FROM_ALL)
|
||||||
add_subdirectory(vendor/assimp EXCLUDE_FROM_ALL)
|
add_subdirectory(vendor/assimp EXCLUDE_FROM_ALL)
|
||||||
add_subdirectory(vendor/stb EXCLUDE_FROM_ALL)
|
add_subdirectory(vendor/stb EXCLUDE_FROM_ALL)
|
||||||
|
add_subdirectory(vendor/TinyFileDialog EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
|
|
||||||
# ------------- imgui -------------
|
# ------------- imgui -------------
|
||||||
@ -32,6 +33,7 @@ set(LINK_LIBRARIES_PRIVATE
|
|||||||
glad
|
glad
|
||||||
assimp
|
assimp
|
||||||
stb
|
stb
|
||||||
|
tinyFileDialogs
|
||||||
)
|
)
|
||||||
|
|
||||||
set(LINK_LIBRARIES_PUBLIC
|
set(LINK_LIBRARIES_PUBLIC
|
||||||
|
|||||||
@ -16,6 +16,8 @@
|
|||||||
#include <GLFW/glfw3native.h>
|
#include <GLFW/glfw3native.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
|
#include "tinyfiledialogs.h"
|
||||||
|
|
||||||
namespace Prism
|
namespace Prism
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -53,7 +55,7 @@ namespace Prism
|
|||||||
if (!m_Minimized)
|
if (!m_Minimized)
|
||||||
{
|
{
|
||||||
for (Layer* layer : m_LayerStack)
|
for (Layer* layer : m_LayerStack)
|
||||||
layer->OnUpdate();
|
layer->OnUpdate(m_TimeStep);
|
||||||
|
|
||||||
PM_RENDER_S({ self->RenderImGui(); });
|
PM_RENDER_S({ self->RenderImGui(); });
|
||||||
|
|
||||||
@ -62,6 +64,10 @@ namespace Prism
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_Window->OnUpdate();
|
m_Window->OnUpdate();
|
||||||
|
|
||||||
|
float time = GetTime();
|
||||||
|
m_TimeStep = time - m_LastFrameTime;
|
||||||
|
m_LastFrameTime = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
OnShutdown();
|
OnShutdown();
|
||||||
@ -89,6 +95,7 @@ namespace Prism
|
|||||||
ImGui::Text("Vendor: %s", caps.Vendor.c_str());
|
ImGui::Text("Vendor: %s", caps.Vendor.c_str());
|
||||||
ImGui::Text("Renderer: %s", caps.Renderer.c_str());
|
ImGui::Text("Renderer: %s", caps.Renderer.c_str());
|
||||||
ImGui::Text("Version: %s", caps.Version.c_str());
|
ImGui::Text("Version: %s", caps.Version.c_str());
|
||||||
|
ImGui::Text("Frame Time: %.2fms\n", m_TimeStep.GetMilliseconds());
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
for (Layer* layer : m_LayerStack)
|
for (Layer* layer : m_LayerStack)
|
||||||
@ -99,6 +106,63 @@ namespace Prism
|
|||||||
|
|
||||||
std::string Application::OpenFile(const std::string& filter) const
|
std::string Application::OpenFile(const std::string& filter) const
|
||||||
{
|
{
|
||||||
|
// 处理过滤器
|
||||||
|
std::vector<const char*> filterPatterns;
|
||||||
|
std::vector<std::string> patternStorage;
|
||||||
|
|
||||||
|
if (!filter.empty()) {
|
||||||
|
const char* ptr = filter.c_str();
|
||||||
|
bool isDescription = true;
|
||||||
|
|
||||||
|
while (*ptr) {
|
||||||
|
if (isDescription) {
|
||||||
|
// 跳过描述
|
||||||
|
isDescription = false;
|
||||||
|
} else {
|
||||||
|
// 添加模式
|
||||||
|
patternStorage.push_back(ptr);
|
||||||
|
isDescription = true;
|
||||||
|
}
|
||||||
|
ptr += strlen(ptr) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换为 C 字符串数组
|
||||||
|
for (const auto& pattern : patternStorage) {
|
||||||
|
filterPatterns.push_back(pattern.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果没有过滤器,添加默认值
|
||||||
|
if (filterPatterns.empty()) {
|
||||||
|
filterPatterns.push_back("*");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建过滤器描述
|
||||||
|
std::string filterDesc;
|
||||||
|
if (!patternStorage.empty()) {
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Files (";
|
||||||
|
for (size_t i = 0; i < patternStorage.size(); ++i) {
|
||||||
|
if (i > 0) ss << ",";
|
||||||
|
ss << patternStorage[i];
|
||||||
|
}
|
||||||
|
ss << ")";
|
||||||
|
filterDesc = ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调用文件对话框
|
||||||
|
const char* result = tinyfd_openFileDialog(
|
||||||
|
"Open File", // 标题
|
||||||
|
nullptr, // 初始目录
|
||||||
|
static_cast<int>(filterPatterns.size()), // 过滤器数量
|
||||||
|
filterPatterns.data(), // 过滤器模式
|
||||||
|
filterDesc.empty() ? nullptr : filterDesc.c_str(), // 描述
|
||||||
|
0 // 单选
|
||||||
|
);
|
||||||
|
|
||||||
|
return result ? std::string(result) : std::string();
|
||||||
|
|
||||||
|
/*
|
||||||
OPENFILENAMEA ofn; // common dialog box structure
|
OPENFILENAMEA ofn; // common dialog box structure
|
||||||
CHAR szFile[260] = {0}; // if using TCHAR macros
|
CHAR szFile[260] = {0}; // if using TCHAR macros
|
||||||
|
|
||||||
@ -120,6 +184,7 @@ namespace Prism
|
|||||||
return ofn.lpstrFile;
|
return ofn.lpstrFile;
|
||||||
}
|
}
|
||||||
return std::string();
|
return std::string();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::PushLayer(Layer* layer)
|
void Application::PushLayer(Layer* layer)
|
||||||
@ -156,4 +221,9 @@ namespace Prism
|
|||||||
m_Running = false;
|
m_Running = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Application::GetTime() const
|
||||||
|
{
|
||||||
|
return (float)glfwGetTime();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
#define APPLICATION_H
|
#define APPLICATION_H
|
||||||
|
|
||||||
#include "LayerStack.h"
|
#include "LayerStack.h"
|
||||||
|
#include "TimeStep.h"
|
||||||
#include "Window.h"
|
#include "Window.h"
|
||||||
#include "Events/ApplicationEvent.h"
|
#include "Events/ApplicationEvent.h"
|
||||||
#include "ImGui/ImGuiLayer.h"
|
#include "ImGui/ImGuiLayer.h"
|
||||||
@ -21,7 +22,7 @@ namespace Prism
|
|||||||
void Run();
|
void Run();
|
||||||
|
|
||||||
virtual void OnInit() {}
|
virtual void OnInit() {}
|
||||||
virtual void OnUpdate() {}
|
virtual void OnUpdate(TimeStep deltaTime) {}
|
||||||
virtual void OnShutdown() {}
|
virtual void OnShutdown() {}
|
||||||
|
|
||||||
virtual void OnEvent(Event& e);
|
virtual void OnEvent(Event& e);
|
||||||
@ -40,7 +41,11 @@ namespace Prism
|
|||||||
bool OnWindowResize(const WindowResizeEvent& e);
|
bool OnWindowResize(const WindowResizeEvent& e);
|
||||||
bool OnWindowClose(WindowCloseEvent& e);
|
bool OnWindowClose(WindowCloseEvent& e);
|
||||||
|
|
||||||
|
float GetTime() const; // TODO: should impl in platform
|
||||||
private:
|
private:
|
||||||
|
TimeStep m_TimeStep;
|
||||||
|
float m_LastFrameTime = 0.0f;
|
||||||
|
|
||||||
std::unique_ptr<Window> m_Window;
|
std::unique_ptr<Window> m_Window;
|
||||||
|
|
||||||
bool m_Running = true;
|
bool m_Running = true;
|
||||||
|
|||||||
78
Prism/src/Prism/Core/Buffer.h
Normal file
78
Prism/src/Prism/Core/Buffer.h
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
//
|
||||||
|
// Created by sfd on 25-11-27.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef BUFFER_H
|
||||||
|
#define BUFFER_H
|
||||||
|
|
||||||
|
#include "Core.h"
|
||||||
|
|
||||||
|
namespace Prism
|
||||||
|
{
|
||||||
|
struct Buffer
|
||||||
|
{
|
||||||
|
byte* Data;
|
||||||
|
uint32_t Size;
|
||||||
|
|
||||||
|
Buffer()
|
||||||
|
: Data(nullptr), Size(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Buffer(byte* data, const uint32_t size)
|
||||||
|
: Data(data), Size(size)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Allocate(const uint32_t size)
|
||||||
|
{
|
||||||
|
delete[] Data;
|
||||||
|
Data = nullptr;
|
||||||
|
|
||||||
|
if (size == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Data = new byte[size];
|
||||||
|
Size = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZeroInitialize() const
|
||||||
|
{
|
||||||
|
if (Data)
|
||||||
|
memset(Data, 0, Size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Write(const byte* data, const uint32_t size, const uint32_t offset = 0) const
|
||||||
|
{
|
||||||
|
PM_CORE_ASSERT(offset + size <= Size, "Buffer overflow!");
|
||||||
|
memcpy(Data + offset, data, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
operator bool() const
|
||||||
|
{
|
||||||
|
return Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte& operator[](const int index)
|
||||||
|
{
|
||||||
|
return Data[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
byte operator[](const int index) const
|
||||||
|
{
|
||||||
|
return Data[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
T* As()
|
||||||
|
{
|
||||||
|
return static_cast<T*>(Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline uint32_t GetSize() const { return Size; }
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif //BUFFER_H
|
||||||
@ -5,6 +5,8 @@
|
|||||||
#ifndef CORE_H
|
#ifndef CORE_H
|
||||||
#define CORE_H
|
#define CORE_H
|
||||||
|
|
||||||
|
#include <pmpch.h>
|
||||||
|
|
||||||
#if defined(PRISM_SHARED) && defined(_WIN32)
|
#if defined(PRISM_SHARED) && defined(_WIN32)
|
||||||
#ifdef BUILD_PRISM_DLL
|
#ifdef BUILD_PRISM_DLL
|
||||||
#define PRISM_API __declspec(dllexport)
|
#define PRISM_API __declspec(dllexport)
|
||||||
@ -33,6 +35,7 @@ namespace Prism
|
|||||||
|
|
||||||
|
|
||||||
#ifdef PM_ENABLE_ASSERTS
|
#ifdef PM_ENABLE_ASSERTS
|
||||||
|
#include "Log.h"
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define PM_DEBUGBREAK() __debugbreak()
|
#define PM_DEBUGBREAK() __debugbreak()
|
||||||
#elif defined(__linux__) && (defined(__i386__) || defined(__x86_64__))
|
#elif defined(__linux__) && (defined(__i386__) || defined(__x86_64__))
|
||||||
@ -48,8 +51,13 @@ namespace Prism
|
|||||||
|
|
||||||
namespace Prism
|
namespace Prism
|
||||||
{
|
{
|
||||||
using byte = unsigned char;
|
using byte = unsigned char;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
using Scope = std::unique_ptr<T>;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
using Ref = std::shared_ptr<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //CORE_H
|
#endif //CORE_H
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
#define LAYER_H
|
#define LAYER_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "TimeStep.h"
|
||||||
#include "Events/Event.h"
|
#include "Events/Event.h"
|
||||||
|
|
||||||
namespace Prism
|
namespace Prism
|
||||||
@ -18,7 +19,7 @@ namespace Prism
|
|||||||
|
|
||||||
virtual void OnAttach() {}
|
virtual void OnAttach() {}
|
||||||
virtual void OnDetach() {}
|
virtual void OnDetach() {}
|
||||||
virtual void OnUpdate() {}
|
virtual void OnUpdate(TimeStep deltaTime) {}
|
||||||
virtual void OnImGuiRender() {}
|
virtual void OnImGuiRender() {}
|
||||||
virtual void OnEvent(Event& e) {}
|
virtual void OnEvent(Event& e) {}
|
||||||
|
|
||||||
|
|||||||
14
Prism/src/Prism/Core/TimeStep.cpp
Normal file
14
Prism/src/Prism/Core/TimeStep.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//
|
||||||
|
// Created by sfd on 25-11-27.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "TimeStep.h"
|
||||||
|
|
||||||
|
namespace Prism
|
||||||
|
{
|
||||||
|
|
||||||
|
TimeStep::TimeStep(const float time)
|
||||||
|
: m_Time(time)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
29
Prism/src/Prism/Core/TimeStep.h
Normal file
29
Prism/src/Prism/Core/TimeStep.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
//
|
||||||
|
// Created by sfd on 25-11-27.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef TIMESTEP_H
|
||||||
|
#define TIMESTEP_H
|
||||||
|
|
||||||
|
#include "Core.h"
|
||||||
|
|
||||||
|
namespace Prism
|
||||||
|
{
|
||||||
|
class PRISM_API TimeStep
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TimeStep(){}
|
||||||
|
TimeStep(float time);
|
||||||
|
|
||||||
|
inline float GetSeconds() const { return m_Time; }
|
||||||
|
inline float GetMilliseconds() const { return m_Time * 1000.0f; }
|
||||||
|
|
||||||
|
operator float() { return m_Time; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
float m_Time;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif //TIMESTEP_H
|
||||||
@ -13,7 +13,15 @@ namespace Prism
|
|||||||
static void OpenGLLogMessage(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam)
|
static void OpenGLLogMessage(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam)
|
||||||
{
|
{
|
||||||
if (severity != GL_DEBUG_SEVERITY_NOTIFICATION)
|
if (severity != GL_DEBUG_SEVERITY_NOTIFICATION)
|
||||||
|
{
|
||||||
|
|
||||||
PM_CORE_ERROR("{0}", message);
|
PM_CORE_ERROR("{0}", message);
|
||||||
|
PM_CORE_ASSERT(false, "");
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
PM_CORE_TRACE("{0}", message);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererAPI::Init()
|
void RendererAPI::Init()
|
||||||
@ -42,6 +50,14 @@ namespace Prism
|
|||||||
|
|
||||||
glGetIntegerv(GL_MAX_SAMPLES, &caps.MaxSamples);
|
glGetIntegerv(GL_MAX_SAMPLES, &caps.MaxSamples);
|
||||||
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY, &caps.MaxAnisotropy);
|
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY, &caps.MaxAnisotropy);
|
||||||
|
|
||||||
|
|
||||||
|
GLenum error = glGetError();
|
||||||
|
while (error != GL_NO_ERROR)
|
||||||
|
{
|
||||||
|
PM_CORE_ERROR("OpenGL Error {0}", error);
|
||||||
|
error = glGetError();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererAPI::Shutdown()
|
void RendererAPI::Shutdown()
|
||||||
@ -59,13 +75,14 @@ namespace Prism
|
|||||||
glClearColor(r, g, b, a);
|
glClearColor(r, g, b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererAPI::DrawIndexed(const unsigned int count, bool depthTest)
|
void RendererAPI::DrawIndexed(const unsigned int count, const bool depthTest)
|
||||||
{
|
{
|
||||||
if (depthTest)
|
if (!depthTest)
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
else
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_INT, nullptr);
|
glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_INT, nullptr);
|
||||||
|
|
||||||
|
if (!depthTest)
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,9 +20,9 @@ namespace Prism
|
|||||||
: m_ProjectionMatrix(projectionMatrix)
|
: m_ProjectionMatrix(projectionMatrix)
|
||||||
{
|
{
|
||||||
// Sensible defaults
|
// Sensible defaults
|
||||||
m_PanSpeed = 0.0015f;
|
m_PanSpeed = 0.15f;
|
||||||
m_RotationSpeed = 0.002f;
|
m_RotationSpeed = 0.5f;
|
||||||
m_ZoomSpeed = 0.2f;
|
m_ZoomSpeed = 10.0f;
|
||||||
|
|
||||||
m_Position = { 0, 0, 10 };
|
m_Position = { 0, 0, 10 };
|
||||||
m_Rotation = glm::vec3(90.0f, 0.0f, 0.0f);
|
m_Rotation = glm::vec3(90.0f, 0.0f, 0.0f);
|
||||||
@ -38,7 +38,7 @@ namespace Prism
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::Update()
|
void Camera::Update(TimeStep deltaTime)
|
||||||
{
|
{
|
||||||
if (Input::IsKeyPressed(GLFW_KEY_LEFT_ALT))
|
if (Input::IsKeyPressed(GLFW_KEY_LEFT_ALT))
|
||||||
{
|
{
|
||||||
@ -46,6 +46,8 @@ namespace Prism
|
|||||||
glm::vec2 delta = mouse - m_InitialMousePosition;
|
glm::vec2 delta = mouse - m_InitialMousePosition;
|
||||||
m_InitialMousePosition = mouse;
|
m_InitialMousePosition = mouse;
|
||||||
|
|
||||||
|
delta *= deltaTime.GetSeconds();
|
||||||
|
|
||||||
if (Input::IsMouseButtonPressed(GLFW_MOUSE_BUTTON_MIDDLE))
|
if (Input::IsMouseButtonPressed(GLFW_MOUSE_BUTTON_MIDDLE))
|
||||||
MousePan(delta);
|
MousePan(delta);
|
||||||
else if (Input::IsMouseButtonPressed(GLFW_MOUSE_BUTTON_LEFT))
|
else if (Input::IsMouseButtonPressed(GLFW_MOUSE_BUTTON_LEFT))
|
||||||
@ -59,6 +61,8 @@ namespace Prism
|
|||||||
glm::quat orientation = GetOrientation();
|
glm::quat orientation = GetOrientation();
|
||||||
m_Rotation = glm::eulerAngles(orientation) * (180.0f / (float)M_PI);
|
m_Rotation = glm::eulerAngles(orientation) * (180.0f / (float)M_PI);
|
||||||
m_ViewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0, 0, 1)) * glm::toMat4(glm::conjugate(orientation)) * glm::translate(glm::mat4(1.0f), -m_Position);
|
m_ViewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0, 0, 1)) * glm::toMat4(glm::conjugate(orientation)) * glm::translate(glm::mat4(1.0f), -m_Position);
|
||||||
|
m_ViewMatrix = glm::translate(glm::mat4(1.0f), m_Position) * glm::toMat4(orientation);
|
||||||
|
m_ViewMatrix = glm::inverse(m_ViewMatrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 Camera::GetUpDirection()
|
glm::vec3 Camera::GetUpDirection()
|
||||||
|
|||||||
@ -7,15 +7,18 @@
|
|||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
|
#include "Prism/Core/TimeStep.h"
|
||||||
|
|
||||||
namespace Prism
|
namespace Prism
|
||||||
{
|
{
|
||||||
|
|
||||||
class PRISM_API Camera
|
class PRISM_API Camera
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Camera(const glm::mat4& projectionMatrix);
|
Camera(const glm::mat4& projectionMatrix);
|
||||||
|
|
||||||
void Focus();
|
void Focus();
|
||||||
void Update();
|
void Update(TimeStep deltaTime);
|
||||||
|
|
||||||
inline float GetDistance() const { return m_Distance; }
|
inline float GetDistance() const { return m_Distance; }
|
||||||
inline void SetDistance(float distance) { m_Distance = distance; }
|
inline void SetDistance(float distance) { m_Distance = distance; }
|
||||||
|
|||||||
@ -40,7 +40,7 @@ namespace Prism
|
|||||||
|
|
||||||
void RenderCommandQueue::Execute()
|
void RenderCommandQueue::Execute()
|
||||||
{
|
{
|
||||||
PM_RENDER_TRACE("RenderCommandQueue::Execute -- {0} commands, {1} bytes", m_CommandCount, (m_CommandBufferPtr - m_CommandBuffer));
|
// PM_RENDER_TRACE("RenderCommandQueue::Execute -- {0} commands, {1} bytes", m_CommandCount, (m_CommandBufferPtr - m_CommandBuffer));
|
||||||
|
|
||||||
byte* buffer = m_CommandBuffer;
|
byte* buffer = m_CommandBuffer;
|
||||||
|
|
||||||
|
|||||||
2
Prism/vendor/TinyFileDialog/CMakeLists.txt
vendored
Normal file
2
Prism/vendor/TinyFileDialog/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
add_library(tinyFileDialogs STATIC tinyfiledialogs.c)
|
||||||
|
target_include_directories(tinyFileDialogs PUBLIC ./)
|
||||||
233
Prism/vendor/TinyFileDialog/README.txt
vendored
Normal file
233
Prism/vendor/TinyFileDialog/README.txt
vendored
Normal file
@ -0,0 +1,233 @@
|
|||||||
|
SPDX-License-Identifier: Zlib
|
||||||
|
Copyright (c) 2014 - 2025 Guillaume Vareille http://ysengrin.com
|
||||||
|
|
||||||
|
********* TINY FILE DIALOGS OFFICIAL WEBSITE IS ON SOURCEFORGE *********
|
||||||
|
|
||||||
|
http://tinyfiledialogs.sourceforge.net
|
||||||
|
git clone http://git.code.sf.net/p/tinyfiledialogs/code tinyfd
|
||||||
|
***************************************************************************
|
||||||
|
____________________________________________________________________
|
||||||
|
| |
|
||||||
|
| 100% compatible C C++ -> You can rename tinfiledialogs.c as .cpp |
|
||||||
|
\____________________________________________________________________/
|
||||||
|
|
||||||
|
tiny file dialogs ( cross-platform C C++ ) v3.21.2 [Oct 25, 2025]
|
||||||
|
_________
|
||||||
|
/ \ Tray-popup InputBox PasswordBox MessageBox Notification Beep ColorPicker
|
||||||
|
|tiny file| ColorPicker OpenFileDialog SaveFileDialog SelectFolderDialog
|
||||||
|
| dialogs | ASCII UTF-8 (and also MBCS & UTF-16 for windows)
|
||||||
|
\____ ___/ Native dialog library for WINDOWS MAC OSX GTK+ QT CONSOLE X Wayland
|
||||||
|
\| SSH: automatic switch to console mode / X forwarding / waypipe
|
||||||
|
|
||||||
|
C89/C18 & C++98/C++23 compliant: tested with C & C++ compilers
|
||||||
|
VisualStudio MinGW GCC Clang TinyCC IntelCC OpenWatcomC BorlandC SunCC
|
||||||
|
on Windows Mac Linux Bsd Solaris Minix Raspbian Flatpak Haiku
|
||||||
|
using Gnome Kde Mate Enlightenment Cinnamon Budgie Unity Lxde Lxqt Xfce
|
||||||
|
WindowMaker IceWm Cde Jds OpenBox Awesome Jwm Xdm Cwm
|
||||||
|
|
||||||
|
Bindings for LUA, C#, dll, Fortran, Pascal, R.
|
||||||
|
Included in LWJGL(java), Rust, Haskell, Allegrobasic.
|
||||||
|
____________________________________________________________________________
|
||||||
|
| ________________________________________________________________________ |
|
||||||
|
| | ____________________________________________________________________ | |
|
||||||
|
| | | If you like tinyfiledialogs, please upvote my stackoverflow answer | | |
|
||||||
|
| | | https://stackoverflow.com/a/47651444 | | |
|
||||||
|
| | |____________________________________________________________________| | |
|
||||||
|
| |________________________________________________________________________| |
|
||||||
|
|____________________________________________________________________________|
|
||||||
|
|
||||||
|
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
| v3.10: FORTRAN module fully implemented with examples |
|
||||||
|
| v3.13: PASCAL unit fully implemented with examples |
|
||||||
|
| v3.14: R inteface fully implemented with examples |
|
||||||
|
| v3.21: New HAIKU porting |
|
||||||
|
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
_____________________________________________________________________
|
||||||
|
| |
|
||||||
|
| my email address is at the top of the header file tinyfiledialogs.h |
|
||||||
|
|_____________________________________________________________________|
|
||||||
|
________________________________________________________________________________
|
||||||
|
| ____________________________________________________________________________ |
|
||||||
|
| | | |
|
||||||
|
| | - in tinyfiledialogs, char is UTF-8 by default (since v3.6) | |
|
||||||
|
| | | |
|
||||||
|
| | on windows: | |
|
||||||
|
| | - for UTF-16, use the wchar_t functions at the bottom of the header file | |
|
||||||
|
| | - _wfopen() requires wchar_t | |
|
||||||
|
| | | |
|
||||||
|
| | - but fopen() expects MBCS (not UTF-8) | |
|
||||||
|
| | - if you want char to be MBCS: set tinyfd_winUtf8 = 0 | |
|
||||||
|
| | | |
|
||||||
|
| | - alternatively, tinyfiledialogs provides | |
|
||||||
|
| | functions to convert between UTF-8, UTF-16 and MBCS | |
|
||||||
|
| |____________________________________________________________________________| |
|
||||||
|
|________________________________________________________________________________|
|
||||||
|
|
||||||
|
___________________________________________________________________________________
|
||||||
|
| _______________________________________________________________________________ |
|
||||||
|
| | | |
|
||||||
|
| | wchar_t UTF-16 (windows only) prototypes are at the bottom of the header file | |
|
||||||
|
| |_______________________________________________________________________________| |
|
||||||
|
|___________________________________________________________________________________|
|
||||||
|
|
||||||
|
__________________________________________
|
||||||
|
| ______________________________________ |
|
||||||
|
| | | |
|
||||||
|
| | DO NOT USE USER INPUT IN THE DIALOGS | |
|
||||||
|
| |______________________________________| |
|
||||||
|
|__________________________________________|
|
||||||
|
|
||||||
|
|
||||||
|
See compilation instructions at the end of this file
|
||||||
|
|
||||||
|
void tinyfd_beep();
|
||||||
|
|
||||||
|
int tinyfd_notifyPopup(
|
||||||
|
char const * aTitle , // NULL or ""
|
||||||
|
char const * aMessage , // NULL or "" may contain \n \t
|
||||||
|
char const * aIconType ); // "info" "warning" "error"
|
||||||
|
|
||||||
|
int tinyfd_messageBox(
|
||||||
|
char const * aTitle , // NULL or ""
|
||||||
|
char const * aMessage , // NULL or "" may contain \n \t
|
||||||
|
char const * aDialogType , // "ok" "okcancel" "yesno" "yesnocancel"
|
||||||
|
char const * aIconType , // "info" "warning" "error" "question"
|
||||||
|
int aDefaultButton );
|
||||||
|
// 0 for cancel/no , 1 for ok/yes , 2 for no in yesnocancel
|
||||||
|
|
||||||
|
char const * tinyfd_inputBox(
|
||||||
|
char const * aTitle , // NULL or ""
|
||||||
|
char const * aMessage , // NULL or "" (\n and \t have no effect)
|
||||||
|
char const * aDefaultInput ); // NULL for a passwordBox, "" for an inputbox
|
||||||
|
// returns NULL on cancel
|
||||||
|
|
||||||
|
char const * tinyfd_saveFileDialog(
|
||||||
|
char const * aTitle , // NULL or ""
|
||||||
|
char const * aDefaultPathAndOrFile , // NULL or "" , ends with / to set only a directory
|
||||||
|
int aNumOfFilterPatterns , // 0 (1 in the following example)
|
||||||
|
char const * const * aFilterPatterns , // NULL or char const * lFilterPatterns[1]={"*.txt"};
|
||||||
|
char const * aSingleFilterDescription ); // NULL or "text files"
|
||||||
|
// returns NULL on cancel
|
||||||
|
|
||||||
|
char const * tinyfd_openFileDialog(
|
||||||
|
char const * aTitle , // NULL or ""
|
||||||
|
char const * aDefaultPathAndOrFile , // NULL or "" , ends with / to set only a directory
|
||||||
|
int aNumOfFilterPatterns , // 0 (2 in the following example)
|
||||||
|
char const * const * aFilterPatterns , // NULL or char const * lFilterPatterns[2]={"*.png","*.jpg"};
|
||||||
|
char const * aSingleFilterDescription , // NULL or "image files"
|
||||||
|
int aAllowMultipleSelects ); // 0
|
||||||
|
// in case of multiple files, the separator is |
|
||||||
|
// returns NULL on cancel
|
||||||
|
|
||||||
|
char const * tinyfd_selectFolderDialog(
|
||||||
|
char const * aTitle , // NULL or ""
|
||||||
|
char const * aDefaultPath ); // NULL or ""
|
||||||
|
// returns NULL on cancel
|
||||||
|
|
||||||
|
char const * tinyfd_colorChooser(
|
||||||
|
char const * aTitle , // NULL or ""
|
||||||
|
char const * aDefaultHexRGB , // NULL or "#FF0000<30>ǥ
|
||||||
|
unsigned char const aDefaultRGB[3] , // unsigned char lDefaultRGB[3] = { 0 , 128 , 255 };
|
||||||
|
unsigned char aoResultRGB[3] ); // unsigned char lResultRGB[3];
|
||||||
|
// returns the hexcolor as a string "#FF0000"
|
||||||
|
// aoResultRGB also contains the result
|
||||||
|
// aDefaultRGB is used only if aDefaultHexRGB is NULL
|
||||||
|
// aDefaultRGB and aoResultRGB can be the same array
|
||||||
|
// returns NULL on cancel
|
||||||
|
___________________________________________________________________________________
|
||||||
|
| _______________________________________________________________________________ |
|
||||||
|
| | | |
|
||||||
|
| | wchar_t UTF-16 (windows only) prototypes are at the bottom of the header file | |
|
||||||
|
| |_______________________________________________________________________________| |
|
||||||
|
|___________________________________________________________________________________|
|
||||||
|
|
||||||
|
- This is not for ios nor android (it works in termux and iSH though).
|
||||||
|
- The files can be renamed with extension ".cpp" as the code is 100% compatible C C++
|
||||||
|
- Windows is fully supported from XP to 11 (maybe even older versions)
|
||||||
|
- C# & LUA via dll, see files in the folder EXTRAS
|
||||||
|
- OSX supported from 10.4 to latest (maybe even older versions)
|
||||||
|
- Do not use " and ' as the dialogs will be display with a warning
|
||||||
|
instead of the title, message, etc...
|
||||||
|
- There's one file filter only, it may contain several patterns.
|
||||||
|
- If no filter description is provided,
|
||||||
|
the list of patterns will become the description.
|
||||||
|
- On windows link against Comdlg32.lib and Ole32.lib
|
||||||
|
(on windows the no linking claim is a lie)
|
||||||
|
- On unix / macos: it only tries command line calls, so no linking is need.
|
||||||
|
- On unix /macos you need one of the following:
|
||||||
|
applescript, kdialog, zenity, matedialog, shellementary, qarma, shanty, boxer,
|
||||||
|
yad, python (2 or 3)with tkinter/python-dbus, Xdialog
|
||||||
|
or curses dialogs (opens terminal if running without console).
|
||||||
|
- One of those is already included on most (if not all) desktops.
|
||||||
|
- In the absence of those it will use gdialog, gxmessage or whiptail
|
||||||
|
with a textinputbox.
|
||||||
|
- If nothing is found, it switches to basic console input,
|
||||||
|
it opens a console if needed (requires xterm + bash).
|
||||||
|
- for curses dialogs you must set tinyfd_allowCursesDialogs=1
|
||||||
|
- You can query the type of dialog that will be used (pass "tinyfd_query" as aTitle)
|
||||||
|
- String memory is preallocated statically for all the returned values.
|
||||||
|
- File and path names are tested before return, they should be valid.
|
||||||
|
- tinyfd_forceConsole=1; at run time, forces dialogs into console mode.
|
||||||
|
- On windows, console mode only make sense for console applications.
|
||||||
|
- On windows, console mode is not implemented for wchar_T UTF-16.
|
||||||
|
- Mutiple selects are not possible in console mode.
|
||||||
|
- The package dialog must be installed to run in curses dialogs in console mode.
|
||||||
|
It is already installed on most unix systems.
|
||||||
|
- On osx, the package dialog can be installed via
|
||||||
|
http://macappstore.org/dialog or http://macports.org
|
||||||
|
- On windows, for curses dialogs console mode,
|
||||||
|
dialog.exe should be copied somewhere on your executable path.
|
||||||
|
It can be found at the bottom of the following page:
|
||||||
|
http://andrear.altervista.org/home/cdialog.php
|
||||||
|
_________________________________________________________________
|
||||||
|
| The project provides an Hello World example: |
|
||||||
|
| if a console is missing, it will use graphic dialogs |
|
||||||
|
| if a graphical display is absent, it will use console dialogs |
|
||||||
|
|_________________________________________________________________|
|
||||||
|
|
||||||
|
|
||||||
|
UNIX (including MacOS) :
|
||||||
|
$ clang -o hello hello.c tinyfiledialogs.c
|
||||||
|
( or gcc tcc owcc icx suncc )
|
||||||
|
( or g++ clang++ icpx sunCC )
|
||||||
|
( some possible options :
|
||||||
|
-ansi -std=c89 -std=c++98 -pedantic -Wstrict-prototypes
|
||||||
|
-g3 -Wall -Wextra -Wdouble-promotion -Wconversion -Wno-sign-conversion
|
||||||
|
-Wno-unused-parameter -Wno-unused-function -fsanitize=undefined -fsanitize=thread
|
||||||
|
-Wno-deprecated -Wno-incompatible-compiler )
|
||||||
|
( if using musl instead of glibc: clang -fuse-ld=lld --rtlib=compiler-rt )
|
||||||
|
|
||||||
|
_____________________________________________________________________________
|
||||||
|
| Windows : |
|
||||||
|
| You'll probably need to install The Windows SDK (Software Development Kit) |
|
||||||
|
| http://developer.microsoft.com/en-us/windows/downloads/windows-sdk |
|
||||||
|
| The end user doesn't need to install anything |
|
||||||
|
|_____________________________________________________________________________|
|
||||||
|
|
||||||
|
MinGW needs gcc >= v4.9 otherwise some headers are incomplete
|
||||||
|
> gcc -o hello.exe hello.c tinyfiledialogs.c -LC:/mingw/lib -lcomdlg32 -lole32
|
||||||
|
|
||||||
|
TinyCC needs >= v0.9.27 (+ tweaks - contact me) otherwise some headers are missing
|
||||||
|
> tcc -o hello.exe hello.c tinyfiledialogs.c ^
|
||||||
|
-isystem C:\tcc\winapi-full-for-0.9.27\include\winapi ^
|
||||||
|
-lcomdlg32 -lole32 -luser32 -lshell32
|
||||||
|
|
||||||
|
Embarcadero / Borland C :
|
||||||
|
> bcc32c -o hello.exe hello.c tinyfiledialogs.c
|
||||||
|
|
||||||
|
Open Watcom C v2
|
||||||
|
> owcc -o hello.exe hello.c tinyfiledialogs.c
|
||||||
|
|
||||||
|
Windows Intel C :
|
||||||
|
> icx-cc -o hello.exe hello.c tinyfiledialogs.c -lcomdlg32 -lole32 -luser32 -lshell32
|
||||||
|
> icx-cl -o hello.exe hello.c tinyfiledialogs.c comdlg32.lib ole32.lib user32.lib shell32.lib
|
||||||
|
> icx -o hello.exe hello.c tinyfiledialogs.c comdlg32.lib ole32.lib user32.lib shell32.lib
|
||||||
|
> icpx -o hello.exe hello.c tinyfiledialogs.c -lcomdlg32 -lole32 -luser32 -lshell32 -Wno-deprecated
|
||||||
|
|
||||||
|
VisualStudio command line :
|
||||||
|
> cl hello.c tinyfiledialogs.c comdlg32.lib ole32.lib user32.lib shell32.lib /W4
|
||||||
|
|
||||||
|
VisualStudio
|
||||||
|
In the properties of your project, in the linker input field,
|
||||||
|
you may need to add: comdlg32.lib ole32.lib user32.lib shell32.lib
|
||||||
|
or maybe simply add: %(AdditionalDependencies)
|
||||||
8401
Prism/vendor/TinyFileDialog/tinyfiledialogs.c
vendored
Normal file
8401
Prism/vendor/TinyFileDialog/tinyfiledialogs.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
314
Prism/vendor/TinyFileDialog/tinyfiledialogs.h
vendored
Normal file
314
Prism/vendor/TinyFileDialog/tinyfiledialogs.h
vendored
Normal file
@ -0,0 +1,314 @@
|
|||||||
|
/* SPDX-License-Identifier: Zlib
|
||||||
|
Copyright (c) 2014 - 2025 Guillaume Vareille http://ysengrin.com
|
||||||
|
____________________________________________________________________
|
||||||
|
| |
|
||||||
|
| 100% compatible C C++ -> You can rename tinfiledialogs.c as .cpp |
|
||||||
|
|____________________________________________________________________|
|
||||||
|
|
||||||
|
********* TINY FILE DIALOGS OFFICIAL WEBSITE IS ON SOURCEFORGE *********
|
||||||
|
_________
|
||||||
|
/ \ tinyfiledialogs.h v3.21.2 [Oct 25, 2025]
|
||||||
|
|tiny file| Unique header file created [November 9, 2014]
|
||||||
|
| dialogs |
|
||||||
|
\____ ___/ http://tinyfiledialogs.sourceforge.net
|
||||||
|
\| git clone http://git.code.sf.net/p/tinyfiledialogs/code tinyfd
|
||||||
|
____________________________________________
|
||||||
|
| |
|
||||||
|
| email: tinyfiledialogs at ysengrin.com |
|
||||||
|
|____________________________________________|
|
||||||
|
________________________________________________________________________________
|
||||||
|
| ____________________________________________________________________________ |
|
||||||
|
| | | |
|
||||||
|
| | - in tinyfiledialogs, char is UTF-8 by default (since v3.6) | |
|
||||||
|
| | | |
|
||||||
|
| | on windows: | |
|
||||||
|
| | - for UTF-16, use the wchar_t functions at the bottom of the header file | |
|
||||||
|
| | | |
|
||||||
|
| | - _wfopen() requires wchar_t | |
|
||||||
|
| | - fopen() uses char but expects ASCII or MBCS (not UTF-8) | |
|
||||||
|
| | - if you want char to be MBCS: set tinyfd_winUtf8 to 0 | |
|
||||||
|
| | | |
|
||||||
|
| | - alternatively, tinyfiledialogs provides | |
|
||||||
|
| | functions to convert between UTF-8, UTF-16 and MBCS | |
|
||||||
|
| |____________________________________________________________________________| |
|
||||||
|
|________________________________________________________________________________|
|
||||||
|
|
||||||
|
If you like tinyfiledialogs, please upvote my stackoverflow answer
|
||||||
|
https://stackoverflow.com/a/47651444
|
||||||
|
|
||||||
|
- License -
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
|
__________________________________________
|
||||||
|
| ______________________________________ |
|
||||||
|
| | | |
|
||||||
|
| | DO NOT USE USER INPUT IN THE DIALOGS | |
|
||||||
|
| |______________________________________| |
|
||||||
|
|__________________________________________|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TINYFILEDIALOGS_H
|
||||||
|
#define TINYFILEDIALOGS_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/******************************************************************************************************/
|
||||||
|
/**************************************** UTF-8 on Windows ********************************************/
|
||||||
|
/******************************************************************************************************/
|
||||||
|
#ifdef _WIN32
|
||||||
|
/* On windows, if you want to use UTF-8 ( instead of the UTF-16/wchar_t functions at the end of this file )
|
||||||
|
Make sure your code is really prepared for UTF-8 (on windows, functions like fopen() expect MBCS and not UTF-8) */
|
||||||
|
extern int tinyfd_winUtf8; /* on windows char strings can be 1:UTF-8(default) or 0:MBCS */
|
||||||
|
/* for MBCS change this to 0, in tinyfiledialogs.c or in your code */
|
||||||
|
|
||||||
|
/* Here are some functions to help you convert between UTF-16 UTF-8 MBSC */
|
||||||
|
char * tinyfd_utf8toMbcs(char const * aUtf8string);
|
||||||
|
char * tinyfd_utf16toMbcs(wchar_t const * aUtf16string);
|
||||||
|
wchar_t * tinyfd_mbcsTo16(char const * aMbcsString);
|
||||||
|
char * tinyfd_mbcsTo8(char const * aMbcsString);
|
||||||
|
wchar_t * tinyfd_utf8to16(char const * aUtf8string);
|
||||||
|
char * tinyfd_utf16to8(wchar_t const * aUtf16string);
|
||||||
|
#endif
|
||||||
|
/******************************************************************************************************/
|
||||||
|
/******************************************************************************************************/
|
||||||
|
/******************************************************************************************************/
|
||||||
|
|
||||||
|
/************* 3 funtions for C# (you don't need this in C or C++) : */
|
||||||
|
char const * tinyfd_getGlobalChar(char const * aCharVariableName); /* returns NULL on error */
|
||||||
|
int tinyfd_getGlobalInt(char const * aIntVariableName); /* returns -1 on error */
|
||||||
|
int tinyfd_setGlobalInt(char const * aIntVariableName, int aValue); /* returns -1 on error */
|
||||||
|
/* aCharVariableName: "tinyfd_version" "tinyfd_needs" "tinyfd_response"
|
||||||
|
aIntVariableName : "tinyfd_verbose" "tinyfd_silent" "tinyfd_allowCursesDialogs"
|
||||||
|
"tinyfd_forceConsole" "tinyfd_assumeGraphicDisplay" "tinyfd_winUtf8"
|
||||||
|
**************/
|
||||||
|
|
||||||
|
extern char tinyfd_version[8]; /* contains tinyfd current version number */
|
||||||
|
extern char tinyfd_needs[]; /* info about requirements */
|
||||||
|
extern int tinyfd_verbose; /* 0 (default) or 1 : on unix, prints the command line calls */
|
||||||
|
extern int tinyfd_silent; /* 1 (default) or 0 : on unix, hide errors and warnings from called dialogs */
|
||||||
|
|
||||||
|
/** Curses dialogs are difficult to use and counter-intuitive.
|
||||||
|
On windows they are only ascii and still uses the unix backslash ! **/
|
||||||
|
extern int tinyfd_allowCursesDialogs; /* 0 (default) or 1 */
|
||||||
|
|
||||||
|
extern int tinyfd_forceConsole; /* 0 (default) or 1 */
|
||||||
|
/* for unix & windows: 0 (graphic mode) or 1 (console mode).
|
||||||
|
0: try to use a graphic solution, if it fails then it uses console mode.
|
||||||
|
1: forces all dialogs into console mode even when an X server is present.
|
||||||
|
if enabled, it can use the package Dialog or dialog.exe.
|
||||||
|
on windows it only make sense for console applications */
|
||||||
|
|
||||||
|
/* extern int tinyfd_assumeGraphicDisplay; */ /* 0 (default) or 1 */
|
||||||
|
/* some systems don't set the environment variable DISPLAY even when a graphic display is present.
|
||||||
|
set this to 1 to tell tinyfiledialogs to assume the existence of a graphic display */
|
||||||
|
|
||||||
|
extern char tinyfd_response[1024];
|
||||||
|
/* if you pass "tinyfd_query" as aTitle,
|
||||||
|
the functions will not display the dialogs
|
||||||
|
but will return 0 for console mode, 1 for graphic mode.
|
||||||
|
tinyfd_response is then filled with the retain solution.
|
||||||
|
possible values for tinyfd_response are (all lowercase)
|
||||||
|
for graphic mode:
|
||||||
|
windows_wchar windows applescript kdialog zenity zenity3 yad matedialog
|
||||||
|
shellementary qarma shanty boxer python2-tkinter python3-tkinter python-dbus
|
||||||
|
perl-dbus gxmessage gmessage xmessage xdialog gdialog dunst
|
||||||
|
for console mode:
|
||||||
|
dialog whiptail basicinput no_solution */
|
||||||
|
|
||||||
|
void tinyfd_beep(void);
|
||||||
|
|
||||||
|
int tinyfd_notifyPopup(
|
||||||
|
char const * aTitle, /* NULL or "" */
|
||||||
|
char const * aMessage, /* NULL or "" may contain \n \t */
|
||||||
|
char const * aIconType); /* "info" "warning" "error" */
|
||||||
|
/* return has only meaning for tinyfd_query */
|
||||||
|
|
||||||
|
int tinyfd_messageBox(
|
||||||
|
char const * aTitle , /* NULL or "" */
|
||||||
|
char const * aMessage , /* NULL or "" may contain \n \t */
|
||||||
|
char const * aDialogType , /* "ok" "okcancel" "yesno" "yesnocancel" */
|
||||||
|
char const * aIconType , /* "info" "warning" "error" "question" */
|
||||||
|
int aDefaultButton ) ;
|
||||||
|
/* 0 for cancel/no , 1 for ok/yes , 2 for no in yesnocancel */
|
||||||
|
|
||||||
|
char * tinyfd_inputBox(
|
||||||
|
char const * aTitle , /* NULL or "" */
|
||||||
|
char const * aMessage , /* NULL or "" (\n and \t have no effect) */
|
||||||
|
char const * aDefaultInput ) ; /* NULL = passwordBox, "" = inputbox */
|
||||||
|
/* returns NULL on cancel */
|
||||||
|
|
||||||
|
char * tinyfd_saveFileDialog(
|
||||||
|
char const * aTitle , /* NULL or "" */
|
||||||
|
char const * aDefaultPathAndOrFile , /* NULL or "" , ends with / to set only a directory */
|
||||||
|
int aNumOfFilterPatterns , /* 0 (1 in the following example) */
|
||||||
|
char const * const * aFilterPatterns , /* NULL or char const * lFilterPatterns[1]={"*.txt"} */
|
||||||
|
char const * aSingleFilterDescription ) ; /* NULL or "text files" */
|
||||||
|
/* returns NULL on cancel */
|
||||||
|
|
||||||
|
char * tinyfd_openFileDialog(
|
||||||
|
char const * aTitle, /* NULL or "" */
|
||||||
|
char const * aDefaultPathAndOrFile, /* NULL or "" , ends with / to set only a directory */
|
||||||
|
int aNumOfFilterPatterns , /* 0 (2 in the following example) */
|
||||||
|
char const * const * aFilterPatterns, /* NULL or char const * lFilterPatterns[2]={"*.png","*.jpg"}; */
|
||||||
|
char const * aSingleFilterDescription, /* NULL or "image files" */
|
||||||
|
int aAllowMultipleSelects ) ; /* 0 or 1 */
|
||||||
|
/* in case of multiple files, the separator is | */
|
||||||
|
/* returns NULL on cancel */
|
||||||
|
|
||||||
|
char * tinyfd_selectFolderDialog(
|
||||||
|
char const * aTitle, /* NULL or "" */
|
||||||
|
char const * aDefaultPath); /* NULL or "" */
|
||||||
|
/* returns NULL on cancel */
|
||||||
|
|
||||||
|
char * tinyfd_colorChooser(
|
||||||
|
char const * aTitle, /* NULL or "" */
|
||||||
|
char const * aDefaultHexRGB, /* NULL or "" or "#FF0000" */
|
||||||
|
unsigned char const aDefaultRGB[3] , /* unsigned char lDefaultRGB[3] = { 0 , 128 , 255 }; */
|
||||||
|
unsigned char aoResultRGB[3] ) ; /* unsigned char lResultRGB[3]; */
|
||||||
|
/* aDefaultRGB is used only if aDefaultHexRGB is absent */
|
||||||
|
/* aDefaultRGB and aoResultRGB can be the same array */
|
||||||
|
/* returns NULL on cancel */
|
||||||
|
/* returns the hexcolor as a string "#FF0000" */
|
||||||
|
/* aoResultRGB also contains the result */
|
||||||
|
|
||||||
|
|
||||||
|
/************ WINDOWS ONLY SECTION ************************/
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
/* windows only - utf-16 version */
|
||||||
|
int tinyfd_notifyPopupW(
|
||||||
|
wchar_t const * aTitle, /* NULL or L"" */
|
||||||
|
wchar_t const * aMessage, /* NULL or L"" may contain \n \t */
|
||||||
|
wchar_t const * aIconType); /* L"info" L"warning" L"error" */
|
||||||
|
|
||||||
|
/* windows only - utf-16 version */
|
||||||
|
int tinyfd_messageBoxW(
|
||||||
|
wchar_t const * aTitle, /* NULL or L"" */
|
||||||
|
wchar_t const * aMessage, /* NULL or L"" may contain \n \t */
|
||||||
|
wchar_t const * aDialogType, /* L"ok" L"okcancel" L"yesno" */
|
||||||
|
wchar_t const * aIconType, /* L"info" L"warning" L"error" L"question" */
|
||||||
|
int aDefaultButton ); /* 0 for cancel/no , 1 for ok/yes */
|
||||||
|
/* returns 0 for cancel/no , 1 for ok/yes */
|
||||||
|
|
||||||
|
/* windows only - utf-16 version */
|
||||||
|
wchar_t * tinyfd_inputBoxW(
|
||||||
|
wchar_t const * aTitle, /* NULL or L"" */
|
||||||
|
wchar_t const * aMessage, /* NULL or L"" (\n nor \t not respected) */
|
||||||
|
wchar_t const * aDefaultInput); /* NULL passwordBox, L"" inputbox */
|
||||||
|
|
||||||
|
/* windows only - utf-16 version */
|
||||||
|
wchar_t * tinyfd_saveFileDialogW(
|
||||||
|
wchar_t const * aTitle, /* NULL or L"" */
|
||||||
|
wchar_t const * aDefaultPathAndOrFile, /* NULL or L"" , ends with / to set only a directory */
|
||||||
|
int aNumOfFilterPatterns, /* 0 (1 in the following example) */
|
||||||
|
wchar_t const * const * aFilterPatterns, /* NULL or wchar_t const * lFilterPatterns[1]={L"*.txt"} */
|
||||||
|
wchar_t const * aSingleFilterDescription); /* NULL or L"text files" */
|
||||||
|
/* returns NULL on cancel */
|
||||||
|
|
||||||
|
/* windows only - utf-16 version */
|
||||||
|
wchar_t * tinyfd_openFileDialogW(
|
||||||
|
wchar_t const * aTitle, /* NULL or L"" */
|
||||||
|
wchar_t const * aDefaultPathAndOrFile, /* NULL or L"" , ends with / to set only a directory */
|
||||||
|
int aNumOfFilterPatterns , /* 0 (2 in the following example) */
|
||||||
|
wchar_t const * const * aFilterPatterns, /* NULL or wchar_t const * lFilterPatterns[2]={L"*.png","*.jpg"} */
|
||||||
|
wchar_t const * aSingleFilterDescription, /* NULL or L"image files" */
|
||||||
|
int aAllowMultipleSelects ) ; /* 0 or 1 */
|
||||||
|
/* in case of multiple files, the separator is | */
|
||||||
|
/* returns NULL on cancel */
|
||||||
|
|
||||||
|
/* windows only - utf-16 version */
|
||||||
|
wchar_t * tinyfd_selectFolderDialogW(
|
||||||
|
wchar_t const * aTitle, /* NULL or L"" */
|
||||||
|
wchar_t const * aDefaultPath); /* NULL or L"" */
|
||||||
|
/* returns NULL on cancel */
|
||||||
|
|
||||||
|
/* windows only - utf-16 version */
|
||||||
|
wchar_t * tinyfd_colorChooserW(
|
||||||
|
wchar_t const * aTitle, /* NULL or L"" */
|
||||||
|
wchar_t const * aDefaultHexRGB, /* NULL or L"#FF0000" */
|
||||||
|
unsigned char const aDefaultRGB[3], /* unsigned char lDefaultRGB[3] = { 0 , 128 , 255 }; */
|
||||||
|
unsigned char aoResultRGB[3]); /* unsigned char lResultRGB[3]; */
|
||||||
|
/* returns the hexcolor as a string L"#FF0000" */
|
||||||
|
/* aoResultRGB also contains the result */
|
||||||
|
/* aDefaultRGB is used only if aDefaultHexRGB is NULL */
|
||||||
|
/* aDefaultRGB and aoResultRGB can be the same array */
|
||||||
|
/* returns NULL on cancel */
|
||||||
|
|
||||||
|
#endif /*_WIN32 */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /*extern "C"*/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* TINYFILEDIALOGS_H */
|
||||||
|
|
||||||
|
/*
|
||||||
|
________________________________________________________________________________
|
||||||
|
| ____________________________________________________________________________ |
|
||||||
|
| | | |
|
||||||
|
| | on windows: | |
|
||||||
|
| | - for UTF-16, use the wchar_t functions at the bottom of the header file | |
|
||||||
|
| | - _wfopen() requires wchar_t | |
|
||||||
|
| | | |
|
||||||
|
| | - in tinyfiledialogs, char is UTF-8 by default (since v3.6) | |
|
||||||
|
| | - but fopen() expects MBCS (not UTF-8) | |
|
||||||
|
| | - if you want char to be MBCS: set tinyfd_winUtf8 to 0 | |
|
||||||
|
| | | |
|
||||||
|
| | - alternatively, tinyfiledialogs provides | |
|
||||||
|
| | functions to convert between UTF-8, UTF-16 and MBCS | |
|
||||||
|
| |____________________________________________________________________________| |
|
||||||
|
|________________________________________________________________________________|
|
||||||
|
|
||||||
|
- This is not for ios nor android (it works in termux though).
|
||||||
|
- The files can be renamed with extension ".cpp" as the code is 100% compatible C C++
|
||||||
|
(just comment out << extern "C" >> in the header file)
|
||||||
|
- Windows is fully supported from XP to 10 (maybe even older versions)
|
||||||
|
- C# & LUA via dll, see files in the folder EXTRAS
|
||||||
|
- OSX supported from 10.4 to latest (maybe even older versions)
|
||||||
|
- Do not use " and ' as the dialogs will be displayed with a warning
|
||||||
|
instead of the title, message, etc...
|
||||||
|
- There's one file filter only, it may contain several patterns.
|
||||||
|
- If no filter description is provided,
|
||||||
|
the list of patterns will become the description.
|
||||||
|
- On windows link against Comdlg32.lib and Ole32.lib
|
||||||
|
(on windows the no linking claim is a lie)
|
||||||
|
- On unix: it tries command line calls, so no such need (NO LINKING).
|
||||||
|
- On unix you need one of the following:
|
||||||
|
applescript, kdialog, zenity, matedialog, shellementary, qarma, shanty, boxer,
|
||||||
|
yad, python (2 or 3)/tkinter/python-dbus (optional), Xdialog
|
||||||
|
or curses dialogs (opens terminal if running without console).
|
||||||
|
- One of those is already included on most (if not all) desktops.
|
||||||
|
- In the absence of those it will use gdialog, gxmessage or whiptail
|
||||||
|
with a textinputbox. If nothing is found, it switches to basic console input,
|
||||||
|
it opens a console if needed (requires xterm + bash).
|
||||||
|
- for curses dialogs you must set tinyfd_allowCursesDialogs=1
|
||||||
|
- You can query the type of dialog that will be used (pass "tinyfd_query" as aTitle)
|
||||||
|
- String memory is preallocated statically for all the returned values.
|
||||||
|
- File and path names are tested before return, they should be valid.
|
||||||
|
- tinyfd_forceConsole=1; at run time, forces dialogs into console mode.
|
||||||
|
- On windows, console mode only make sense for console applications.
|
||||||
|
- On windows, console mode is not implemented for wchar_T UTF-16.
|
||||||
|
- Mutiple selects are not possible in console mode.
|
||||||
|
- The package dialog must be installed to run in curses dialogs in console mode.
|
||||||
|
It is already installed on most unix systems.
|
||||||
|
- On osx, the package dialog can be installed via
|
||||||
|
http://macappstore.org/dialog or http://macports.org
|
||||||
|
- On windows, for curses dialogs console mode,
|
||||||
|
dialog.exe should be copied somewhere on your executable path.
|
||||||
|
It can be found at the bottom of the following page:
|
||||||
|
http://andrear.altervista.org/home/cdialog.php
|
||||||
|
*/
|
||||||
@ -87,7 +87,7 @@ void DemoLayer::OnDetach()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DemoLayer::OnUpdate()
|
void DemoLayer::OnUpdate(Prism::TimeStep deltaTime)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
// THINGS TO LOOK AT:
|
// THINGS TO LOOK AT:
|
||||||
@ -97,7 +97,7 @@ void DemoLayer::OnUpdate()
|
|||||||
using namespace Prism;
|
using namespace Prism;
|
||||||
using namespace glm;
|
using namespace glm;
|
||||||
|
|
||||||
m_Camera.Update();
|
m_Camera.Update(deltaTime);
|
||||||
auto viewProjection = m_Camera.GetProjectionMatrix() * m_Camera.GetViewMatrix();
|
auto viewProjection = m_Camera.GetProjectionMatrix() * m_Camera.GetViewMatrix();
|
||||||
|
|
||||||
m_Framebuffer->Bind();
|
m_Framebuffer->Bind();
|
||||||
|
|||||||
@ -18,7 +18,7 @@ public:
|
|||||||
|
|
||||||
virtual void OnAttach() override;
|
virtual void OnAttach() override;
|
||||||
virtual void OnDetach() override;
|
virtual void OnDetach() override;
|
||||||
virtual void OnUpdate() override;
|
virtual void OnUpdate(Prism::TimeStep deltaTime) override;
|
||||||
virtual void OnImGuiRender() override;
|
virtual void OnImGuiRender() override;
|
||||||
virtual void OnEvent(Prism::Event& e) override;
|
virtual void OnEvent(Prism::Event& e) override;
|
||||||
|
|
||||||
|
|||||||
@ -183,10 +183,10 @@ void TestLayer::OnDetach()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestLayer::OnUpdate()
|
void TestLayer::OnUpdate(Prism::TimeStep deltaTime)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_Camera.Update();
|
m_Camera.Update(deltaTime);
|
||||||
auto viewProjection = m_Camera.GetProjectionMatrix() * m_Camera.GetViewMatrix();
|
auto viewProjection = m_Camera.GetProjectionMatrix() * m_Camera.GetViewMatrix();
|
||||||
|
|
||||||
m_FrameBuffer->Bind();
|
m_FrameBuffer->Bind();
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public:
|
|||||||
TestLayer();
|
TestLayer();
|
||||||
void OnAttach() override;
|
void OnAttach() override;
|
||||||
void OnDetach() override;
|
void OnDetach() override;
|
||||||
void OnUpdate() override;
|
void OnUpdate(Prism::TimeStep deltaTime) override;
|
||||||
void OnImGuiRender() override;
|
void OnImGuiRender() override;
|
||||||
void OnEvent(Prism::Event& e) override;
|
void OnEvent(Prism::Event& e) override;
|
||||||
|
|
||||||
|
|||||||
@ -18,8 +18,8 @@ public:
|
|||||||
|
|
||||||
virtual void OnInit() override
|
virtual void OnInit() override
|
||||||
{
|
{
|
||||||
PushLayer(new TestLayer());
|
// PushLayer(new TestLayer());
|
||||||
// PushLayer(new DemoLayer());
|
PushLayer(new DemoLayer());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user