make dual grid always be active
This commit is contained in:
+5
-9
@@ -91,7 +91,6 @@ struct PerFrame {
|
||||
float camera_distance;
|
||||
float camera_tilt;
|
||||
Uint32 map_width;
|
||||
Uint32 use_dual_grid;
|
||||
};
|
||||
|
||||
PerFrame per_frame = { 1.0f, 45.0f, 0.0f, 0.0f, 10.0f, 45.0f };
|
||||
@@ -616,8 +615,7 @@ V2 get_floor_intersection_of_mouse(V2 mouse_pos) {
|
||||
float t = -camera_position.z / ray_dir.z;
|
||||
V3 floor_intersection = camera_position + (t * ray_dir);
|
||||
|
||||
if (per_frame.use_dual_grid)
|
||||
floor_intersection.xy += V2_(0.5f, 0.5f);
|
||||
floor_intersection.xy += V2_(0.5f, 0.5f);
|
||||
|
||||
return floor_intersection.xy;
|
||||
}
|
||||
@@ -1074,8 +1072,6 @@ int main(int argc, char **argv) {
|
||||
ImGui::DragFloat("fovy", &per_frame.fovy_degrees);
|
||||
ImGui::DragFloat("camera_distance", &per_frame.camera_distance, 0.25f, 1.0f, INFINITY);
|
||||
ImGui::DragFloat("camera_tilt", &per_frame.camera_tilt, 0.25f, 0.0f, 89.0f);
|
||||
|
||||
ImGui::CheckboxFlags("use dual grid", &per_frame.use_dual_grid, 0xffffffff);
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
@@ -1125,19 +1121,19 @@ int main(int argc, char **argv) {
|
||||
continue;
|
||||
|
||||
if (event.key.key == SDLK_UP || event.key.key == SDLK_W) {
|
||||
player.pos_y = clamp(0, player.pos_y + 1, map_height - 1 - (per_frame.use_dual_grid ? 1 : 0));
|
||||
player.pos_y = clamp(0, player.pos_y + 1, map_height - 2);
|
||||
}
|
||||
|
||||
if (event.key.key == SDLK_LEFT || event.key.key == SDLK_A) {
|
||||
player.pos_x = clamp(0, player.pos_x - 1, map_width - 1 - (per_frame.use_dual_grid ? 1 : 0));
|
||||
player.pos_x = clamp(0, player.pos_x - 1, map_width - 2);
|
||||
}
|
||||
|
||||
if (event.key.key == SDLK_DOWN || event.key.key == SDLK_S) {
|
||||
player.pos_y = clamp(0, player.pos_y - 1, map_height - 1 - (per_frame.use_dual_grid ? 1 : 0));
|
||||
player.pos_y = clamp(0, player.pos_y - 1, map_height - 2);
|
||||
}
|
||||
|
||||
if (event.key.key == SDLK_RIGHT || event.key.key == SDLK_D) {
|
||||
player.pos_x = clamp(0, player.pos_x + 1, map_width - 1 - (per_frame.use_dual_grid ? 1 : 0));
|
||||
player.pos_x = clamp(0, player.pos_x + 1, map_width - 2);
|
||||
}
|
||||
|
||||
if (event.key.key == SDLK_F1) {
|
||||
|
||||
Reference in New Issue
Block a user