Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
txt_processor.c File Reference

Functions

long remove_chars (char *str, long len, char c)
 Removes all instances of a given char from a string. Modifies the string in-place and sets a new null terminator, if needed. Also strips non-ASCII characters.
 
bool process_txt (processorInput_t *arg)
 

Variables

const assetProcessor_t textProcessor
 The text processor strips out any carriage returns (\r) or non-ASCII characters from the input file and saves it uncompressed.
 

Function Documentation

◆ remove_chars()

long remove_chars ( char * str,
long len,
char c )

Removes all instances of a given char from a string. Modifies the string in-place and sets a new null terminator, if needed. Also strips non-ASCII characters.

Parameters
strstring to remove chars from
lennumber of chars in the string, including null terminator
cchar to remove
Returns
long number of chars in the new string, including null terminator

◆ process_txt()

bool process_txt ( processorInput_t * arg)

Variable Documentation

◆ textProcessor

const assetProcessor_t textProcessor
Initial value:
= {
.name = "text",
.type = FUNCTION,
.function = process_txt,
.inFmt = FMT_TEXT,
.outFmt = FMT_TEXT,
}
@ FMT_TEXT
A text file's data is passed as an ordinary string.
Definition assets_preprocessor.h:625
@ FUNCTION
Processor that calls a function pointer to process assets.
Definition assets_preprocessor.h:607
bool process_txt(processorInput_t *arg)
Definition txt_processor.c:51

The text processor strips out any carriage returns (\r) or non-ASCII characters from the input file and saves it uncompressed.