 |
Blamite Game Engine - blam!
00453.06.08.26.0624.blamite
The core library for the Blamite Game Engine.
|
Go to the documentation of this file.
3 #include <Strings/components/classes/events/events.h>
30 bool mouse_capture_state_changed =
false;
31 int current_speed_index = 0;
38 std::vector<float> camera_speeds = {
46 int viewport_center_x = 0;
47 int viewport_center_y = 0;
49 bool zoom_state_changed =
false;
50 float zoom_increment = 0.0f;
55 std::map<BlamDirection, float> move_accelerations = {
56 std::pair<BlamDirection, float>(BlamDirection::Forward, 0.0f),
57 std::pair<BlamDirection, float>(BlamDirection::Backward, 0.0f),
58 std::pair<BlamDirection, float>(BlamDirection::Left, 0.0f),
59 std::pair<BlamDirection, float>(BlamDirection::Right, 0.0f),
60 std::pair<BlamDirection, float>(BlamDirection::Up, 0.0f),
61 std::pair<BlamDirection, float>(BlamDirection::Down, 0.0f)
64 std::map<BlamDirection, float> look_accelerations = {
65 std::pair<BlamDirection, float>(BlamDirection::Up, 0.0f),
66 std::pair<BlamDirection, float>(BlamDirection::Down, 0.0f),
67 std::pair<BlamDirection, float>(BlamDirection::Left, 0.0f),
68 std::pair<BlamDirection, float>(BlamDirection::Right, 0.0f)
71 float accel_increment = 0.0f;
73 BlamVector3 camera_velocity = BlamVector3();
74 BlamVector3 camera_coast_velocity = BlamVector3();
75 BlamVector3 camera_spring_velocity = BlamVector3();
76 BlamVector2 look_input_accumulator = BlamVector2();
77 BlamVector2 look_velocity = BlamVector2();
78 BlamVector2 look_coast_velocity = BlamVector2();
79 BlamVector2 look_spring_velocity = BlamVector2();
80 bool look_was_turning =
false;
81 float fov_spring_velocity = 0.0f;
163 BlamVector3
MoveCamera(BlamDirection direction,
float acceleration);
187 BlamVector3 click_start_camera_pos = BlamVector3();
188 BlamVector2 click_start_point = BlamVector2();
189 bool clicking =
false;
float fov_damping
Spring damping for camera zooming. Only used when enable_zoom_spring is true.
Definition: director.h:132
BLAM BlamDirector * GetCamera()
Retrieves the director instance.
Definition: director.cpp:36
int entry_size
The size of each block entry.
Definition: tags.h:253
BLAM BlamWorldState * GetWorldState()
Retrieves the current world state.
Definition: world.cpp:56
void OnMouseMoveEvent(MouseMoveEvent *event) override
Definition: BlamDirectorCamera.cpp:428
bool mouse_captured
Whether or not the mouse is currently being captured by the camera.
Definition: director.h:94
BlamDirector()
Initializes the camera.
Definition: BlamDirectorCamera.cpp:19
#define BLAM
Definition: director.h:10
void OnTickEvent(TickEvent *event) override
Definition: BlamDirectorCamera.cpp:97
@ SDLK_w
Definition: SdlEmulationLayer.h:453
void * entry_data_address
The address of the blocks' entry data.
Definition: tags.h:255
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition: aliases.cpp:130
void OnMouseClickEvent(MouseClickEvent *event) override
Definition: BlamDirector2D.cpp:42
float fov
The camera's current field of view.
Definition: director.h:95
float zoom
Definition: director.h:194
float far_clip_plane_distance
Definition: director.h:118
BlamVector3 camera_angle
The current looking angle of the camera. X is yaw, Y is pitch, Z is roll (unused atm).
Definition: director.h:85
BLAM bool CreateTag(std::string tag_class, BlamTagData **tag_data)
Creates a new tag in memory, making it available throughout the engine.
Definition: tags.cpp:41
void OnKeyPressEvent(KeyPressEvent *event) override
Definition: BlamDirectorCamera.cpp:575
float fov_spring_scale
Scale factor to use when calculating zoom springiness. Only used when enable_zoom_spring is true.
Definition: director.h:133
void OnKeyPressEvent(KeyPressEvent *event) override
Definition: BlamDirector2D.cpp:61
float zoom_increment_count
The number of steps/increments to use when zooming in and out. Lower numbers will cause the camera to...
Definition: director.h:99
BLAM bool Use2DCamera()
Definition: director.cpp:74
BLAM std::vector< BlamTagData * > * GetLoadedTags()
Retrieves the list of loaded tag data.
Definition: tags.cpp:157
bool mouse_capture_ready
Whether or not the mouse is ready to be captured.
Definition: director.h:91
BLAM BlamDirector2D * GetCamera2D()
Definition: director.cpp:69
@ SDLK_r
Definition: SdlEmulationLayer.h:448
float near_clip_plane_distance
Definition: director.h:117
bool UsingBgfx()
Definition: bgfx.cpp:63
float look_accel_rate
Acceleration rate to use when rotating camera. Only used when enable_look_spring is true.
Definition: director.h:128
float fov_normal
The camera's default field of view.
Definition: director.h:96
BLAM_EXT_API BlamTagClass * GetTagClass(std::string id)
Retrieves a tag class that matches the given string.
Definition: tagclass.cpp:72
BlamVector3 MoveCamera(BlamDirection direction, float acceleration)
Moves the camera one "step" in the given direction.
Definition: BlamDirectorCamera.cpp:590
#define USER_DATA_PATH(path)
Macro to quickly access a user data folder.
Definition: config.h:41
@ SDLK_f
Definition: SdlEmulationLayer.h:436
bool enable_zoom_spring
Whether or not zoom springiness is enabled. Gives camera zooming a subtle "bounciness".
Definition: director.h:130
float vertical_angle
Definition: director.h:115
BLAM void PrepareCamera()
Prepares the director for use.
Definition: director.cpp:7
BlamVector3 camera_right
The calculated point representing the right of the camera.
Definition: director.h:89
float movement_spring_scale
Scale factor to use when calculating movement springiness. Only used when enable_movement_spring is t...
Definition: director.h:123
BLAM_EXT_API std::vector< BlamTagClass * > * GetRegisteredTagClasses()
Retrieves the list of all registered tag classes.
Definition: tagclass.cpp:90
bool calculate_angle
Definition: director.h:113
float accel_increment_count
The number of steps/increments to use when accelerating and decelerating. Lower numbers will cause th...
Definition: director.h:105
Namespace for things related to the debug camera (director).
Definition: director.h:212
BlamDirector2D * camera_2d
Definition: director.cpp:4
@ SDLK_d
Definition: SdlEmulationLayer.h:434
void OnNewFrameEvent(NewFrameEvent *event) override
Definition: BlamDirectorCamera.cpp:34
float horizontal_angle
Definition: director.h:114
void ShowImPropertyEditor()
Shows a series of ImGUI controls used to modify tag data with a simple UI.
Definition: BlamTagClass.cpp:13
int entry_count
The number of entries within the tag block.
Definition: tags.h:256
bool move_acceleration
Whether or not camera movements should use acceleration.
Definition: director.h:103
@ SDLK_LSHIFT
Definition: SdlEmulationLayer.h:608
void OnMouseWheelEvent(MouseWheelEvent *event) override
Definition: BlamDirector2D.cpp:66
float look_spring_stiffness
Spring stiffness for camera rotation. Only used when enable_look_spring is true.
Definition: director.h:126
Structure representing a tag reference.
Definition: tags.h:289
bool lock_camera
Whether or not the camera is locked. If locked, all keyboard/mouse input is ignored.
Definition: director.h:195
std::string class_name_long
The longer class name. Typically shown alongside short name for user-friendliness.
Definition: tags.h:205
BLAM void ShutdownCamera()
Destroys the director and cleans up any data related to it.
Definition: director.cpp:31
float damping
Spring damping for camera movement. Only used when enable_movement_spring is true.
Definition: director.h:122
bool auto_verify_coords
Whether or not camera_front and camera_right should be automatically calculated.
Definition: director.h:87
float speed
The camera's current speed.
Definition: director.h:98
BLAM BlamTagData * GetTagData(std::string tag_path)
Retrieves information for a given tag.
Definition: tags.cpp:81
BLAM void ResolveAllTagReferences()
Attempts to resolve all tag references within all loaded tags.
Definition: tags.cpp:73
bool lock_camera
Whether or not the camera is locked. If locked, all keyboard/mouse input is ignored.
Definition: director.h:100
void OnMouseUnclickEvent(MouseUnclickEvent *event) override
Definition: BlamDirector2D.cpp:52
bool look_acceleration
Whether or not camera looking should use acceleration.
Definition: director.h:104
Class representing the Director.
Definition: director.h:27
bool pancam_lock_xy
Whether or not the camera should be locked to X/Y axis when in pan-cam mode.
Definition: director.h:102
bool data_is_tag
Whether or not tagref_address points to tag data, or the tag's path.
Definition: tags.h:296
bool zoomed
Whether or not the camera is currently zoomed in.
Definition: director.h:107
bool camera_bouncing
Whether or not the camera should have a bounce/rubber effect when moving and looking around.
Definition: director.h:106
std::vector< BlamTagClass * > registered_classes
List of all registered tag classes.
Definition: tagclass.cpp:70
void * data_address
The address of the referenced data.
Definition: tags.h:346
bool tick_based_looking
Whether or not camera looking should be driven by the game tick.
Definition: director.h:111
BLAM void LoadReferencedTags(std::string tag_path)
Adds an additional folder to search when attempting to load a tag.
Definition: tag_io.cpp:60
BLAM_EXT_API bool GetEngineHookState()
Retrieves the engine's hook state.
Definition: hooking.cpp:14
float look_damping
Spring damping for camera rotation. Only used when enable_look_spring is true.
Definition: director.h:127
BlamDirector * camera
Definition: director.cpp:3
bool persistent_look_motion
Whether or not to use persistent camera look motion. Only applies when using tick based looking.
Definition: director.h:110
Structure representing a data reference.
Definition: tags.h:342
int tag_size
The size of the tag's data. Used on loading/writing tag files.
Definition: tags.h:210
BLAM void LogEventForce(std::string message)
Forcibly logs a message to the log and/or console.
Definition: aliases.cpp:262
void OnMouseClickEvent(MouseClickEvent *event) override
Definition: BlamDirectorCamera.cpp:560
void SetCameraSpeed(float _speed)
Sets the camera's speed, while also sending a log message indicating that the speed has been changed.
Definition: BlamDirectorCamera.cpp:967
BLAM void CleanupTagData()
Releases all memory used by tags.
Definition: tags.cpp:136
void * address
The address pointing to the start of the tag's data.
Definition: tags.h:132
BlamVector3 camera_direction
Definition: director.h:193
BLAM void ShowImPropertyEditor(void *tag, std::string tag_class)
Shows an ImGUI editor for a given tag.
Definition: tags.cpp:17
float fov_spring_stiffness
Spring stiffness for camera zooming. Only used when enable_zoom_spring is true.
Definition: director.h:131
TagOrigin origin
The origin of the tag.
Definition: tags.h:147
@ SDLK_a
Definition: SdlEmulationLayer.h:431
float spring_stiffness
Spring stiffness for camera movement. Only used when enable_movement_spring is true.
Definition: director.h:121
Class used to contain and access tag data.
Definition: tags.h:125
float far_clip_plane_distance
Definition: director.h:198
Definition: director.h:184
bool pancam
Whether or not the camera is currently in pan-cam mode. Pan-cam locks Z movement of the camera when n...
Definition: director.h:101
float near_clip_plane_distance
Definition: director.h:197
void SetMemoryLocation(void *address)
Sets the address and size of the tag that this class should be applied to.
Definition: BlamTagClass.cpp:21
void ValidateCameraCoords()
If auto_verify_coords is set to true, this will verify all camera coordinates.
Definition: BlamDirectorCamera.cpp:902
BlamVector3 camera_pos
Definition: director.h:192
void * tagref_address
The address of the tagref data.
Definition: tags.h:295
bool use_2d_camera
Definition: director.cpp:5
@ Tags
Directory storing user-created tags. Defaults to {DataRoot}/tags/.
IMGUI_API void NewFrame()
Definition: imgui.cpp:3689
BLAM void SetCamera2DMode(bool use_2d, bool copy_from_last=false)
Definition: director.cpp:41
bool enable_movement_spring
Whether or not movement springiness is enabled. Gives camera movement a subtle "bounciness".
Definition: director.h:120
int size
The size of the tag's data in memory.
Definition: tags.h:133
@ SDLK_s
Definition: SdlEmulationLayer.h:449
BlamVector3 camera_front
The calculated point representing the front of the camera.
Definition: director.h:88
int mouse_capture_delay_ticks
The remaining number of game ticks to wait before truly capturing the mouse.
Definition: director.h:92
BlamVector3 camera_pos
The current position of the camera.
Definition: director.h:84
float fov_zoomed
The camera's field of view while zoomed in.
Definition: director.h:97
void CalculateCameraAngles()
Definition: BlamDirectorCamera.cpp:934
Class representing a tag class.
Definition: tags.h:202
float look_sensetivity_vertical
The camera's vertical look sensetivity.
Definition: director.h:108
bool enable_look_spring
Whether or not look springiness is enabled. Gives camera rotation a subtle "bounciness".
Definition: director.h:125
~BlamDirector()
Destroys the camera.
Definition: BlamDirectorCamera.cpp:29
void OnMouseMoveEvent(MouseMoveEvent *event) override
Definition: BlamDirector2D.cpp:23
BLAM SDL_Window * GetMainWindowHandle()
Retrieves the main window handle of the application, when using SDL.
Definition: main.cpp:629
BlamDirector2D()
Definition: BlamDirector2D.cpp:13
float look_sensetivity_horizontal
The camera's horizontal look sensetivity.
Definition: director.h:109