VEX Engine
Retro looking game engine made in vulkan mostly because i wanted to understand it better.
Loading...
Searching...
No Matches
EditorCameraObject Class Reference

A specialized camera object for use within the editor, supporting free-fly movement and input processing. More...

#include <EditorCamera.hpp>

Inheritance diagram for EditorCameraObject:
vex::CameraObject vex::GameObject

Public Member Functions

 EditorCameraObject (vex::Engine &engine, const std::string &name, SDL_Window *window)
 Constructs an EditorCameraObject.
void processEvent (const SDL_Event &event, float deltaTime)
 Processes SDL events specific to the editor camera (e.g., mouse movement, key presses).
void Update (float deltaTime) override
 Overrides the base GameObject Update for continuous camera movement and logic.
void setViewportHovered (bool hovered)
 Sets whether the editor's viewport window is currently being hovered by the mouse.
Public Member Functions inherited from vex::CameraObject
 CameraObject (Engine &engine, const std::string &name)
Public Member Functions inherited from vex::GameObject
 GameObject (Engine &engine, const std::string &name)
 Default constructor for GameObject.
void Destroy ()
 Destroys the GameObject and removes it from the engine's registry.
virtual ~GameObject ()
 Destructor.
 GameObject (const GameObject &)=delete
GameObjectoperator= (const GameObject &)=delete
 GameObject (GameObject &&other) noexcept
virtual void BeginPlay ()
 virtual void function you override to implement custom behavior when the game starts.
vex::Entity GetEntity () const
 Function that returns entity object, which is the entity associated with this GameObject. Its mostly needed for parenting and other engine internal usage.
EngineGetEngine ()
 Function that returns engine reference allowing your custom Object to use engine provided methods.
template<typename T>
T & GetComponent ()
 Function that returns reference to a requested component.
template<typename T>
void AddComponent (const T &comp)
 Function that adds a component to the GameObject.
template<typename T>
bool HasComponent () const
 Function that checks if the GameObject has a component.
bool isValid () const
void ParentTo (vex::Entity entity)
 Function that parent this Object to another GameObject. You need to pass another GameObject's entity.
void setObjectType (const std::string &type)
 Function that sets the type of the GameObject.
const std::string & getObjectType () const
 Function that returns the type of the GameObject.

Private Attributes

SDL_Window * m_window
std::unordered_map< SDL_Scancode, bool > keyStates
bool m_viewportHovered = false
bool m_isFlying = false
float m_mouseSensitivity = 0.1f
float m_movementSpeed = 50.0f

Additional Inherited Members

Protected Attributes inherited from vex::GameObject
Enginem_engine
vex::Entity m_entity
bool m_isValid
std::string objectType

Detailed Description

A specialized camera object for use within the editor, supporting free-fly movement and input processing.

Definition at line 16 of file EditorCamera.hpp.

Constructor & Destructor Documentation

◆ EditorCameraObject()

EditorCameraObject::EditorCameraObject ( vex::Engine & engine,
const std::string & name,
SDL_Window * window )

Constructs an EditorCameraObject.

Parameters
vex::Engine&engine - Reference to the core engine instance.
conststd::string& name - The name of the camera object.
SDL_Window*window - The main SDL window pointer, used for input handling.

Definition at line 6 of file EditorCamera.cpp.

Member Function Documentation

◆ processEvent()

void EditorCameraObject::processEvent ( const SDL_Event & event,
float deltaTime )

Processes SDL events specific to the editor camera (e.g., mouse movement, key presses).

Parameters
constSDL_Event& event - The SDL event to process.
floatdeltaTime - Time elapsed since the last frame.

Definition at line 14 of file EditorCamera.cpp.

◆ setViewportHovered()

void EditorCameraObject::setViewportHovered ( bool hovered)
inline

Sets whether the editor's viewport window is currently being hovered by the mouse.

Parameters
boolhovered - True if the viewport is hovered, false otherwise.

Definition at line 39 of file EditorCamera.hpp.

◆ Update()

void EditorCameraObject::Update ( float deltaTime)
overridevirtual

Overrides the base GameObject Update for continuous camera movement and logic.

Parameters
floatdeltaTime - Time elapsed since the last frame.

Reimplemented from vex::GameObject.

Definition at line 54 of file EditorCamera.cpp.

Member Data Documentation

◆ keyStates

std::unordered_map<SDL_Scancode, bool> EditorCameraObject::keyStates
private

Definition at line 42 of file EditorCamera.hpp.

◆ m_isFlying

bool EditorCameraObject::m_isFlying = false
private

Definition at line 45 of file EditorCamera.hpp.

◆ m_mouseSensitivity

float EditorCameraObject::m_mouseSensitivity = 0.1f
private

Definition at line 46 of file EditorCamera.hpp.

◆ m_movementSpeed

float EditorCameraObject::m_movementSpeed = 50.0f
private

Definition at line 47 of file EditorCamera.hpp.

◆ m_viewportHovered

bool EditorCameraObject::m_viewportHovered = false
private

Definition at line 44 of file EditorCamera.hpp.

◆ m_window

SDL_Window* EditorCameraObject::m_window
private

Definition at line 41 of file EditorCamera.hpp.


The documentation for this class was generated from the following files: