mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2024-12-05 00:38:00 +01:00
utils: improve docs and const correctness
This commit is contained in:
parent
f7c9088695
commit
7cca01b4b8
2 changed files with 11 additions and 8 deletions
|
@ -633,7 +633,7 @@ SYMBOL_EXPORT void DisableCompositor(struct Game* game) {
|
|||
ResizeGamestates(game);
|
||||
}
|
||||
|
||||
SYMBOL_EXPORT char* StrToLower(struct Game* game, char* text) {
|
||||
SYMBOL_EXPORT char* StrToLower(struct Game* game, const char* text) {
|
||||
// FIXME: UTF-8
|
||||
char *res = strdup(text), *iter = res;
|
||||
while (*iter) {
|
||||
|
@ -643,7 +643,7 @@ SYMBOL_EXPORT char* StrToLower(struct Game* game, char* text) {
|
|||
return AddGarbage(game, res);
|
||||
}
|
||||
|
||||
SYMBOL_EXPORT char* StrToUpper(struct Game* game, char* text) {
|
||||
SYMBOL_EXPORT char* StrToUpper(struct Game* game, const char* text) {
|
||||
// FIXME: UTF-8
|
||||
char *res = strdup(text), *iter = res;
|
||||
while (*iter) {
|
||||
|
@ -653,7 +653,7 @@ SYMBOL_EXPORT char* StrToUpper(struct Game* game, char* text) {
|
|||
return AddGarbage(game, res);
|
||||
}
|
||||
|
||||
SYMBOL_EXPORT char* PunchNumber(struct Game* game, char* text, char ch, int number) {
|
||||
SYMBOL_EXPORT char* PunchNumber(struct Game* game, const char* text, char ch, int number) {
|
||||
char* txt = strdup(text);
|
||||
char* tmp = txt;
|
||||
while (*tmp) {
|
||||
|
|
13
src/utils.h
13
src/utils.h
|
@ -52,9 +52,9 @@ void ScaleBitmap(ALLEGRO_BITMAP* source, int width, int height);
|
|||
/*! \brief Loads bitmap into memory and scales it with software linear filtering. */
|
||||
ALLEGRO_BITMAP* LoadScaledBitmap(struct Game* game, char* filename, int width, int height);
|
||||
|
||||
/*! \brief Finds the path for data file. Returns NULL when the file can't be found. */
|
||||
/*! \brief Finds the path for data file. Returns NULL when the file can't be found, or ephemeral string otherwise. */
|
||||
const char* FindDataFilePath(struct Game* game, const char* filename);
|
||||
/*! \brief Finds the path for data file. Triggers BSOD and quits when the file can't be found. */
|
||||
/*! \brief Finds the path for data file. Triggers BSOD and quits when the file can't be found, returns ephemeral string otherwise. */
|
||||
const char* GetDataFilePath(struct Game* game, const char* filename);
|
||||
|
||||
__attribute__((__format__(__printf__, 5, 6))) void PrintConsoleWithContext(struct Game* game, int line, const char* file, const char* func, char* format, ...);
|
||||
|
@ -85,10 +85,13 @@ ALLEGRO_BITMAP* CreateNotPreservedBitmap(int width, int height);
|
|||
void EnableCompositor(struct Game* game, void compositor(struct Game* game));
|
||||
void DisableCompositor(struct Game* game);
|
||||
|
||||
char* StrToLower(struct Game* game, char* text);
|
||||
char* StrToUpper(struct Game* game, char* text);
|
||||
/*! \brief Converts given string to lowercase. Returns ephemeral string. */
|
||||
char* StrToLower(struct Game* game, const char* text);
|
||||
/*! \brief Converts given string to uppercase. Returns ephemeral string. */
|
||||
char* StrToUpper(struct Game* game, const char* text);
|
||||
|
||||
char* PunchNumber(struct Game* game, char* text, char ch, int number);
|
||||
/*! \brief Puts a given number into places in given string marked by given character. Returns ephemeral string. */
|
||||
char* PunchNumber(struct Game* game, const char* text, char ch, int number);
|
||||
|
||||
/*! \brief Quits the game. On platforms that allow it, brings the game to the background without quiting if <allow_pausing> is true. */
|
||||
void QuitGame(struct Game* game, bool allow_pausing);
|
||||
|
|
Loading…
Reference in a new issue