Trace Engine
A Raycaster Engine in C
Loading...
Searching...
No Matches
trc_camera.h File Reference

Go to the source code of this file.

Functions

trc_world_position_t get_camera_position (void)
 
void move_camera_sliding (const trc_world_position_t velocity)
 
void move_camera_colliding (const trc_world_position_t velocity)
 
void rotate_camera (const float rotation_delta)
 
trc_world_position_t get_camera_direction (void)
 
float get_camera_angle (void)
 
void reset_camera_info (void)
 
void draw_camera (void)
 
void open_door (void)
 

Function Documentation

◆ draw_camera()

void draw_camera ( void  )

Draw the camera in the screen in the actual camera position.

Note
The camera is represented as a yellow dot with a line in front of him. This line represent the face of the camera.

◆ get_camera_angle()

float get_camera_angle ( void  )

Returns the current camera angle of vision (in radians)

◆ get_camera_direction()

trc_world_position_t get_camera_direction ( void  )

Returns the current camera direction, in the form of a normalized vector

◆ get_camera_position()

trc_world_position_t get_camera_position ( void  )

Returns the current camera position

◆ move_camera_colliding()

void move_camera_colliding ( const trc_world_position_t  velocity)

Moves the camera with the given velocity, will stop fucking moving if a collision is detected

◆ move_camera_sliding()

void move_camera_sliding ( const trc_world_position_t  velocity)

Moves the camera with the given velocity, will slide along the walls if a collision is detected

◆ open_door()

void open_door ( void  )

Check if is a door infront of the camera. If that's true, opens the door

◆ reset_camera_info()

void reset_camera_info ( void  )

Sets the camera info to the current level

Note
If you change or reset the level, call this function to update the camera position, velocity, etc

◆ rotate_camera()

void rotate_camera ( const float  rotation_delta)

Rotates the camera adding the given delta to the current camera angle

Note
The sign of rotation_delta determines the direction of the rotation