Antkeeper  0.0.1
nuptial-flight-state.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 Christopher J. Howard
3  *
4  * This file is part of Antkeeper source code.
5  *
6  * Antkeeper source code is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Antkeeper source code is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef ANTKEEPER_NUPTIAL_FLIGHT_STATE_HPP
21 #define ANTKEEPER_NUPTIAL_FLIGHT_STATE_HPP
22 
24 #include <engine/entity/id.hpp>
25 #include <engine/math/vector.hpp>
27 #include <engine/scene/text.hpp>
29 #include <memory>
30 
32 {
33 public:
34  explicit nuptial_flight_state(::game& ctx);
35  virtual ~nuptial_flight_state();
36 
37 private:
38  void create_camera_rig();
39  void destroy_camera_rig();
40 
41  void set_camera_rig_zoom(float zoom);
42  void satisfy_camera_rig_constraints();
43 
44  void setup_controls();
45  void enable_controls();
46  void disable_controls();
47 
48  void select_entity(entity::id entity_id);
49  void select_nearest_entity(const math::fvec3& direction);
50 
51  // Camera
52  entity::id camera_rig_focus_eid;
53  entity::id camera_rig_focus_ease_to_eid;
54  entity::id camera_rig_eid;
55  entity::id camera_rig_spring_translation_eid;
56  entity::id camera_rig_spring_rotation_eid;
57  entity::id camera_rig_copy_translation_eid;
58  entity::id camera_rig_pivot_eid;
59  float camera_rig_near_distance;
60  float camera_rig_far_distance;
61  float camera_rig_near_fov;
62  float camera_rig_far_fov;
63  float camera_rig_zoom_speed;
64  float camera_rig_zoom;
65  entity::id camera_rig_fov_spring_eid;
66  float camera_rig_translation_spring_angular_frequency;
67  float camera_rig_rotation_spring_angular_frequency;
68  float camera_rig_fov_spring_angular_frequency;
69  float camera_rig_focus_ease_to_duration;
70 
71  // Ants
72  entity::id swarm_eid;
73 
74  // Name generation
75  std::shared_ptr<text_file> name_pool;
76 
77  // Picking
78  std::uint32_t selected_picking_flag;
79  entity::id selected_eid;
80 
81  // UI
82  scene::text selection_text;
83 
84  // Controls
85  bool mouse_look{false};
86  std::vector<std::shared_ptr<::event::subscription>> action_subscriptions;
87  std::shared_ptr<::event::subscription> mouse_motion_subscription;
88 };
89 
90 #endif // ANTKEEPER_NUPTIAL_FLIGHT_STATE_HPP
Abstract base class for game states.
Definition: game-state.hpp:29
::game & ctx
Definition: game-state.hpp:44
Definition: game.hpp:121
Text scene object.
Definition: text.hpp:37
entt::entity id
Entity ID type.
Definition: id.hpp:28
n-dimensional vector.
Definition: vector.hpp:44