File Game2DLayer.c

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

Go to the source code of this file

  • #include "Game2DLayer.h"
  • #include "GameFramework.h"
  • #include "Atlas.h"
  • #include <stdlib.h>
  • #include <string.h>
  • #include "BinarySerializer.h"
  • #include "DrawContext.h"
  • #include "AssertLib.h"
  • #include "DynArray.h"
  • #include <cglm/cglm.h>
  • #include "GameFrameworkEvent.h"
  • #include "Scripting.h"
  • #include "XMLUIGameLayer.h"
  • #include "FreeLookCameraMode.h"
  • #include "EntityQuadTree.h"
  • #include "FloatingPointLib.h"
  • #include "Camera2D.h"
  • #include "Network.h"
  • #include "Log.h"
  • #include "Game2DLayerNetwork.h"

Classes

Type Name
struct InitEntitiesCtx
struct InputEntityContext
struct PostPhysEntityContext
struct UpdateEntityContext

Public Attributes

Type Name
int gTilesRendered = 0

Public Static Attributes

Type Name
struct Entity2DCollection * gEntityCollectionCurrent = NULL

Public Functions

Type Name
void Et2D_Transform2DToMat3 (struct Transform2D * pTrans, mat3 out)
convert a transform2D to a matrix
void G2D_SaveLevelDataInternal (struct GameLayer2DData * pData, struct BinarySerializer * pBS)
void Game2DLayer_Get (struct GameFrameworkLayer * pLayer, struct Game2DLayerOptions * pOptions, DrawContext * pDC)
void Game2DLayer_OnPop (struct GameFrameworkLayer * pLayer, DrawContext * drawContext, InputContext * inputContext)
void Game2DLayer_SaveLevelFile (struct GameLayer2DData * pData, const char * outputFilePath)
void GameLayer2D_OnPush (struct GameFrameworkLayer * pLayer, DrawContext * drawContext, InputContext * inputContext)
void OutputSpriteVertices (AtlasSprite * pSprite, VECTOR(Worldspace2DVert) * pOutVert, VECTOR(VertIndexT) * pOutInd, VertIndexT * pNextIndex, int col, int row, struct Transform2D * pTMLayerTransform)
void TilemapLayer_GetTLBR (vec2 tl, vec2 br, struct TileMapLayer * pTMLayer)
VECTOR (HEntity2D)

Public Static Functions

Type Name
void ActivateFreeLookMode (InputContext * inputContext, struct GameLayer2DData * pData)
void Draw (struct GameFrameworkLayer * pLayer, DrawContext * context)
int EntityDrawOrderCompare (const void * a, const void * b)
bool InitEntities (struct Entity2D * pEnt, int i, void * pUser)
void Input (struct GameFrameworkLayer * pLayer, InputContext * context)
bool InputEntities (struct Entity2D * pEnt, int i, void * pUser)
void LoadLayerAssets (struct GameLayer2DData * pData, DrawContext * pDC)
void LoadLevelData (struct TileMap * pTileMap, const char * tilemapFilePath, DrawContext * pDC, hAtlas atlas, struct GameLayer2DData * pData)
void LoadLevelDataFromServer (struct TileMap * pTileMap, DrawContext * pDC, hAtlas atlas, struct GameLayer2DData * pData)
void LoadLevelDataInternal (struct TileMap * pTileMap, struct BinarySerializer * pBs, DrawContext * pDC, hAtlas atlas, struct GameLayer2DData * pData)
void LoadLevelDataV1 (struct TileMap * pTileMap, struct BinarySerializer * pBS, struct GameLayer2DData * pData)
void LoadTilesRLEV1 (struct TileMapLayer * pTileMap, struct BinarySerializer * pBS)
void LoadTilesUncompressedV1 (struct TileMapLayer * pLayer, struct BinarySerializer * pBS)
bool NetworkUpdateWorldstateCallback (struct SDTimer * pTimer)
void OnDebugLayerPushed (void * pUserData, void * pEventData)
void OnWindowDimsChange (struct GameFrameworkLayer * pLayer, int newW, int newH)
void OutputTilemapLayerVertices (hAtlas atlas, struct TileMapLayer * pLayer, VECTOR(Worldspace2DVert) * outVerts, VECTOR(VertIndexT) * outInds, VertIndexT * pNextIndex, vec2 viewportTL, vec2 viewportBR)
void OutputVertices (struct TileMap * pData, struct Transform2D * pCam, VECTOR(Worldspace2DVert) * outVerts, VECTOR(VertIndexT) * outIndices, struct GameLayer2DData * pLayerData, struct GameFrameworkLayer * pLayer)
bool PostPhysicsEntities (struct Entity2D * pEnt, int i, void * pUser)
void PublishDebugMessage (struct GameLayer2DData * pData)
void Update (struct GameFrameworkLayer * pLayer, float deltaT)
bool UpdateEntities (struct Entity2D * pEnt, int i, void * pUser)

Public Attributes Documentation

variable gTilesRendered

int gTilesRendered;

Public Static Attributes Documentation

variable gEntityCollectionCurrent

struct Entity2DCollection* gEntityCollectionCurrent;

Public Functions Documentation

function Et2D_Transform2DToMat3

convert a transform2D to a matrix

void Et2D_Transform2DToMat3 (
    struct Transform2D * pTrans,
    mat3 out
) 

Parameters:

  • pTrans input transform
  • out output matrix

function G2D_SaveLevelDataInternal

void G2D_SaveLevelDataInternal (
    struct GameLayer2DData * pData,
    struct BinarySerializer * pBS
) 

Parameters:

  • pData
  • pBS

function Game2DLayer_Get

void Game2DLayer_Get (
    struct GameFrameworkLayer * pLayer,
    struct Game2DLayerOptions * pOptions,
    DrawContext * pDC
) 

function Game2DLayer_OnPop

void Game2DLayer_OnPop (
    struct GameFrameworkLayer * pLayer,
    DrawContext * drawContext,
    InputContext * inputContext
) 

function Game2DLayer_SaveLevelFile

void Game2DLayer_SaveLevelFile (
    struct GameLayer2DData * pData,
    const char * outputFilePath
) 

function GameLayer2D_OnPush

void GameLayer2D_OnPush (
    struct GameFrameworkLayer * pLayer,
    DrawContext * drawContext,
    InputContext * inputContext
) 

function OutputSpriteVertices

void OutputSpriteVertices (
    AtlasSprite * pSprite,
    VECTOR( Worldspace2DVert ) * pOutVert,
    VECTOR(VertIndexT) * pOutInd,
    VertIndexT * pNextIndex,
    int col,
    int row,
    struct Transform2D * pTMLayerTransform
) 

function TilemapLayer_GetTLBR

void TilemapLayer_GetTLBR (
    vec2 tl,
    vec2 br,
    struct TileMapLayer * pTMLayer
) 

function VECTOR

VECTOR (
    HEntity2D
) 

Public Static Functions Documentation

function ActivateFreeLookMode

static void ActivateFreeLookMode (
    InputContext * inputContext,
    struct GameLayer2DData * pData
) 

function Draw

static void Draw (
    struct GameFrameworkLayer * pLayer,
    DrawContext * context
) 

function EntityDrawOrderCompare

static int EntityDrawOrderCompare (
    const void * a,
    const void * b
) 

function InitEntities

static bool InitEntities (
    struct Entity2D * pEnt,
    int i,
    void * pUser
) 

function Input

static void Input (
    struct GameFrameworkLayer * pLayer,
    InputContext * context
) 

function InputEntities

static bool InputEntities (
    struct Entity2D * pEnt,
    int i,
    void * pUser
) 

function LoadLayerAssets

static void LoadLayerAssets (
    struct GameLayer2DData * pData,
    DrawContext * pDC
) 

function LoadLevelData

static void LoadLevelData (
    struct TileMap * pTileMap,
    const char * tilemapFilePath,
    DrawContext * pDC,
    hAtlas atlas,
    struct GameLayer2DData * pData
) 

function LoadLevelDataFromServer

static void LoadLevelDataFromServer (
    struct TileMap * pTileMap,
    DrawContext * pDC,
    hAtlas atlas,
    struct GameLayer2DData * pData
) 

function LoadLevelDataInternal

static void LoadLevelDataInternal (
    struct TileMap * pTileMap,
    struct BinarySerializer * pBs,
    DrawContext * pDC,
    hAtlas atlas,
    struct GameLayer2DData * pData
) 

function LoadLevelDataV1

static void LoadLevelDataV1 (
    struct TileMap * pTileMap,
    struct BinarySerializer * pBS,
    struct GameLayer2DData * pData
) 

function LoadTilesRLEV1

static void LoadTilesRLEV1 (
    struct TileMapLayer * pTileMap,
    struct BinarySerializer * pBS
) 

function LoadTilesUncompressedV1

static void LoadTilesUncompressedV1 (
    struct TileMapLayer * pLayer,
    struct BinarySerializer * pBS
) 

function NetworkUpdateWorldstateCallback

static bool NetworkUpdateWorldstateCallback (
    struct SDTimer * pTimer
) 

function OnDebugLayerPushed

static void OnDebugLayerPushed (
    void * pUserData,
    void * pEventData
) 

function OnWindowDimsChange

static void OnWindowDimsChange (
    struct GameFrameworkLayer * pLayer,
    int newW,
    int newH
) 

function OutputTilemapLayerVertices

static void OutputTilemapLayerVertices (
    hAtlas atlas,
    struct TileMapLayer * pLayer,
    VECTOR( Worldspace2DVert ) * outVerts,
    VECTOR(VertIndexT) * outInds,
    VertIndexT * pNextIndex,
    vec2 viewportTL,
    vec2 viewportBR
) 

function OutputVertices

static void OutputVertices (
    struct TileMap * pData,
    struct Transform2D * pCam,
    VECTOR( Worldspace2DVert ) * outVerts,
    VECTOR(VertIndexT) * outIndices,
    struct GameLayer2DData * pLayerData,
    struct GameFrameworkLayer * pLayer
) 

function PostPhysicsEntities

static bool PostPhysicsEntities (
    struct Entity2D * pEnt,
    int i,
    void * pUser
) 

function PublishDebugMessage

static void PublishDebugMessage (
    struct GameLayer2DData * pData
) 

function Update

static void Update (
    struct GameFrameworkLayer * pLayer,
    float deltaT
) 

function UpdateEntities

static bool UpdateEntities (
    struct Entity2D * pEnt,
    int i,
    void * pUser
) 


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