Example #1
0
File: map.c Project: atrinik/dwc
/**
 * Update map's data.
 * @param name Map's name.
 * @param bg_music Map's background music. */
void update_map_data(const char *name, char *bg_music)
{
	widgetdata *widget;

	if (!strcmp(bg_music, "no_music"))
	{
		sound_stop_bg_music();
	}
	else
	{
		strncpy(MapData.music, bg_music, sizeof(MapData.music));
		parse_map_bg_music(bg_music);
	}

	if (name)
	{
		strncpy(MapData.name, name, sizeof(MapData.name));

		/* We need to update all mapname widgets on the screen now.
		 * Not that there should be more than one at a time, but just in case. */
		for (widget = cur_widget[MAPNAME_ID]; widget; widget = widget->type_next)
		{
			resize_widget(widget, RESIZE_RIGHT, get_string_pixel_length(name, &BigFont));
			resize_widget(widget, RESIZE_BOTTOM, BigFont.c[0].h);
		}
	}
}
Example #2
0
static void resize_container(void *_object, QWidget *cont, int w, int h)
{
	QWidget *wid = ((CWIDGET *)_object)->widget;
	#if USE_CACHE
	resize_widget(_object, w + wid->width() - cont->width(), h + wid->height() - cont->height());
	#else
	CWIDGET_resize(_object, w + wid->width() - cont->width(), h + wid->height() - cont->height());
	#endif
}