Skip to content
Imagment edited this page Mar 27, 2025 · 2 revisions

Explanation

The Camera class is a component that controls the rendering area and view settings and visual effects in the library. It handles various rendering operations, such as rendering frames, changing the background texture, and more.

Constructors

Constructor Description
Camera() Default constructor.
Camera(const Camera& other) Copy constructor that duplicates all properties.
Camera& operator=(const Camera& other) Assignment operator to copy values while avoiding self-assignment.

Public Methods

Cloning

Method Description
Clone() Creates a new instance of Camera with the same properties.

Rendering & Video Control

Method Description
void RenderFrame() Renders the current frame.
void StartVideo() Starts video capturing.
void StopVideo() Stops video capturing.

Transformation & Positioning

Method Description
Vector2 GetScreenPosition(Vector3 pos) Converts a 3D position into screen coordinates.
void ShakeCameraOnce(float intensity) Applies a single camera shake effect.
void ShakeCamera(float intensity, int shakes, float delay) Repeatedly shakes the camera.

Camera Settings

Method Description
void EraseCamera() Clears the camera display.
Rect getCameraZone() Retrieves the camera’s viewable area.
getScale() Returns the current camera scale.
setScale(Vector3 scale) Sets the camera scale.

Public Members

General Properties

Property Type Description
hierarchy float Determines rendering order.
backgroundPattern std::string Pattern used for background rendering.
outOfStagePattern std::string Pattern for areas outside the stage.
patternOccurrenceRate Vector2 Defines the repetition of patterns.
showOutOfStagePatterns bool Show out-of-stage pattern visibility when set to true.
printSpaces bool Specifies whether spaces are treated as opaque, preventing objects behind them from being rendered.

Screen Text & Alignment

Property Type Description
topText std::string Text displayed at the top.
rightText std::string Text displayed at the right.
leftText std::string Text displayed at the left.
bottomText std::string Text displayed at the bottom.
sideLimit bool Enables side limits for camera movement.
topDownLimit bool Enables top-down movement limits.
topAlign double Vertical alignment at the top.
bottomAlign double Vertical alignment at the bottom.
leftAlign double Horizontal alignment at the left.
rightAlign double Horizontal alignment at the right.

Transform & Positioning

Property Type Description
cutOutOfBounds bool Clips objects outside the bounds.
useRelativeTransform bool Uses relative transformation.
position Vector3 Camera position in 3D space.
rotation double Camera rotation.
displayPosition Vector2 Position used for displaying the camera view.
anchor Vector2 Camera anchor point.
cameraRect Rect Defines the camera’s viewable rectangle.
scale Vector3 Camera scaling factor.

Private Members

Property Type Description
hideMouse bool Hides the mouse cursor when set to true.
lastFrame std::map<std::tuple<int, int>, std::string> Stores the last rendered frame.
isRunningCam std::atomic<bool> Indicates whether the camera is running.
currentCamera static Camera* Pointer to the active camera instance.