summaryrefslogtreecommitdiff
path: root/src/core.cpp
diff options
context:
space:
mode:
authorFrederico Linhares <fred@linhares.blue>2022-09-16 12:03:04 -0300
committerFrederico Linhares <fred@linhares.blue>2022-09-16 12:03:04 -0300
commit3d6ca447a7104c499e92fc954affdaf4bf011388 (patch)
treed759fbd39d3d66a2457ea92fc4eeb2c31b2cbe4f /src/core.cpp
parent0d0868611389b8dded0c1dfef7a530a4b6e1f148 (diff)
feat Create View
Diffstat (limited to 'src/core.cpp')
-rw-r--r--src/core.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/core.cpp b/src/core.cpp
index 46fb6eb..5827ef6 100644
--- a/src/core.cpp
+++ b/src/core.cpp
@@ -62,8 +62,6 @@ load_variables(void *obj)
cg_core.game_name = new char[game_name.size() + 1];
strcpy(cg_core.game_name, game_name.c_str());
- cg_core.game_width = root["game"]["width"].as<int>();
- cg_core.game_height = root["game"]["height"].as<int>();
cg_core.screen_width = root["screen"]["width"].as<int>();
cg_core.screen_height = root["screen"]["height"].as<int>();
@@ -491,12 +489,13 @@ unload_vk_graphics_pipeline_2d_layout(void *obj)
delete cg_core.vk_graphics_pipeline_2d_layout;
}
-static void
+void
load_vk_graphics_pipeline_3d(void *obj)
{
try
{
- cg_core.vk_graphics_pipeline_3d = new VK::GraphicsPipeline3D();
+ cg_core.vk_graphics_pipeline_3d =
+ std::make_unique<VK::GraphicsPipeline3D>();
}
catch(const CommandError &e)
{
@@ -504,18 +503,19 @@ load_vk_graphics_pipeline_3d(void *obj)
}
}
-static void
+void
unload_vk_graphics_pipeline_3d(void *obj)
{
- delete cg_core.vk_graphics_pipeline_3d;
+ cg_core.vk_graphics_pipeline_3d = nullptr;
}
-static void
+void
load_vk_graphics_pipeline_2d(void *obj)
{
try
{
- cg_core.vk_graphics_pipeline_2d = new VK::GraphicsPipeline2D();
+ cg_core.vk_graphics_pipeline_2d =
+ std::make_unique<VK::GraphicsPipeline2D>();
}
catch(const CommandError &e)
{
@@ -523,10 +523,10 @@ load_vk_graphics_pipeline_2d(void *obj)
}
}
-static void
+void
unload_vk_graphics_pipeline_2d(void *obj)
{
- delete cg_core.vk_graphics_pipeline_2d;
+ cg_core.vk_graphics_pipeline_2d = nullptr;
}
static void
@@ -534,7 +534,12 @@ load_vk_renderer(void *obj)
{
try
{
- cg_core.vk_renderer = new VK::Renderer();
+ glm::vec4 region(
+ 0.f, 0.f,
+ static_cast<float>(cg_core.screen_width),
+ static_cast<float>(cg_core.screen_height));
+ cg_core.vk_renderer = new VK::Renderer(
+ {std::make_shared<VK::View>(region)});
}
catch(const CommandError &e)
{