Hi !
I'm currently using the C-API (don't know what tag to set ?) on Windows with CLion
And in my update function, I want to show formatted text.
So I'm using :
static int update(void* userdata) {
PlaydateAPI* pd = userdata;
...
int camX;
int camY:
// Set the variables "camX" and "camY" to the position of the camera
camera_getPosition(&camX, &camY);
char* camPosStr;
pd->system->formatString(&camPosStr, "Camera : %d, %d", camX, camY);
pd->graphics->drawText(camPosStr, strlen(camPosStr), kASCIIEncoding, camX - 50, camY - 50);
...
}
but at the end of update
, I need to free the memory (because formatString
allocates a buffer).
But, when I'm trying to free it using :
free(camPosStr);
I get an error :
But, when I'm using :
pd->system->realloc(camPosStr, 0);
It's working fine...
That's weird because free()
is remapped to pd->system->realloc(x, 0)
in setup.c
?
Is that a "normal" behavior, or just a bug ?