Compare commits
No commits in common. "c57e5a56ace419b65eef7d9a8a2ca4ed4fa0f38c" and "60ad7cdc709005dba7bce7a9d1a8331b13756338" have entirely different histories.
c57e5a56ac
...
60ad7cdc70
8 changed files with 50 additions and 259 deletions
|
@ -52,7 +52,7 @@ public:
|
||||||
m_window = m_editor_registry->create_entity("Editor Window");
|
m_window = m_editor_registry->create_entity("Editor Window");
|
||||||
m_window.add_component<SurfaceComponent>(SurfaceComponent::CreateInfo {
|
m_window.add_component<SurfaceComponent>(SurfaceComponent::CreateInfo {
|
||||||
.title = "Editor Window",
|
.title = "Editor Window",
|
||||||
.resolution = { 800u, 600u },
|
.size = { 800u, 600u },
|
||||||
.vsync = true,
|
.vsync = true,
|
||||||
.visible = true,
|
.visible = true,
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,4 +13,4 @@ target_link_libraries(surface PUBLIC
|
||||||
)
|
)
|
||||||
|
|
||||||
add_test_module(surface system.test.cpp)
|
add_test_module(surface system.test.cpp)
|
||||||
add_fuzz_module(surface system.fuzz.cpp)
|
target_link_libraries(surface_tests PRIVATE glfw)
|
||||||
|
|
|
@ -5,11 +5,6 @@
|
||||||
|
|
||||||
namespace lt::surface {
|
namespace lt::surface {
|
||||||
|
|
||||||
void glfw_error_callbac(int32_t code, const char *description)
|
|
||||||
{
|
|
||||||
log_err("GLFW ERROR: {} -> {}", code, description);
|
|
||||||
}
|
|
||||||
|
|
||||||
void handle_event(GLFWwindow *window, const SurfaceComponent::Event &event)
|
void handle_event(GLFWwindow *window, const SurfaceComponent::Event &event)
|
||||||
{
|
{
|
||||||
auto &callbacks = *static_cast<std::vector<SurfaceComponent::EventCallback> *>(
|
auto &callbacks = *static_cast<std::vector<SurfaceComponent::EventCallback> *>(
|
||||||
|
@ -97,15 +92,9 @@ void bind_glfw_events(GLFWwindow *handle)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_glfw() {};
|
|
||||||
|
|
||||||
System::System(Ref<ecs::Registry> registry): m_registry(std::move(registry))
|
System::System(Ref<ecs::Registry> registry): m_registry(std::move(registry))
|
||||||
{
|
{
|
||||||
glfwSetErrorCallback(&glfw_error_callbac);
|
|
||||||
ensure(glfwInit(), "Failed to initialize 'glfw'");
|
|
||||||
|
|
||||||
ensure(m_registry, "Failed to initialize surface system: null registry");
|
ensure(m_registry, "Failed to initialize surface system: null registry");
|
||||||
|
|
||||||
ensure(
|
ensure(
|
||||||
m_registry->view<SurfaceComponent>().size() == 0,
|
m_registry->view<SurfaceComponent>().size() == 0,
|
||||||
"Failed to initialize surface system: registry has surface component(s)"
|
"Failed to initialize surface system: registry has surface component(s)"
|
||||||
|
@ -140,6 +129,7 @@ System::~System()
|
||||||
|
|
||||||
|
|
||||||
m_registry->view<SurfaceComponent>().each([&](const entt::entity entity, SurfaceComponent &) {
|
m_registry->view<SurfaceComponent>().each([&](const entt::entity entity, SurfaceComponent &) {
|
||||||
|
std::cout << "REMOVED SURFACE COMPONENT ON DESTRUCTION" << std::endl;
|
||||||
m_registry->get_entt_registry().remove<SurfaceComponent>(entity);
|
m_registry->get_entt_registry().remove<SurfaceComponent>(entity);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -148,18 +138,19 @@ System::~System()
|
||||||
|
|
||||||
void System::on_surface_construct(entt::registry ®istry, entt::entity entity)
|
void System::on_surface_construct(entt::registry ®istry, entt::entity entity)
|
||||||
{
|
{
|
||||||
try
|
ensure(glfwInit(), "Failed to initialize 'glfw'");
|
||||||
{
|
|
||||||
auto &surface = registry.get<SurfaceComponent>(entity);
|
|
||||||
ensure_component_sanity(surface);
|
|
||||||
|
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
|
||||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||||
|
// glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
||||||
|
|
||||||
|
auto &surface = registry.get<SurfaceComponent>(entity);
|
||||||
|
auto [width, height] = surface.get_size();
|
||||||
|
|
||||||
surface.m_glfw_handle = glfwCreateWindow(
|
surface.m_glfw_handle = glfwCreateWindow(
|
||||||
static_cast<int>(surface.get_resolution().x),
|
static_cast<int32_t>(width),
|
||||||
static_cast<int>(surface.get_resolution().y),
|
static_cast<int32_t>(height),
|
||||||
surface.get_title().begin(),
|
surface.get_title().begin(),
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr
|
nullptr
|
||||||
|
@ -169,12 +160,6 @@ void System::on_surface_construct(entt::registry ®istry, entt::entity entity)
|
||||||
glfwSetWindowUserPointer(surface.m_glfw_handle, &surface.m_event_callbacks);
|
glfwSetWindowUserPointer(surface.m_glfw_handle, &surface.m_event_callbacks);
|
||||||
surface.m_native_handle = glfwGetX11Window(surface.m_glfw_handle);
|
surface.m_native_handle = glfwGetX11Window(surface.m_glfw_handle);
|
||||||
bind_glfw_events(surface.m_glfw_handle);
|
bind_glfw_events(surface.m_glfw_handle);
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
registry.remove<SurfaceComponent>(entity);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::on_surface_update(entt::registry ®istry, entt::entity entity)
|
void System::on_surface_update(entt::registry ®istry, entt::entity entity)
|
||||||
|
@ -186,11 +171,7 @@ void System::on_surface_update(entt::registry ®istry, entt::entity entity)
|
||||||
void System::on_surface_destroy(entt::registry ®istry, entt::entity entity)
|
void System::on_surface_destroy(entt::registry ®istry, entt::entity entity)
|
||||||
{
|
{
|
||||||
auto &surface = registry.get<SurfaceComponent>(entity);
|
auto &surface = registry.get<SurfaceComponent>(entity);
|
||||||
|
|
||||||
if (surface.m_glfw_handle)
|
|
||||||
{
|
|
||||||
glfwDestroyWindow(surface.m_glfw_handle);
|
glfwDestroyWindow(surface.m_glfw_handle);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::set_title(ecs::Entity entity, std::string_view new_title)
|
void System::set_title(ecs::Entity entity, std::string_view new_title)
|
||||||
|
@ -198,15 +179,11 @@ void System::set_title(ecs::Entity entity, std::string_view new_title)
|
||||||
auto &surface = entity.get_component<SurfaceComponent>();
|
auto &surface = entity.get_component<SurfaceComponent>();
|
||||||
|
|
||||||
surface.m_title = new_title;
|
surface.m_title = new_title;
|
||||||
glfwSetWindowTitle(surface.m_glfw_handle, surface.m_title.c_str());
|
glfwSetWindowTitle(surface.m_glfw_handle, surface.m_title.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto System::tick() -> bool
|
auto System::tick() -> bool
|
||||||
{
|
{
|
||||||
m_registry->view<SurfaceComponent>().each([](SurfaceComponent &surface) {
|
|
||||||
glfwSwapBuffers(surface.m_glfw_handle);
|
|
||||||
});
|
|
||||||
|
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -214,7 +191,7 @@ auto System::tick() -> bool
|
||||||
void System::set_size(ecs::Entity surface_entity, const math::uvec2 &new_size)
|
void System::set_size(ecs::Entity surface_entity, const math::uvec2 &new_size)
|
||||||
{
|
{
|
||||||
auto &surface = surface_entity.get_component<SurfaceComponent>();
|
auto &surface = surface_entity.get_component<SurfaceComponent>();
|
||||||
surface.m_resolution = new_size;
|
surface.m_size = new_size;
|
||||||
|
|
||||||
glfwSetWindowSize(
|
glfwSetWindowSize(
|
||||||
surface.m_glfw_handle,
|
surface.m_glfw_handle,
|
||||||
|
@ -255,36 +232,6 @@ void System::add_event_listener(
|
||||||
surface.m_event_callbacks.emplace_back(std::move(callback));
|
surface.m_event_callbacks.emplace_back(std::move(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::ensure_component_sanity(const SurfaceComponent &component)
|
|
||||||
{
|
|
||||||
auto [width, height] = component.get_resolution();
|
|
||||||
|
|
||||||
ensure(width != 0u, "Received bad values for surface component: width({}) == 0", width);
|
|
||||||
|
|
||||||
ensure(height != 0u, "Received bad values for surface component: height({}) == 0", height);
|
|
||||||
|
|
||||||
ensure(
|
|
||||||
width < SurfaceComponent::max_dimension,
|
|
||||||
"Received bad values for surface component: width({}) > max_dimension({})",
|
|
||||||
width,
|
|
||||||
SurfaceComponent::max_dimension
|
|
||||||
);
|
|
||||||
|
|
||||||
ensure(
|
|
||||||
height < SurfaceComponent::max_dimension,
|
|
||||||
"Received bad values for surface component: height({}) > max_dimension({})",
|
|
||||||
height,
|
|
||||||
SurfaceComponent::max_dimension
|
|
||||||
);
|
|
||||||
|
|
||||||
ensure(
|
|
||||||
component.get_title().size() < SurfaceComponent::max_title_length,
|
|
||||||
"Received bad values for surface component: title.size({}) > max_title_length({})",
|
|
||||||
component.get_title().size(),
|
|
||||||
SurfaceComponent::max_title_length
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace lt::surface
|
} // namespace lt::surface
|
||||||
|
|
||||||
namespace lt {
|
namespace lt {
|
||||||
|
|
|
@ -1,103 +0,0 @@
|
||||||
#include <ecs/scene.hpp>
|
|
||||||
#include <surface/system.hpp>
|
|
||||||
#include <test/fuzz.hpp>
|
|
||||||
#include <test/test.hpp>
|
|
||||||
|
|
||||||
namespace lt::surface {
|
|
||||||
|
|
||||||
enum class Action : uint8_t
|
|
||||||
{
|
|
||||||
create_entity,
|
|
||||||
|
|
||||||
create_surface_component,
|
|
||||||
|
|
||||||
destroy_surface_component,
|
|
||||||
|
|
||||||
tick,
|
|
||||||
};
|
|
||||||
|
|
||||||
void create_surface_component(test::FuzzDataProvider &provider, ecs::Registry ®istry)
|
|
||||||
{
|
|
||||||
const auto length = std::min(provider.consume<uint32_t>().value_or(16), 255u);
|
|
||||||
const auto title = provider.consume_string(length).value_or("");
|
|
||||||
|
|
||||||
const auto resolution = math::uvec2 {
|
|
||||||
provider.consume<uint32_t>().value_or({ 32 }),
|
|
||||||
provider.consume<uint32_t>().value_or({ 64 }),
|
|
||||||
};
|
|
||||||
const auto visible = provider.consume<bool>().value_or(false);
|
|
||||||
const auto vsync = provider.consume<bool>().value_or(false);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
registry.create_entity("").add_component<surface::SurfaceComponent>(
|
|
||||||
surface::SurfaceComponent::CreateInfo {
|
|
||||||
.title = std::move(title),
|
|
||||||
.resolution = resolution,
|
|
||||||
.vsync = vsync,
|
|
||||||
.visible = visible,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
catch (const std::exception &exp)
|
|
||||||
{
|
|
||||||
std::ignore = exp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void remove_surface_component(ecs::Registry ®istry)
|
|
||||||
{
|
|
||||||
const auto view = registry.get_entt_registry().view<SurfaceComponent>();
|
|
||||||
|
|
||||||
if (!view->empty())
|
|
||||||
{
|
|
||||||
registry.get_entt_registry().remove<SurfaceComponent>(*view.begin());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void check_invariants()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
test::FuzzHarness harness = [](const uint8_t *data, size_t size) {
|
|
||||||
auto provider = test::FuzzDataProvider { data, size };
|
|
||||||
|
|
||||||
auto registry = create_ref<ecs::Registry>();
|
|
||||||
auto system = surface::System { registry };
|
|
||||||
|
|
||||||
while (auto action = provider.consume<uint8_t>())
|
|
||||||
{
|
|
||||||
switch (static_cast<Action>(action.value()))
|
|
||||||
{
|
|
||||||
case Action::create_entity:
|
|
||||||
{
|
|
||||||
const auto length = std::min(provider.consume<uint32_t>().value_or(16), 255u);
|
|
||||||
const auto tag = provider.consume_string(length).value_or("");
|
|
||||||
registry->create_entity(tag);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case Action::create_surface_component:
|
|
||||||
{
|
|
||||||
create_surface_component(provider, *registry);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case Action::destroy_surface_component:
|
|
||||||
{
|
|
||||||
remove_surface_component(*registry);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case Action::tick:
|
|
||||||
{
|
|
||||||
system.tick();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
check_invariants();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace lt::surface
|
|
|
@ -26,24 +26,22 @@ public:
|
||||||
return m_registry;
|
return m_registry;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto add_surface_component(
|
auto add_surface_component() -> SurfaceComponent &
|
||||||
SurfaceComponent::CreateInfo info = SurfaceComponent::CreateInfo {
|
|
||||||
.title = title,
|
|
||||||
.resolution = { width, height },
|
|
||||||
.vsync = vsync,
|
|
||||||
.visible = visible,
|
|
||||||
}
|
|
||||||
) -> SurfaceComponent &
|
|
||||||
{
|
{
|
||||||
auto entity = m_registry->create_entity("");
|
auto entity = m_registry->create_entity("");
|
||||||
return entity.add_component<SurfaceComponent>(info);
|
return entity.add_component<SurfaceComponent>(SurfaceComponent::CreateInfo {
|
||||||
|
.title = title,
|
||||||
|
.size = { width, height },
|
||||||
|
.vsync = vsync,
|
||||||
|
.visible = visible,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_values(const SurfaceComponent &component)
|
void check_values(const SurfaceComponent &component)
|
||||||
{
|
{
|
||||||
expect_ne(std::get<SurfaceComponent::X11NativeHandle>(component.get_native_handle()), 0);
|
expect_ne(std::get<SurfaceComponent::X11NativeHandle>(component.get_native_handle()), 0);
|
||||||
expect_eq(component.get_resolution().x, width);
|
expect_eq(component.get_size().x, width);
|
||||||
expect_eq(component.get_resolution().y, height);
|
expect_eq(component.get_size().y, height);
|
||||||
expect_eq(component.get_title(), title);
|
expect_eq(component.get_title(), title);
|
||||||
expect_eq(component.is_vsync(), vsync);
|
expect_eq(component.is_vsync(), vsync);
|
||||||
expect_eq(component.is_visible(), visible);
|
expect_eq(component.is_visible(), visible);
|
||||||
|
@ -59,11 +57,9 @@ Suite raii = [] {
|
||||||
ignore = System { fixture.registry() };
|
ignore = System { fixture.registry() };
|
||||||
};
|
};
|
||||||
|
|
||||||
Case { "many won't freeze/throw" } = [] {
|
Case { "many won't throw" } = [] {
|
||||||
auto fixture = Fixture {};
|
auto fixture = Fixture {};
|
||||||
|
for (auto idx : std::views::iota(0, 100'001))
|
||||||
/* range is small since glfw init/terminate is slow. */
|
|
||||||
for (auto idx : std::views::iota(0, 100))
|
|
||||||
{
|
{
|
||||||
ignore = System { fixture.registry() };
|
ignore = System { fixture.registry() };
|
||||||
}
|
}
|
||||||
|
@ -82,17 +78,6 @@ Suite raii = [] {
|
||||||
auto system = System { fixture.registry() };
|
auto system = System { fixture.registry() };
|
||||||
expect_eq(fixture.registry()->view<SurfaceComponent>()->size(), 0);
|
expect_eq(fixture.registry()->view<SurfaceComponent>()->size(), 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
Case { "post destruct has correct state" } = [] {
|
|
||||||
auto fixture = Fixture {};
|
|
||||||
auto system = create_scope<System>(fixture.registry());
|
|
||||||
|
|
||||||
fixture.add_surface_component();
|
|
||||||
expect_eq(fixture.registry()->view<SurfaceComponent>()->size(), 1);
|
|
||||||
|
|
||||||
system.reset();
|
|
||||||
expect_eq(fixture.registry()->view<SurfaceComponent>()->size(), 0);
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Suite system_events = [] {
|
Suite system_events = [] {
|
||||||
|
@ -124,41 +109,6 @@ Suite registry_events = [] {
|
||||||
fixture.check_values(component);
|
fixture.check_values(component);
|
||||||
};
|
};
|
||||||
|
|
||||||
Case { "unhappy on_construct<SurfaceComponent> throws" } = [] {
|
|
||||||
auto fixture = Fixture {};
|
|
||||||
auto system = System { fixture.registry() };
|
|
||||||
|
|
||||||
expect_throw([&] { fixture.add_surface_component({ .resolution = { width, 0 } }); });
|
|
||||||
|
|
||||||
expect_throw([&] { fixture.add_surface_component({ .resolution = { 0, height } }); });
|
|
||||||
|
|
||||||
expect_throw([&] {
|
|
||||||
fixture.add_surface_component(
|
|
||||||
{ .title = "", .resolution = { SurfaceComponent::max_dimension + 1, height } }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
expect_throw([&] {
|
|
||||||
fixture.add_surface_component(
|
|
||||||
{ .title = "", .resolution = { width, SurfaceComponent::max_dimension + 1 } }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
auto big_str = std::string {};
|
|
||||||
big_str.resize(SurfaceComponent::max_title_length + 1);
|
|
||||||
expect_throw([&] {
|
|
||||||
fixture.add_surface_component({ .title = big_str, .resolution = { width, height } });
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
Case { "unhappy on_construct<SurfaceComponent> removes component" } = [] {
|
|
||||||
auto fixture = Fixture {};
|
|
||||||
auto system = System { fixture.registry() };
|
|
||||||
|
|
||||||
expect_throw([&] { fixture.add_surface_component({ .resolution = { width, 0 } }); });
|
|
||||||
expect_eq(fixture.registry()->view<SurfaceComponent>().size(), 0);
|
|
||||||
};
|
|
||||||
|
|
||||||
Case { "on_destrroy<SurfaceComponent> cleans up component" } = [] {
|
Case { "on_destrroy<SurfaceComponent> cleans up component" } = [] {
|
||||||
auto fixture = Fixture {};
|
auto fixture = Fixture {};
|
||||||
auto system = create_scope<System>(fixture.registry());
|
auto system = create_scope<System>(fixture.registry());
|
||||||
|
@ -187,7 +137,7 @@ Suite tick = [] {
|
||||||
};
|
};
|
||||||
|
|
||||||
Case { "ticking on chaotic registry won't throw" } = [] {
|
Case { "ticking on chaotic registry won't throw" } = [] {
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Suite property_setters = [] {
|
Suite property_setters = [] {
|
||||||
|
@ -196,3 +146,6 @@ Suite property_setters = [] {
|
||||||
|
|
||||||
Suite listeners = [] {
|
Suite listeners = [] {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Suite fuzzy = [] {
|
||||||
|
};
|
||||||
|
|
|
@ -47,15 +47,11 @@ public:
|
||||||
|
|
||||||
using NativeHandle = std::variant<WindowsNativeHandle, X11NativeHandle>;
|
using NativeHandle = std::variant<WindowsNativeHandle, X11NativeHandle>;
|
||||||
|
|
||||||
static constexpr auto max_dimension = 4096;
|
|
||||||
|
|
||||||
static constexpr auto max_title_length = 256;
|
|
||||||
|
|
||||||
struct CreateInfo
|
struct CreateInfo
|
||||||
{
|
{
|
||||||
std::string_view title;
|
std::string_view title;
|
||||||
|
|
||||||
math::uvec2 resolution;
|
math::uvec2 size;
|
||||||
|
|
||||||
bool vsync;
|
bool vsync;
|
||||||
|
|
||||||
|
@ -64,20 +60,20 @@ public:
|
||||||
|
|
||||||
SurfaceComponent(const CreateInfo &info)
|
SurfaceComponent(const CreateInfo &info)
|
||||||
: m_title(info.title)
|
: m_title(info.title)
|
||||||
, m_resolution(info.resolution)
|
, m_size(info.size)
|
||||||
, m_vsync(info.vsync)
|
, m_vsync(info.vsync)
|
||||||
, m_visible(info.visible)
|
, m_visible(info.visible)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_title() const -> std::string_view
|
[[nodiscard]] auto get_title() const -> const std::string_view &
|
||||||
{
|
{
|
||||||
return m_title;
|
return m_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto get_resolution() const -> const math::uvec2 &
|
[[nodiscard]] auto get_size() const -> const math::uvec2 &
|
||||||
{
|
{
|
||||||
return m_resolution;
|
return m_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto is_vsync() const -> bool
|
[[nodiscard]] auto is_vsync() const -> bool
|
||||||
|
@ -101,9 +97,9 @@ private:
|
||||||
return m_glfw_handle;
|
return m_glfw_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string m_title;
|
std::string_view m_title;
|
||||||
|
|
||||||
math::uvec2 m_resolution;
|
math::uvec2 m_size;
|
||||||
|
|
||||||
bool m_vsync;
|
bool m_vsync;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ public:
|
||||||
|
|
||||||
auto tick() -> bool override;
|
auto tick() -> bool override;
|
||||||
|
|
||||||
static void set_title(ecs::Entity surface_entity, std::string_view new_title);
|
void set_title(ecs::Entity surface_entity, std::string_view new_title);
|
||||||
|
|
||||||
void set_size(ecs::Entity surface_entity, const math::uvec2 &new_size);
|
void set_size(ecs::Entity surface_entity, const math::uvec2 &new_size);
|
||||||
|
|
||||||
|
@ -49,8 +49,6 @@ private:
|
||||||
|
|
||||||
void on_surface_destroy(entt::registry ®istry, entt::entity entity);
|
void on_surface_destroy(entt::registry ®istry, entt::entity entity);
|
||||||
|
|
||||||
void ensure_component_sanity(const SurfaceComponent &component);
|
|
||||||
|
|
||||||
Ref<ecs::Registry> m_registry;
|
Ref<ecs::Registry> m_registry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#include <test/test.hpp>
|
#include <test/test.hpp>
|
||||||
|
|
||||||
namespace lt::test {
|
namespace lt::test {
|
||||||
|
|
||||||
auto process_fuzz_input(const uint8_t *data, size_t size) -> int32_t
|
auto process_fuzz_input(const uint8_t *data, size_t size) -> int32_t
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return details::Registry::process_fuzz_input(data, size);
|
details::Registry::process_fuzz_input(data, size);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
catch (const std::exception &exp)
|
catch (const std::exception &exp)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue