add ve name

This commit is contained in:
2025-03-13 15:29:33 +03:00
parent 77b626fb8c
commit c3ee3d3942
9 changed files with 58 additions and 40 deletions

View File

@@ -20,7 +20,7 @@ namespace VE
// что не есть хорошо для умных указателей
GLFWwindow* m_win;
std::unique_ptr<context> m_context;
mt::vec4 m_bgcolor = { 0.1f, 0.1f, 0.1f, 1.f };
glm::vec4 m_bgcolor = { 0.1f, 0.1f, 0.1f, 1.f };
struct win_data
{

View File

@@ -1,5 +1,7 @@
#pragma once
#include <glm/gtc/type_ptr.hpp>
#include "utils/utils.hpp" // IWYU pragma: keep
namespace VE
@@ -17,11 +19,11 @@ namespace VE
GLuint get_id() const noexcept;
public:
void set(std::string location, mt::vec2 value);
void set(std::string location, mt::vec3 value);
void set(std::string location, mt::vec4 value);
void set(std::string location, mt::mat3 value);
void set(std::string location, mt::mat4 value);
void set(std::string location, glm::vec2 value);
void set(std::string location, glm::vec3 value);
void set(std::string location, glm::vec4 value);
void set(std::string location, glm::mat3 value);
void set(std::string location, glm::mat4 value);
void set(std::string location, float value);
void set(std::string location, int value);

View File

@@ -17,3 +17,5 @@
#define VE_PUSH_FONT(def_font, def_size)\
ImGui::PushFont(VE::style::fonts::get_font(VE::style::fonts::font_type::def_font, def_size))
#define VE_POP_FONT() ImGui::PopFont()
#define VE_NAME(n) VE::func::name(n).data()

26
src/utils/func.hpp Normal file
View File

@@ -0,0 +1,26 @@
#pragma once
#include <string>
#include <imgui.h>
namespace VE::func
{
inline auto name(std::string n)
{
return "##" + n;
}
inline ImU32 color(std::string hex, unsigned char alpha = 255)
{
if (hex[0] == '#') hex.erase(0, 1);
unsigned int r = 255;
unsigned int g = 255;
unsigned int b = 255;
if (hex.length() == 6) std::sscanf(hex.c_str(), "%2x%2x%2x", &r, &g, &b);
return IM_COL32(r, g, b, alpha);
}
}

View File

@@ -22,10 +22,12 @@
второй это поставить glad первым
*/
#include <glad.h> // IWYU pragma: keep
#include <GLFW/glfw3.h> // IWYU pragma: keep
#include <hack/logger/logger.hpp> // IWYU pragma: keep
#include <hack/patterns/singleton.hpp> // IWYU pragma: keep
#include <imgui.h> // IWYU pragma: keep
#include <imgui_impl_glfw.h> // IWYU pragma: keep
#include <imgui_impl_opengl3.h> // IWYU pragma: keep
#include <glad.h>
#include <GLFW/glfw3.h>
#include <hack/logger/logger.hpp>
#include <hack/patterns/singleton.hpp>
#include <imgui.h>
#include <imgui_impl_glfw.h>
#include <imgui_impl_opengl3.h>
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>

View File

@@ -1,14 +0,0 @@
#pragma once
#include <glm/gtc/type_ptr.hpp>
namespace mt
{
using namespace glm;
template<typename T>
T convert(vec2& v) { return T{ v.x, v.y }; }
template<typename T>
T convert(vec3& v) { return T{ v.x, v.y, v.z }; }
}

View File

@@ -6,4 +6,4 @@
#include "var.hpp" // IWYU pragma: keep
#include "include.hpp" // IWYU pragma: keep
#include "using.hpp" // IWYU pragma: keep
#include "math.hpp" // IWYU pragma: keep
#include "func.hpp" // IWYU pragma: keep