add sandbox
This commit is contained in:
parent
3f455d0ca7
commit
789e1e186f
4 changed files with 53 additions and 0 deletions
|
|
@ -274,3 +274,7 @@ target_link_libraries(
|
||||||
|
|
||||||
# add_executable_module(mirror entrypoint/mirror.cpp)
|
# add_executable_module(mirror entrypoint/mirror.cpp)
|
||||||
# target_link_libraries(mirror PRIVATE libmirror input)
|
# target_link_libraries(mirror PRIVATE libmirror input)
|
||||||
|
|
||||||
|
if(ENABLE_SANDBOX)
|
||||||
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/sandbox/)
|
||||||
|
endif()
|
||||||
|
|
|
||||||
3
modules/sandbox/CMakeLists.txt
Normal file
3
modules/sandbox/CMakeLists.txt
Normal 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)
|
||||||
|
|
||||||
45
modules/sandbox/sandbox.cpp
Normal file
45
modules/sandbox/sandbox.cpp
Normal 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...");
|
||||||
|
}
|
||||||
|
|
@ -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_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(ENABLE_FUZZ_TESTS "Enables the building of the fuzz test modules")
|
||||||
add_option(
|
add_option(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue