summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-22 18:11:16 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-22 18:11:35 +0200
commited4c0046d0c7fbb6a33fc13b508a2a3a6f512809 (patch)
treece1be4274bb41c0757dc1d10575253664124360c
parent7d58a11540c90ed8c7417e825d2bae902e8c478a (diff)
more cruft
-rw-r--r--main/app.cpp6
-rw-r--r--main/draw.cpp15
-rw-r--r--main/update.cpp9
3 files changed, 18 insertions, 12 deletions
diff --git a/main/app.cpp b/main/app.cpp
index 157c523f..a9523548 100644
--- a/main/app.cpp
+++ b/main/app.cpp
@@ -38,9 +38,9 @@ app::app(const Arguments& arguments, app_settings opts):
.setTitle("Test")
.setSize({1024, 768}, dpi_policy::Physical)
.setWindowFlags(Configuration::WindowFlag::Resizable),
- GLConfiguration{}
- //.setSampleCount(4)
- }
+ GLConfiguration{},
+ },
+ _settings{opts}
{
SDL_MaximizeWindow(window());
diff --git a/main/draw.cpp b/main/draw.cpp
index a9517004..5ee38fba 100644
--- a/main/draw.cpp
+++ b/main/draw.cpp
@@ -52,19 +52,17 @@ void app::draw_msaa()
void app::draw_world()
{
-#if 0
- _floor_mesh.draw(_shader, *_world[chunk_coords{0, 0}]);
- _wall_mesh.draw(_shader, *_world[chunk_coords{0, 0}]);
-#else
auto foo = get_draw_bounds();
auto [minx, maxx, miny, maxy] = foo;
for (std::int16_t y = miny; y <= maxy; y++)
for (std::int16_t x = minx; x <= maxx; x++)
{
- const chunk_coords c{x, y};
- if (!_world.contains(c))
+#if 0
+ if (const chunk_coords c = {x, y}; !_world.contains(c))
make_test_chunk(*_world[c]);
+#endif
+ const chunk_coords c{x, y};
const with_shifted_camera_offset o{_shader, c};
_floor_mesh.draw(_shader, *_world[c]);
}
@@ -76,15 +74,14 @@ void app::draw_world()
const with_shifted_camera_offset o{_shader, c};
_wall_mesh.draw(_shader, *_world[c]);
}
-#endif
}
void app::draw_wireframe_quad(global_coords pos)
{
- constexpr float LINE_WIDTH = 1;
+ constexpr float LINE_WIDTH = 2;
const auto pt = pos.to_signed();
- if (const auto& [c, tile] = _world[pos]; tile.ground_image)
+ //if (const auto& [c, tile] = _world[pos]; tile.ground_image)
{
const Vector3 center{pt[0]*TILE_SIZE[0], pt[1]*TILE_SIZE[1], 0};
_shader.set_tint({1, 0, 0, 1});
diff --git a/main/update.cpp b/main/update.cpp
index 00e59434..172b2ebd 100644
--- a/main/update.cpp
+++ b/main/update.cpp
@@ -2,13 +2,22 @@
namespace floormat {
+//#define TEST_NO_BINDINGS
+
void app::make_test_chunk(chunk& c)
{
constexpr auto N = TILE_MAX_DIM;
for (auto [x, k, pt] : c) {
+#ifdef TEST_NO_BINDINGS
+ const auto& atlas = floor1;
+#else
const auto& atlas = pt.x != pt.y && (pt.x == N/2 || pt.y == N/2) ? floor2 : floor1;
+#endif
x.ground_image = { atlas, k % atlas->num_tiles() };
}
+#ifdef TEST_NO_BINDINGS
+ const auto& wall1 = floor1, wall2 = floor1;
+#endif
constexpr auto K = N/2;
c[{K, K }].wall_north = { wall1, 0 };
c[{K, K }].wall_west = { wall2, 0 };