#include "render_util.h" #include "easyx.h" #include "util/vector.h" #include #include extern "C" { static vector_Vector *tbuf; void render_DrawText(int x, int y, const char *str) { if (!tbuf) tbuf = vector_Create(1); int cx = x, cy = y; const char zero = 0; vector_Clear(tbuf); int len = strlen(str); int i = 0; while (i < len) { if (str[i] == '\n') { vector_Push(tbuf, &zero); outtextxy(cx, cy, (LPCTSTR)vector_Data(tbuf)); cy += TEXTHEIGHT; vector_Clear(tbuf); } else vector_Push(tbuf, &str[i]); i++; } if (vector_Size(tbuf) > 0) { vector_Push(tbuf, &zero); outtextxy(cx, cy, (LPCTSTR)vector_Data(tbuf)); vector_Clear(tbuf); } } }