File Camera2D.c

FileList > engine > src > gameframework > layers > Game2D > Camera2D.c

Go to the source code of this file

  • #include "Camera2D.h"
  • #include "Game2DLayer.h"
  • #include "AssertLib.h"

Public Functions

Type Name
void CenterCameraAt (float worldspaceX, float worldspaceY, struct Transform2D * pCam, int winWidth, int winHeight)
void ClampCameraToTileLayer (struct GameLayer2DData * pGameLayerData, int tileLayerNum)
Make it so no matter where move the camera nothing outside the layer is visible. If the layer is smaller than the camera bounds the camera position is fixed in the centre.
void GetCamWorldspaceCenter (struct Transform2D * pCam, int winWidth, int winHeight, vec2 outCenter)
void GetViewportWorldspaceTLBR (vec2 outTL, vec2 outBR, struct Transform2D * pCam, int windowW, int windowH)
void GetWorldspacePos (int screenPosX, int screenPosY, int screenW, int screenH, struct Transform2D * pCam, vec2 outWorldspace)
void ScreenSpaceToWorldSpaceTransVector (vec2 screenSpaceTranslateVector, int screenW, int screenH, struct Transform2D * pCam, vec2 outWorldspace)
void UpdateCameraClamp (struct GameLayer2DData * pGameLayerData)
Update the camera position to be clamped, if a clamp is set.

Public Functions Documentation

function CenterCameraAt

void CenterCameraAt (
    float worldspaceX,
    float worldspaceY,
    struct Transform2D * pCam,
    int winWidth,
    int winHeight
) 

function ClampCameraToTileLayer

Make it so no matter where move the camera nothing outside the layer is visible. If the layer is smaller than the camera bounds the camera position is fixed in the centre.

void ClampCameraToTileLayer (
    struct GameLayer2DData * pGameLayerData,
    int tileLayerNum
) 

function GetCamWorldspaceCenter

void GetCamWorldspaceCenter (
    struct Transform2D * pCam,
    int winWidth,
    int winHeight,
    vec2 outCenter
) 

function GetViewportWorldspaceTLBR

void GetViewportWorldspaceTLBR (
    vec2 outTL,
    vec2 outBR,
    struct Transform2D * pCam,
    int windowW,
    int windowH
) 

function GetWorldspacePos

void GetWorldspacePos (
    int screenPosX,
    int screenPosY,
    int screenW,
    int screenH,
    struct Transform2D * pCam,
    vec2 outWorldspace
) 

function ScreenSpaceToWorldSpaceTransVector

void ScreenSpaceToWorldSpaceTransVector (
    vec2 screenSpaceTranslateVector,
    int screenW,
    int screenH,
    struct Transform2D * pCam,
    vec2 outWorldspace
) 

function UpdateCameraClamp

Update the camera position to be clamped, if a clamp is set.

void UpdateCameraClamp (
    struct GameLayer2DData * pGameLayerData
) 


The documentation for this class was generated from the following file /home/runner/work/2DFarmingRPG/2DFarmingRPG/Stardew/engine/src/gameframework/layers/Game2D/Camera2D.c