File Atlas.h
FileList > engine > include > Atlas.h
Go to the source code of this file
#include "IntTypes.h"#include "HandleDefs.h"#include <cglm/cglm.h>#include <stdbool.h>
Classes
| Type | Name |
|---|---|
| struct | AtlasAnimation |
| struct | EndAtlasOptions |
| struct | FontAtlasAdditionSpec |
| struct | FontSize |
| struct | _AtlasSprite A sprite stored in the atlas. |
Public Types
| Type | Name |
|---|---|
| typedef struct _AtlasSprite | AtlasSprite A sprite stored in the atlas. |
| typedef struct DrawContext | DrawContext |
| typedef struct _xmlNode | xmlNode |
Public Functions
| Type | Name |
|---|---|
| HFont | At_AddFont (const struct FontAtlasAdditionSpec * pFontSpec) |
| hSprite | At_AddSprite (const char * imgPath, int topLeftXPx, int topRightYPx, int widthPx, int heightPx, const char * name, bool bMinimizeSpace) Add a sprite to the atlas, cuts out the pixels for that specific sprite to be nested when At_EndAtlas is called. |
| void | At_BeginAtlas () |
| void | At_BeginTileset (int beginI) |
| void | At_DestroyAtlas (hAtlas atlas, struct DrawContext * pDC) |
| hAtlas | At_EndAtlas (struct DrawContext * pDC) |
| hAtlas | At_EndAtlasEx (struct DrawContext * pDC, struct EndAtlasOptions * pOptions) |
| void | At_EndTileset (int endI) |
| struct AtlasAnimation * | At_FindAnim (hAtlas atlas, const char * name) |
| hSprite | At_FindSprite (const char * name, hAtlas atlas) |
| hTexture | At_GetAtlasTexture (hAtlas atlas) |
| AtlasSprite * | At_GetSprite (hSprite sprite, hAtlas atlas) |
| void | At_Init () |
| hAtlas | At_LoadAtlas (xmlNode * child0, struct DrawContext * pDC) |
| hAtlas | At_LoadAtlasEx (xmlNode * child0, struct DrawContext * pDC, struct EndAtlasOptions * pOptions) |
| TileIndex | At_LookupNamedTile (hAtlas atlas, const char * name) Look up the atlas's tileset index for a given name - this is different from sprite handle, it's the index you need to write to the tile layer array, convertable to a sprite with At_TilemapIndexToSprite. |
| float | At_PixelsToPts (float val) |
| void | At_SerializeAtlas (struct BinarySerializer * pSerializer, hAtlas * atlas, struct DrawContext * pDC) |
| void | At_SetCurrent (hAtlas atlas, DrawContext * pDC) |
| hSprite | At_TilemapIndexToSprite (hAtlas atlas, TileIndex tileIndex) |
| float | Fo_CharHeight (hAtlas hAtlas, HFont hFont, char c) |
| float | Fo_CharWidth (hAtlas hAtlas, HFont hFont, char c) |
| HFont | Fo_FindFont (hAtlas hAtlas, const char * fontName, float sizePts) |
| AtlasSprite * | Fo_GetCharSprite (hAtlas hAtlas, HFont hFont, char c) |
| float | Fo_GetMaxYBearing (hAtlas hAtlas, HFont hFont, const char * str) get the maximum y bearing value for a string: |
| float | Fo_GetMinYBearing (hAtlas hAtlas, HFont hFont, const char * str) get the minimum y bearing value for a string: |
| float | Fo_StringHeight (hAtlas hAtlas, HFont hFont, const char * stringVal) |
| float | Fo_StringHeightSingleLine (hAtlas hAtlas, HFont hFont, const char * stringVal) |
| float | Fo_StringWidth (hAtlas hAtlas, HFont hFont, const char * stringVal) |
| bool | Fo_TryGetCharAdvance (hAtlas hAtlas, HFont hFont, char c, float * outAdvance) |
| bool | Fo_TryGetCharBearing (hAtlas hAtlas, HFont hFont, char c, vec2 outBearing) |
Macros
| Type | Name |
|---|---|
| define | MAX_FONT_NAME_SIZE 128 |
| define | MAX_FONT_PATH_SIZE 256 |
| define | MAX_NUM_FONT_SIZES 32 |
| define | VECTOR (a) a\* |
Public Types Documentation
typedef AtlasSprite
A sprite stored in the atlas.
typedef struct _AtlasSprite AtlasSprite;
typedef DrawContext
typedef struct DrawContext DrawContext;
typedef xmlNode
typedef struct _xmlNode xmlNode;
Public Functions Documentation
function At_AddFont
HFont At_AddFont (
const struct FontAtlasAdditionSpec * pFontSpec
)
function At_AddSprite
Add a sprite to the atlas, cuts out the pixels for that specific sprite to be nested when At_EndAtlas is called.
hSprite At_AddSprite (
const char * imgPath,
int topLeftXPx,
int topRightYPx,
int widthPx,
int heightPx,
const char * name,
bool bMinimizeSpace
)
Parameters:
imgPathpath to img filetopLeftXPxsprite TL coordstopRightYPxsprite TR coordswidthPx"notional" widthheightPx"notional" heightnamesprite name, for referencing when it's in the atlasbMinimizeSpacefind minimum rect to store the sprite, if false action dims == "notional" dims
Returns:
function At_BeginAtlas
void At_BeginAtlas ()
function At_BeginTileset
void At_BeginTileset (
int beginI
)
function At_DestroyAtlas
void At_DestroyAtlas (
hAtlas atlas,
struct DrawContext * pDC
)
function At_EndAtlas
hAtlas At_EndAtlas (
struct DrawContext * pDC
)
function At_EndAtlasEx
hAtlas At_EndAtlasEx (
struct DrawContext * pDC,
struct EndAtlasOptions * pOptions
)
function At_EndTileset
void At_EndTileset (
int endI
)
function At_FindAnim
struct AtlasAnimation * At_FindAnim (
hAtlas atlas,
const char * name
)
function At_FindSprite
hSprite At_FindSprite (
const char * name,
hAtlas atlas
)
function At_GetAtlasTexture
hTexture At_GetAtlasTexture (
hAtlas atlas
)
function At_GetSprite
AtlasSprite * At_GetSprite (
hSprite sprite,
hAtlas atlas
)
function At_Init
void At_Init ()
function At_LoadAtlas
hAtlas At_LoadAtlas (
xmlNode * child0,
struct DrawContext * pDC
)
function At_LoadAtlasEx
hAtlas At_LoadAtlasEx (
xmlNode * child0,
struct DrawContext * pDC,
struct EndAtlasOptions * pOptions
)
function At_LookupNamedTile
Look up the atlas's tileset index for a given name - this is different from sprite handle, it's the index you need to write to the tile layer array, convertable to a sprite with At_TilemapIndexToSprite.
TileIndex At_LookupNamedTile (
hAtlas atlas,
const char * name
)
Parameters:
name
Returns:
function At_PixelsToPts
float At_PixelsToPts (
float val
)
function At_SerializeAtlas
void At_SerializeAtlas (
struct BinarySerializer * pSerializer,
hAtlas * atlas,
struct DrawContext * pDC
)
Parameters:
pSerializerbinary serialzier to load or saveatlasIf loading, point to an unititialized handle to output the new handle If saving point to the handle of the atlas you want to savepDC
function At_SetCurrent
void At_SetCurrent (
hAtlas atlas,
DrawContext * pDC
)
function At_TilemapIndexToSprite
hSprite At_TilemapIndexToSprite (
hAtlas atlas,
TileIndex tileIndex
)
function Fo_CharHeight
float Fo_CharHeight (
hAtlas hAtlas,
HFont hFont,
char c
)
function Fo_CharWidth
float Fo_CharWidth (
hAtlas hAtlas,
HFont hFont,
char c
)
function Fo_FindFont
HFont Fo_FindFont (
hAtlas hAtlas,
const char * fontName,
float sizePts
)
function Fo_GetCharSprite
AtlasSprite * Fo_GetCharSprite (
hAtlas hAtlas,
HFont hFont,
char c
)
function Fo_GetMaxYBearing
get the maximum y bearing value for a string:
float Fo_GetMaxYBearing (
hAtlas hAtlas,
HFont hFont,
const char * str
)
- bearing is offset from pen position to bounding box edge
Parameters:
hAtlashFontstr
Returns:
max Y bearing
function Fo_GetMinYBearing
get the minimum y bearing value for a string:
float Fo_GetMinYBearing (
hAtlas hAtlas,
HFont hFont,
const char * str
)
- bearing is offset from pen position to bounding box edge
- used to position the string by its top left corner
Parameters:
hAtlashFontstr
Returns:
min Y bearing
function Fo_StringHeight
float Fo_StringHeight (
hAtlas hAtlas,
HFont hFont,
const char * stringVal
)
function Fo_StringHeightSingleLine
float Fo_StringHeightSingleLine (
hAtlas hAtlas,
HFont hFont,
const char * stringVal
)
function Fo_StringWidth
float Fo_StringWidth (
hAtlas hAtlas,
HFont hFont,
const char * stringVal
)
function Fo_TryGetCharAdvance
bool Fo_TryGetCharAdvance (
hAtlas hAtlas,
HFont hFont,
char c,
float * outAdvance
)
function Fo_TryGetCharBearing
bool Fo_TryGetCharBearing (
hAtlas hAtlas,
HFont hFont,
char c,
vec2 outBearing
)
Macro Definition Documentation
define MAX_FONT_NAME_SIZE
#define MAX_FONT_NAME_SIZE `128`
define MAX_FONT_PATH_SIZE
#define MAX_FONT_PATH_SIZE `256`
define MAX_NUM_FONT_SIZES
#define MAX_NUM_FONT_SIZES `32`
define VECTOR
#define VECTOR (
a
) `a*`
The documentation for this class was generated from the following file /home/runner/work/2DFarmingRPG/2DFarmingRPG/Stardew/engine/include/Atlas.h