add sandbox

This commit is contained in:
light7734 2026-01-06 13:42:32 +03:30
parent 3f455d0ca7
commit 789e1e186f
Signed by: light7734
GPG key ID: 20A1BB5EBAB6C1E5
4 changed files with 53 additions and 0 deletions

View file

@ -274,3 +274,7 @@ target_link_libraries(
# add_executable_module(mirror entrypoint/mirror.cpp)
# target_link_libraries(mirror PRIVATE libmirror input)
if(ENABLE_SANDBOX)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/sandbox/)
endif()

View file

@ -0,0 +1,3 @@
add_executable(sandbox sandbox.cpp)
target_link_libraries(sandbox PRIVATE logger bitwise env memory time test lt_debug math assets app ecs surface renderer input mirror)

View file

@ -0,0 +1,45 @@
import test.test;
import time;
import test.expects;
import surface.system;
import surface.events;
import surface.requests;
import ecs.registry;
import memory.scope;
import memory.reference;
import logger;
import math.vec2;
import app.system;
import std;
constexpr auto title = "TestWindow";
constexpr auto width = 800u;
constexpr auto height = 600u;
constexpr auto vsync = true;
constexpr auto visible = false;
int main()
{
auto registry = lt::memory::create_ref<lt::ecs::Registry>();
auto system = lt::surface::System { registry };
auto entity = registry->create_entity();
system.create_surface_component(
entity,
lt::surface::SurfaceComponent::CreateInfo {
.title = title,
.resolution = { width, height },
.vsync = vsync,
.visible = visible,
}
);
auto timer = lt::time::Timer {};
lt::log::trace("Ticking for 3 seconds...");
while (timer.elapsed_time() < std::chrono::seconds { 3 })
{
system.tick({});
}
lt::log::trace("Three seconds passed, quitting...");
}

View file

@ -1,3 +1,4 @@
add_option(ENABLE_SANDBOX "Enables the building of the sandbox module for experimentation")
add_option(ENABLE_UNIT_TESTS "Enables the building of the unit test modules")
add_option(ENABLE_FUZZ_TESTS "Enables the building of the fuzz test modules")
add_option(