You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.4 KiB
56 lines
1.4 KiB
/* $Id: menulabels.c,v 1.1 2003/12/24 02:42:06 stpohle Exp $
|
|
* Menuhandling: labels */
|
|
|
|
#include "basic.h"
|
|
#include "bomberclone.h"
|
|
#include "menu.h"
|
|
#include "menugui.h"
|
|
|
|
|
|
/* draw the menuitem label
|
|
* menuitem->pos.[x|y] - Position inside the menu
|
|
* pos.w - Fontsize
|
|
* label - Text of the label
|
|
*/
|
|
void menu_draw_label (_menuitem *mi) {
|
|
int dx, dy;
|
|
|
|
if (mi->type != MENU_label)
|
|
return;
|
|
|
|
if (mi->pos.x == -1)
|
|
dx = (menu.oldscreenpos.w - (strlen (mi->label) * font[mi->pos.w].size.x)) / 2;
|
|
else
|
|
dx = mi->pos.x;
|
|
if (mi->pos.y == -1)
|
|
dy = (menu.oldscreenpos.h - font[mi->pos.w].size.y) / 2;
|
|
else
|
|
dy = mi->pos.y;
|
|
|
|
font_gfxdraw (menu.oldscreenpos.x + menu.images[0]->w + dx, menu.oldscreenpos.y + menu.images[0]->h + dy, mi->label, mi->pos.w, 5, 10000);
|
|
};
|
|
|
|
|
|
void menu_create_label (char *name, int x, int y, int fontsize) {
|
|
int i = menu_getlastitem(menu.items);
|
|
|
|
if (i == -1) { /* first entry in the itemslist */
|
|
menu.items = &menuitems[0];
|
|
i = 0;
|
|
}
|
|
else if (i >= MENU_MAXENTRYS) { /* max items reached, ignore new item */
|
|
d_fatal ("menu_create_label: MENU_MAXENTRYS reached. Item Ignored\n");
|
|
return;
|
|
}
|
|
else { /* add new item to the list */
|
|
menuitems[i].next = &menuitems[i+1];
|
|
i++;
|
|
}
|
|
|
|
menuitems[i].pos.x = x;
|
|
menuitems[i].pos.y = y;
|
|
menuitems[i].pos.w = fontsize;
|
|
menuitems[i].type = MENU_label;
|
|
strncpy (menuitems[i].label, name, MENU_TITLELEN);
|
|
};
|