51GfuiLabelCreateEx(
void *scr,
const char *text,
float *fgColor,
int font,
int x,
int y,
int align,
int maxlen)
62 object->id = screen->
curId++;
64 if (maxlen == 0) maxlen = strlen(text);
65 label = &(
object->u.label);
66 label->
text = (
char*)calloc(maxlen+1, 1);
67 strncpy(label->
text, text, maxlen);
68 label->
text[maxlen] =
'\0';
76 width =
gfuiFont[font]->getWidth((
const char *)label->
text);
80 label->
x =
object->xmin = x;
83 object->xmax = x + width;
87 label->
x =
object->xmin = x - width / 2;
90 object->xmax = x + width / 2;
94 label->
x =
object->xmin = x - width;
169 switch(label->
align&0xF0) {
171 curObject->
xmax = label->
x + w;
174 label->
x = curObject->
xmin = label->
x + pw / 2 - w / 2;
175 curObject->
xmax = curObject->
xmax - pw / 2 + w / 2;
178 label->
x = curObject->
xmin = curObject->
xmax - w;
199 if (curObject != NULL) {
201 curObject = curObject->
next;
202 if (curObject->
id ==
id) {
208 }
while (curObject != screen->
objects);
227 if (curObject != NULL) {
229 curObject = curObject->
next;
230 if (curObject->
id ==
id) {
236 }
while (curObject != screen->
objects);
247 if (label->
bgColor[3] != 0.0) {
void setRGBA(const float prgba[4])
int getWidth(const char *text)
void GfuiLabelSetText(void *scr, int id, const char *text)
Change the text of a label.
int GfuiTitleCreate(void *scr, const char *text, int maxlen)
Add a Title to the screen.
int GfuiTipCreate(void *scr, const char *text, int maxlen)
Add a Tip (generally associated with a button).
int GfuiLabelCreateEx(void *scr, const char *text, float *fgColor, int font, int x, int y, int align, int maxlen)
Create a new label (extended version).
int GfuiLabelCreate(void *scr, const char *text, int font, int x, int y, int align, int maxlen)
Add a label to a screen.
void GfuiLabelSetColor(void *scr, int id, float *color)
Change the color of a label.
float GfuiColor[GFUI_COLORNB][4]
void gfuiPrintString(int x, int y, GfuiFontClass *font, const char *string)
void gfuiAddObject(tGfuiScreen *screen, tGfuiObject *object)
struct GfuiObject tGfuiObject
GfuiFontClass * gfuiFont[FONT_NB]
void gfuiReleaseLabel(tGfuiObject *obj)
void gfuiDrawLabel(tGfuiObject *obj)
void gfuiSetLabelText(tGfuiObject *curObject, tGfuiLabel *label, const char *text)
union GfuiObject::@107216344126174123112226307372375007210201317144 u
The Gaming Framework API (client part).