Пример #1
0
/*
 * @brief
 */
void R_DrawCursor(r_pixel_t x, r_pixel_t y) {

	x -= (r_draw.cursor->width / 2.0);
	y -= (r_draw.cursor->height / 2.0);

	R_DrawImage(x, y, 1.0, r_draw.cursor);
}
Пример #2
0
/*
=============
R_DrawPic
=============
*/
void R_DrawPic (int32_t x, int32_t y, char *pic)
{
	image_t	*gl;
    
	gl = R_DrawFindPic (pic);

	if (!gl) {
		VID_Printf (PRINT_ALL, "Can't find pic: %s\n", pic);
		return;
	}

    R_DrawImage(x, y, gl);
}
Пример #3
0
/**
 * @brief Precache and loading screen at startup
 * @sa CL_InitAfter
 * @param[in] string Draw the loading string - if the scripts are not parsed, this is
 * not possible, so use qfalse for very early calls
 */
void SCR_DrawLoadingScreen (qboolean string, int percent)
{
	const image_t *image;

	R_BeginFrame();

	image = R_FindImage("pics/background/loading", it_pic);
	if (image)
		R_DrawImage(viddef.virtualWidth / 2 - image->width / 2, viddef.virtualHeight / 2 - image->height / 2, image);
	if (string) {
		/* Not used with gettext because it would make removing it too easy. */
		UI_DrawString("f_menubig", ALIGN_UC,
			(int)(viddef.virtualWidth / 2), 30,
			0, viddef.virtualWidth, 50, "Download this game for free at http://ufoai.sf.net", 0, 0, NULL, qfalse, 0);
	}
	SCR_DrawLoadingBar((int)(viddef.virtualWidth / 2) - 300, viddef.virtualHeight - 30, 600, 20, percent);

	R_EndFrame();
}
Пример #4
0
/**
 * @brief
 */
static void Cl_DrawConsole_Background(void) {

	const r_image_t *image = R_LoadImage("ui/conback", IT_UI);
	if (image->type != IT_NULL) {

		const vec_t x_scale = r_context.width / (vec_t) image->width;
		const vec_t y_scale = r_context.height / (vec_t) image->height;

		const vec_t scale = Max(x_scale, y_scale);

		if (cls.state == CL_ACTIVE) {
			R_Color((const vec4_t) {
				1.0, 1.0, 1.0, cl_console_background_alpha->value
			});

			R_DrawImage(0, -r_context.window_height * 0.3333333, scale, image);

			R_Color(NULL);
		} else {
Пример #5
0
/**
 * @brief Draws the current loading pic of the map from base/pics/maps/loading
 * @sa SCR_DrawLoadingBar
 */
void SCR_DrawLoading (int percent, const char *loadingMessages)
{
	const image_t* loadingPic;
	const vec4_t color = {0.0, 0.7, 0.0, 0.8};
	char *mapmsg;

	if (cls.downloadName[0]) {
		SCR_DrawDownloading();
		return;
	}

	loadingPic = SCR_SetLoadingBackground(CL_GetConfigString(CS_MAPTITLE));

	R_BeginFrame();

	/* center loading screen */
	R_DrawImage(viddef.virtualWidth / 2 - loadingPic->width / 2, viddef.virtualHeight / 2 - loadingPic->height / 2, loadingPic);
	R_Color(color);

	if (CL_GetConfigString(CS_TILES)[0] != '\0') {
		mapmsg = va(_("Loading Map [%s]"), _(CL_GetConfigString(CS_MAPTITLE)));
		UI_DrawString("f_menubig", ALIGN_UC,
			(int)(viddef.virtualWidth / 2),
			(int)(viddef.virtualHeight / 2 - 60),
			(int)(viddef.virtualWidth / 2),
			viddef.virtualWidth, 50, mapmsg, 1, 0, NULL, qfalse, 0);
	}

	UI_DrawString("f_menu", ALIGN_UC,
		(int)(viddef.virtualWidth / 2),
		(int)(viddef.virtualHeight / 2),
		(int)(viddef.virtualWidth / 2),
		viddef.virtualWidth, 50, loadingMessages, 1, 0, NULL, qfalse, 0);

	SCR_DrawLoadingBar((int)(viddef.virtualWidth / 2) - 300, viddef.virtualHeight - 30, 600, 20, percent);

	R_EndFrame();
}
Пример #6
0
/**
 * @brief Draws the 3D-cursor in battlemode and the icons/info next to it.
 */
static void SCR_DrawCursor (void)
{
	if (scr_showcursor->integer == 0)
		return;

	if (!scr_cursor->integer)
		return;

	if (scr_cursor->modified) {
		scr_cursor->modified = qfalse;
		SCR_TouchPics();
	}

	if (!cursorImage[0])
		return;

	if (!UI_DNDIsDragging()) {
		const char *pic;
		image_t *image;

		if (cls.team != cl.actTeam && CL_BattlescapeRunning())
			pic = "pics/cursors/wait";
		else
			pic = cursorImage;

		image = R_FindImage(pic, it_pic);
		if (image)
			R_DrawImage(mousePosX - image->width / 2, mousePosY - image->height / 2, image);

		if (IN_GetMouseSpace() == MS_WORLD && CL_BattlescapeRunning()) {
			HUD_UpdateCursor();
		}
	} else {
		UI_DrawCursor();
	}
}
Пример #7
0
/**
 * @brief Renders text and images
 * @sa SEQ_InitStartup
 * @param[in] context Sequence context
 * @param[in] backgroundObjects if true, draw background objects, else display foreground objects
 */
static void SEQ_Render2D (sequenceContext_t *context, bool backgroundObjects)
{
	seq2D_t *s2d;
	int i, j;
	int height = 0;

	/* add texts */
	for (i = 0, s2d = context->obj2Ds; i < context->numObj2Ds; i++, s2d++) {
		if (!s2d->inuse)
			continue;
		if (backgroundObjects != s2d->inBackground)
			continue;

		if (s2d->relativePos && height > 0) {
			s2d->pos[1] += height;
			s2d->relativePos = false;
		}
		/* advance in time */
		for (j = 0; j < 4; j++) {
			s2d->color[j] += cls.frametime * s2d->fade[j];
			if (s2d->color[j] < 0.0)
				s2d->color[j] = 0.0;
			else if (s2d->color[j] > 1.0)
				s2d->color[j] = 1.0;
		}
		for (j = 0; j < 2; j++) {
			s2d->pos[j] += cls.frametime * s2d->speed[j];
			s2d->size[j] += cls.frametime * s2d->enlarge[j];
		}

		/* outside the screen? */
		/** @todo We need this check - but this does not work */
		/*if (s2d->pos[1] >= VID_NORM_HEIGHT || s2d->pos[0] >= VID_NORM_WIDTH)
			continue;*/

		/* render */
		R_Color(s2d->color);

		/* image can be background */
		if (s2d->image[0] != '\0') {
			const image_t *image = R_FindImage(s2d->image, it_pic);
			R_DrawImage(s2d->pos[0], s2d->pos[1], image);
		}

		/* bgcolor can be overlay */
		if (s2d->bgcolor[3] > 0.0)
			R_DrawFill(s2d->pos[0], s2d->pos[1], s2d->size[0], s2d->size[1], s2d->bgcolor);

		/* render */
		R_Color(s2d->color);

		/* gettext placeholder */
		if (s2d->text) {
			int maxWidth = (int) s2d->size[0];
			if (maxWidth <= 0)
				maxWidth = VID_NORM_WIDTH;
			height += UI_DrawString(s2d->font, s2d->align, s2d->pos[0], s2d->pos[1], s2d->pos[0], maxWidth, -1 /** @todo use this for some nice line spacing */, _(s2d->text));
		}
	}
	R_Color(NULL);
}