Skip to content

Printing API needs a rework. #129

@HexDecimal

Description

@HexDecimal

There are a lot of parameters that go into libtcod's printing API and there are many different functions handle the different combinations them. I'd like to replace all these functions with a struct which contains any relevant arguments as parameters.

I'll be versioning these to preserve my sanity.

typedef struct TCOD_PrintParams1 {
  ...
} TCOD_PrintParams1;

int TCOD_printf_1(TCOD_Console* console, const TCOD_PrintParams1* params, const char* fmt, ...);
int TCOD_printn_1(TCOD_Console* console, const TCOD_PrintParams1* params, int n, const char* str);
int TCOD_vprintf_1(TCOD_Console* console, const TCOD_PrintParams1* params, const char* fmt, va_list args);
const TCOD_PrintParams1 params = {
    .x = 5;
    .y = 5;
    .fg = {255, 255, 0, 255};
};  // Yellow text with no background.
TCOD_printf_1(console, &params, "%s", "Hello World");

Having some kind of "style" struct for drawing functions and text might also help with this.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions