|
Trace Engine
A Raycaster Engine in C
|
#include "trc_camera.h"#include <math.h>#include "log.h"#include "game_state.h"#include "map.h"#include "graphics.h"#include "trc_transform.h"#include "trc_world_position.h"Macros | |
| #define | CAM_DEFAULT_COLLISION_SIZE 20 |
| #define | CAM_DEFAULT_INIT_ANGLE 0 |
| #define | P_COLOR COLOR_YELLOW |
Functions | |
| trc_world_position_t | get_camera_position (void) |
| float | get_camera_angle (void) |
| trc_world_position_t | get_camera_direction (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) |
| void | reset_camera_info (void) |
| void | draw_camera (void) |
| void | open_door (void) |
Variables | |
| trc_transform_t | trc_camera |
| #define CAM_DEFAULT_COLLISION_SIZE 20 |
Initial collision size for camera (check MAP_CELL_SIZE for size relation)
| #define CAM_DEFAULT_INIT_ANGLE 0 |
Initial camera vision angle (0 means bro is seeing right)
| #define P_COLOR COLOR_YELLOW |
The camera is yellow because reasons
| void draw_camera | ( | void | ) |
Draw the camera in the screen in the actual camera position.
| float get_camera_angle | ( | void | ) |
Returns the current camera angle of vision (in radians)
| trc_world_position_t get_camera_direction | ( | void | ) |
Returns the current camera direction, in the form of a normalized vector
| trc_world_position_t get_camera_position | ( | void | ) |
Returns the current camera position
| 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
| 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
| void open_door | ( | void | ) |
Check if is a door infront of the camera. If that's true, opens the door
| void reset_camera_info | ( | void | ) |
Sets the camera info to the current level
| void rotate_camera | ( | const float | rotation_delta | ) |
Rotates the camera adding the given delta to the current camera angle
| trc_transform_t trc_camera |
The camera info, like the position and actual direction of movement