Vulkan2D
2D renderer written in C using Vulkan and SDL2
Camera.h File Reference

User-level camera things. More...

#include "VK2D/Structs.h"
Include dependency graph for Camera.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

VK2DCameraIndex vk2dCameraCreate (VK2DCameraSpec spec)
 Creates a new camera and returns the index, or returns VK2D_INVALID_CAMERA if no more cameras can be created. More...
 
void vk2dCameraUpdate (VK2DCameraIndex index, VK2DCameraSpec spec)
 Updates a camera with new positional data. More...
 
VK2DCameraSpec vk2dCameraGetSpec (VK2DCameraIndex index)
 Returns the spec of a specified camera. More...
 
void vk2dCameraSetState (VK2DCameraIndex index, VK2DCameraState state)
 Sets the state of a camera. More...
 
VK2DCameraState vk2dCameraGetState (VK2DCameraIndex index)
 Gets the state of a camera. More...
 

Detailed Description

User-level camera things.

Author
Paolo Mazzon

Function Documentation

◆ vk2dCameraCreate()

VK2DCameraIndex vk2dCameraCreate ( VK2DCameraSpec  spec)

Creates a new camera and returns the index, or returns VK2D_INVALID_CAMERA if no more cameras can be created.

Parameters
specInitial state for the camera
Returns
Either a new camera index or VK2D_INVALID_CAMERA if the camera limit has been reached

Cameras are created in the state cs_Normal.

◆ vk2dCameraGetSpec()

VK2DCameraSpec vk2dCameraGetSpec ( VK2DCameraIndex  index)

Returns the spec of a specified camera.

Parameters
indexIndex of the camera to return
Returns
Returns the specified camera's spec

◆ vk2dCameraGetState()

VK2DCameraState vk2dCameraGetState ( VK2DCameraIndex  index)

Gets the state of a camera.

Parameters
indexIndex of the camera to get the state of
Returns
Returns the state of the camera

◆ vk2dCameraSetState()

void vk2dCameraSetState ( VK2DCameraIndex  index,
VK2DCameraState  state 
)

Sets the state of a camera.

Parameters
indexIndex of the camera to update
stateThe new state of the camera, if its cs_Deleted the camera is completely invalidated

Cameras are automatically deleted with the renderer, there is no need to free each one yourself

◆ vk2dCameraUpdate()

void vk2dCameraUpdate ( VK2DCameraIndex  index,
VK2DCameraSpec  spec 
)

Updates a camera with new positional data.

Parameters
indexIndex of the camera to update (camera must not be in the state cs_Deleted)
specNew camera spec to apply

This can be called at any time, but the actual camera is only updated whenever vk2dRendererStartFrame is called. Any calls to this function will only be visible the next time vk2dRendererStartFrame is called. If wOnScreen or hOnScreen is 0, it will be replaced with the window width/height.