Example #1
0
void SpinControl_Draw (menulist_s *s)
{
	int alpha = mouseOverAlpha (&s->generic);
	char buffer[100];

	if (s->generic.name)
	{
		Menu_DrawStringR2LDark (s->generic.x + s->generic.parent->x + LCOLUMN_OFFSET,
								s->generic.y + s->generic.parent->y, s->generic.name, alpha);
	}
	if (!strchr(s->itemnames[s->curvalue], '\n'))
	{
		Menu_DrawString (s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET,
						s->generic.y + s->generic.parent->y, s->itemnames[s->curvalue], alpha);
	}
	else
	{
	//	strncpy(buffer, s->itemnames[s->curvalue]);
		Q_strncpyz(buffer, s->itemnames[s->curvalue], sizeof(buffer));
		*strchr(buffer, '\n') = 0;
		Menu_DrawString (s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET,
						s->generic.y + s->generic.parent->y, buffer, alpha);
	//	strncpy(buffer, strchr( s->itemnames[s->curvalue], '\n' ) + 1 );
		Q_strncpyz(buffer, strchr( s->itemnames[s->curvalue], '\n' ) + 1, sizeof(buffer) );
		Menu_DrawString (s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET,
						s->generic.y + s->generic.parent->y + MENU_LINE_SIZE, buffer, alpha);
	}
}
Example #2
0
void SpinControl_Draw( menulist_s *s )
{
	char buffer[100];

	if ( s->generic.name )
	{
		Menu_DrawStringR2LDark( s->generic.x + s->generic.parent->x + LCOLUMN_OFFSET, 
							s->generic.y + s->generic.parent->y, 
							s->generic.name );
	}

	if (!s->itemnames[s->curvalue])
		Com_Error (ERR_DROP, "SpinControl_Draw: %s: NULL current value %d", s->generic.name, s->curvalue);

	if ( !strchr( s->itemnames[s->curvalue], '\n' ) )
	{
		Menu_DrawString( RCOLUMN_OFFSET + s->generic.x + s->generic.parent->x, s->generic.y + s->generic.parent->y, s->itemnames[s->curvalue] );
	}
	else
	{
		strcpy( buffer, s->itemnames[s->curvalue] );
		*strchr( buffer, '\n' ) = 0;
		Menu_DrawString( RCOLUMN_OFFSET + s->generic.x + s->generic.parent->x, s->generic.y + s->generic.parent->y, buffer );
		strcpy( buffer, strchr( s->itemnames[s->curvalue], '\n' ) + 1 );
		Menu_DrawString( RCOLUMN_OFFSET + s->generic.x + s->generic.parent->x, s->generic.y + s->generic.parent->y + 10, buffer );
	}
}
Example #3
0
static void DrawKeyBindingFunc( void *self )
{
	int mkeys[2];
	menuaction_s *a = ( menuaction_s * ) self;

	M_FindKeysForCommand( bindnames[a->generic.localdata[0]][0], mkeys);
		
	if (mkeys[0] == -1)
	{
		Menu_DrawString( a->generic.x + a->generic.parent->x + 16, a->generic.y + a->generic.parent->y, "???" );
	}
	else
	{
		int x;
		const char *name;

		name = Key_KeynumToString (mkeys[0]);

		Menu_DrawString( a->generic.x + a->generic.parent->x + 16, a->generic.y + a->generic.parent->y, name );

		x = strlen(name) * 8;

		if (mkeys[1] != -1)
		{
			Menu_DrawString( a->generic.x + a->generic.parent->x + 24 + x, a->generic.y + a->generic.parent->y, "or" );
			Menu_DrawString( a->generic.x + a->generic.parent->x + 48 + x, a->generic.y + a->generic.parent->y, Key_KeynumToString (mkeys[1]) );
		}
	}
}
static void DrawKeyBindingFunc( void *self )
{
	int keys[2];
	menuaction_s *a = ( menuaction_s * ) self;

	M_FindKeysForCommand( bindnames[a->generic.localdata[0]][0], keys);
		
	if (keys[0] == -1)
	{
		Menu_DrawString (a->generic.x + a->generic.parent->x + 16,
						a->generic.y + a->generic.parent->y, "^1<NONE>", 255);

	}
	else
	{
		int x;
		const char *name;
		int alpha;

		if (cursor.menuitem == a)
			alpha=255;
		else
			alpha=160;
			

		name = Key_KeynumToString (keys[0]);



		Menu_DrawString (a->generic.x + a->generic.parent->x + 16,
						a->generic.y + a->generic.parent->y, name , alpha);





		x = strlen(name) * MENU_FONT_SIZE;


		if (keys[1] != -1)
		{
			Menu_DrawString (a->generic.x + a->generic.parent->x + MENU_FONT_SIZE*3 + x,
							a->generic.y + a->generic.parent->y, "or", alpha);
			Menu_DrawString (a->generic.x + a->generic.parent->x + MENU_FONT_SIZE*6 + x,
							a->generic.y + a->generic.parent->y, Key_KeynumToString(keys[1]), alpha);

		}
	}
}
Example #5
0
void Action_Draw (menuaction_s *a)
{
	int alpha = mouseOverAlpha(&a->generic);

	if (a->generic.flags & QMF_LEFT_JUSTIFY)
	{
		if (a->generic.flags & QMF_GRAYED)
			Menu_DrawStringDark (a->generic.x + a->generic.parent->x + LCOLUMN_OFFSET,
								a->generic.y + a->generic.parent->y, a->generic.name, alpha);
		else
			Menu_DrawString (a->generic.x + a->generic.parent->x + LCOLUMN_OFFSET,
							a->generic.y + a->generic.parent->y, a->generic.name, alpha);
	}
	else
	{
		if (a->generic.flags & QMF_GRAYED)
			Menu_DrawStringR2LDark (a->generic.x + a->generic.parent->x + LCOLUMN_OFFSET,
									a->generic.y + a->generic.parent->y, a->generic.name, alpha);
		else
			Menu_DrawStringR2L (a->generic.x + a->generic.parent->x + LCOLUMN_OFFSET,
								a->generic.y + a->generic.parent->y, a->generic.name, alpha);
	}
	if (a->generic.ownerdraw)
		a->generic.ownerdraw(a);
}
Example #6
0
void Field_Draw (menufield_s *f)
{
	int i, alpha = mouseOverAlpha(&f->generic), xtra;
	char tempbuffer[128]="";
	int offset;

	if (f->generic.name)
		Menu_DrawStringR2LDark (f->generic.x + f->generic.parent->x + LCOLUMN_OFFSET,
								f->generic.y + f->generic.parent->y, f->generic.name, 255);

	if (xtra = stringLengthExtra(f->buffer))
	{
		strncpy( tempbuffer, f->buffer + f->visible_offset, f->visible_length );
		offset = strlen(tempbuffer) - xtra;

		if (offset > f->visible_length)
		{
			f->visible_offset = offset - f->visible_length;
			strncpy( tempbuffer, f->buffer + f->visible_offset - xtra, f->visible_length + xtra );
			offset = f->visible_offset;
		}
	}
	else
	{
		strncpy( tempbuffer, f->buffer + f->visible_offset, f->visible_length );
		offset = strlen(tempbuffer);
	}

	SCR_DrawChar (f->generic.x + f->generic.parent->x + MENU_FONT_SIZE*2,
				f->generic.y + f->generic.parent->y - 4, ALIGN_CENTER, 18, 255,255,255,255, false, false);
	SCR_DrawChar (f->generic.x + f->generic.parent->x + MENU_FONT_SIZE*2,
				f->generic.y + f->generic.parent->y + 4, ALIGN_CENTER, 24, 255,255,255,255, false, false);
	SCR_DrawChar (f->generic.x + f->generic.parent->x + (3+f->visible_length)*MENU_FONT_SIZE,
				f->generic.y + f->generic.parent->y - 4, ALIGN_CENTER, 20,255,255,255,255, false, false);
	SCR_DrawChar (f->generic.x + f->generic.parent->x + (3+f->visible_length)*MENU_FONT_SIZE,
				f->generic.y + f->generic.parent->y + 4, ALIGN_CENTER, 26, 255,255,255,255, false, false);

	for (i = 0; i < f->visible_length; i++)
	{
		SCR_DrawChar (f->generic.x + f->generic.parent->x + (3+i)*MENU_FONT_SIZE,
					f->generic.y + f->generic.parent->y - 4, ALIGN_CENTER, 19, 255,255,255,255, false, false);
		SCR_DrawChar (f->generic.x + f->generic.parent->x + (3+i)*MENU_FONT_SIZE,
					f->generic.y + f->generic.parent->y + 4, ALIGN_CENTER, 25, 255,255,255,255, false, (i==(f->visible_length-1)));
	}

	// add cursor thingie
	if ( Menu_ItemAtCursor(f->generic.parent)==f  && ((int)(Sys_Milliseconds()/250))&1 )
		Com_sprintf(tempbuffer, sizeof(tempbuffer),	"%s%c", tempbuffer, 11);

	Menu_DrawString (f->generic.x + f->generic.parent->x + MENU_FONT_SIZE*3,
					f->generic.y + f->generic.parent->y, tempbuffer, alpha);
}
Example #7
0
File: qmenu.c Project: ZwS/qudos
void
Menu_DrawStatusBar(const char *string)
{
	if (string) {
		int		l = strlen(string);
		int		maxcol = VID_WIDTH / 8;
		int		col = maxcol / 2 - l / 2;

		Draw_Fill(0, VID_HEIGHT - 8, VID_WIDTH, 8, 4);
		Menu_DrawString(col * 8, VID_HEIGHT - 8, string, 255);
	} else {
		Draw_Fill(0, VID_HEIGHT - 8, VID_WIDTH, 8, 0);
	}
}
Example #8
0
void Field_Draw( menufield_s *f )
{
	int i;
	char tempbuffer[128]="";

	if ( f->generic.name )
		Menu_DrawStringR2LDark( f->generic.x + f->generic.parent->x + LCOLUMN_OFFSET, f->generic.y + f->generic.parent->y, f->generic.name );

	strncpy( tempbuffer, f->buffer + f->visible_offset, f->visible_length );

	Draw_Char( f->generic.x + f->generic.parent->x + 16, f->generic.y + f->generic.parent->y - 4, 18 );
	Draw_Char( f->generic.x + f->generic.parent->x + 16, f->generic.y + f->generic.parent->y + 4, 24 );

	Draw_Char( f->generic.x + f->generic.parent->x + 24 + f->visible_length * 8, f->generic.y + f->generic.parent->y - 4, 20 );
	Draw_Char( f->generic.x + f->generic.parent->x + 24 + f->visible_length * 8, f->generic.y + f->generic.parent->y + 4, 26 );

	for ( i = 0; i < f->visible_length; i++ )
	{
		Draw_Char( f->generic.x + f->generic.parent->x + 24 + i * 8, f->generic.y + f->generic.parent->y - 4, 19 );
		Draw_Char( f->generic.x + f->generic.parent->x + 24 + i * 8, f->generic.y + f->generic.parent->y + 4, 25 );
	}

	Menu_DrawString( f->generic.x + f->generic.parent->x + 24, f->generic.y + f->generic.parent->y, tempbuffer );

	if ( Menu_ItemAtCursor( f->generic.parent ) == f )
	{
		int offset;

		if ( f->visible_offset )
			offset = f->visible_length;
		else
			offset = f->cursor;

		if ( ( ( int ) ( Sys_Milliseconds() / 250 ) ) & 1 )
		{
			Draw_Char( f->generic.x + f->generic.parent->x + ( offset + 2 ) * 8 + 8,
					   f->generic.y + f->generic.parent->y,
					   11 );
		}
		else
		{
			Draw_Char( f->generic.x + f->generic.parent->x + ( offset + 2 ) * 8 + 8,
					   f->generic.y + f->generic.parent->y,
					   ' ' );
		}
	}
}
Example #9
0
void M_Credits_MenuDraw(void)
{
    float    alpha, time = (cls.realtime - credits_start_time) * 0.05;
    int      i, y, x, len, stringoffset;
    qboolean bold;

    if ((SCREEN_HEIGHT - ((cls.realtime - credits_start_time) / 40.0F)
         + credits_start_line * MENU_LINE_SIZE) < 0)
    {
        credits_start_line++;
        if (!credits[credits_start_line])
        {
            credits_start_line = 0;
            credits_start_time = cls.realtime;
        }
    }

    //
    // draw the credits
    //
    for (i = credits_start_line, y = SCREEN_HEIGHT - ((cls.realtime - credits_start_time) / 40.0F) + credits_start_line * MENU_LINE_SIZE;
         credits[i] && y < SCREEN_HEIGHT; y += MENU_LINE_SIZE, i++)
    {
        stringoffset = 0;
        bold         = false;

        if (y <= -MENU_FONT_SIZE)
        {
            continue;
        }
        if (y > SCREEN_HEIGHT)
        {
            continue;
        }

        if (credits[i][0] == '+')
        {
            bold         = true;
            stringoffset = 1;
        }
        else
        {
            bold         = false;
            stringoffset = 0;
        }

        if (y > SCREEN_HEIGHT * (7.0 / 8.0))
        {
            float y_test, h_test;
            y_test = y - SCREEN_HEIGHT * (7.0 / 8.0);
            h_test = SCREEN_HEIGHT / 8;

            alpha = 1 - (y_test / h_test);

            alpha = max(min(alpha, 1), 0);
        }
        else if (y < SCREEN_HEIGHT / 8)
        {
            float y_test, h_test;
            y_test = y;
            h_test = SCREEN_HEIGHT / 8;

            alpha = y_test / h_test;

            alpha = max(min(alpha, 1), 0);
        }
        else
        {
            alpha = 1;
        }

        len = strlen(credits[i]) - stringLengthExtra(credits[i]);

        x = (SCREEN_WIDTH - len * MENU_FONT_SIZE - stringoffset * MENU_FONT_SIZE) / 2
            + stringoffset * MENU_FONT_SIZE;
        Menu_DrawString(x, y, credits[i], alpha * 255);
    }
}
Example #10
0
void Menu_Draw ( menuframework_t *menu )
{
	char scratch[MAX_QPATH];
	static int yaw;
//	int maxframe = 29;
	entity_t entity;
	int i;
	menucommon_t *item;
	refdef_t refdef;

	// Draw rotating Quake II Symbol
	memset( &refdef, 0, sizeof( refdef ) );
	memset( &entity, 0, sizeof( entity ) );

	refdef.x = 0;
	refdef.y = 0;
	refdef.width = viddef.width;
	refdef.height = viddef.height;
	refdef.fov_x = 35;
	refdef.fov_y = CalcFov( refdef.fov_x, refdef.width, refdef.height );
	refdef.time = cls.realtime * 0.001;
	refdef.areabits = NULL;
	refdef.num_entities = 1;
	//refdef.lightstyles = 5;			// Gentle Pulse
	refdef.lightstyles = 63;			// Testing (FULLBRIGHT)
	refdef.rdflags = RDF_NOWORLDMODEL;
	refdef.blend[0] = 1.0;
	refdef.blend[1] = 1.0;
	refdef.blend[2] = 1.0;
	refdef.blend[3] = 0.0;
	refdef.dlights = NULL;
	refdef.num_dlights = 0;
	refdef.num_particles = 0;
	refdef.particles = NULL;
	VectorSet(refdef.viewangles, 1.0, 0.0, 0.0);
	VectorClear(refdef.vieworg);

	//if (!strcmp(vid_ref->string, "soft"))
	//	Com_sprintf( scratch, sizeof( scratch ), "models/items/quaddama/tris.md2");
	//else
		Com_sprintf( scratch, sizeof( scratch ), "models/MenuModel/quad.md2");

	entity.model = re.RegisterModel( scratch );
	//entity.Model_Type = 0;
	entity.flags = RF_MINLIGHT | RF_DEPTHHACK | RF_FULLBRIGHT | RF_GLOW | RF_NOSHADOW;
	entity.origin[0] = 80;
	entity.origin[1] = 0;
	entity.origin[2] = -18;	// -18 compensates for the float height of the model
	VectorCopy( entity.origin, entity.oldorigin );
	entity.frame = 0;
	entity.oldframe = 0;
	entity.backlerp = 0.0;
	entity.angles[1] = yaw++;
	if ( ++yaw > 360 )
		yaw -= 360;

	refdef.entities = &entity;

	// Fog the scene
	//refdef.blend[0] = 0.55;
	//refdef.blend[1] = 0.55;
	//refdef.blend[2] = 0.55;
	//refdef.blend[3] = 0.55;

	if (cl_3dmenubg->value)
	{
		// Draw scene
		MenuRefdefActive = 1;
		re.RenderFrame( &refdef );
		//Menu_DrawBackground("q2bg.tga");
	}

	// Draw the menu version information
	if (cl_menustamp->value > 0)
	{
		/*
		1 - Regular string
		2 - Regular string plus drop shadow (green... not effective)
		3 - All green string
		*/
		if (cl_menustamp->value == 1)
		{
			// Draw the text
			Menu_DrawString (viddef.width - (strlen(MENUSTAMP) * FONTSIZE) - (FONTSIZE * 3), viddef.height - FONTSIZE, MENUSTAMP);
		}
		else if (cl_menustamp->value == 2)
		{
			// Draw the drop shadow (we need black characters)
			DrawAltString (viddef.width - (strlen(MENUSTAMP) * FONTSIZE) - (FONTSIZE * 3) - 1, viddef.height - FONTSIZE, MENUSTAMP);

			// Draw the text
			Menu_DrawString (viddef.width - (strlen(MENUSTAMP) * FONTSIZE) - (FONTSIZE * 3), viddef.height - FONTSIZE - 1, MENUSTAMP);
		}
		else if (cl_menustamp->value == 3)
		{
			// Draw the text
			DrawAltString (viddef.width - (strlen(MENUSTAMP) * FONTSIZE) - (FONTSIZE * 3), viddef.height - FONTSIZE, MENUSTAMP);
		}
	}

	// Menu drawing prevention hack for main menu
	if ((menu->x == -1) && (menu->y == -1))
		return;

	/*
	** draw contents
	*/
	for ( i = 0; i < menu->nitems; i++ )
	{
		switch ( ( ( menucommon_t * ) menu->items[i] )->type )
		{
		case MTYPE_FIELD:
			Field_Draw( ( menufield_t * ) menu->items[i] );
			break;
		case MTYPE_SLIDER:
			Slider_Draw( ( menuslider_t * ) menu->items[i] );
			break;
		case MTYPE_LIST:
			MenuList_Draw( ( menulist_t * ) menu->items[i] );
			break;
		case MTYPE_SPINCONTROL:
			SpinControl_Draw( ( menulist_t * ) menu->items[i] );
			break;
		case MTYPE_ACTION:
			Action_Draw( ( menuaction_t * ) menu->items[i] );
			break;
		case MTYPE_SEPARATOR:
			Separator_Draw( ( menuseparator_t * ) menu->items[i] );
			break;
		}
	}

	item = Menu_ItemAtCursor( menu );

	if ( item && item->cursordraw )
	{
		item->cursordraw( item );
	}
	else if ( menu->cursordraw )
	{
		menu->cursordraw( menu );
	}
	else if ( item && item->type != MTYPE_FIELD )
	{
		if ( item->flags & QMF_LEFT_JUSTIFY )
		{
			Draw_Char( menu->x + item->x - 24 + item->cursor_offset, menu->y + item->y, 12 + ( ( int ) ( Sys_Milliseconds()/250 ) & 1 ) );
		}
		else
		{
			Draw_Char( menu->x + item->cursor_offset, menu->y + item->y, 12 + ( ( int ) ( Sys_Milliseconds()/250 ) & 1 ) );
		}
	}

	if ( item )
	{
		if ( item->statusbarfunc )
			item->statusbarfunc( ( void * ) item );
		else if ( item->statusbar )
			Menu_DrawStatusBar( item->statusbar );
		else
			Menu_DrawStatusBar( menu->statusbar );

	}
	else
	{
		Menu_DrawStatusBar( menu->statusbar );
	}
}