Пример #1
0
void gui_draw()
{
	widget_list_item_t* current=gamemenu_top;
	char text[100];
	while (current)
	{
		switch (current->widget->type)
		{
		case SLIDER:
			if (active_item==current)
			{
				sprintf(text, LEFT_ARROW " %s " RIGHT_ARROW, current->widget->text);
			}
			else
			{
				sprintf(text, "%s", current->widget->text);
			}
			break;
		default:
			sprintf(text, "%s", current->widget->text);
			break;
		}
		GameMenu_draw_text(text, active_item==current, current->widget->layout_info, current->widget->font_binding);
		
		current=current->next;
	}


}
Пример #2
0
/*! 
 Scrolls the credits text up the screen.
 \author  jfpatry
 \date    Created:  2000-09-27
 \date    Modified: 2000-09-27
 */
static void draw_credits_text( scalar_t time_step )
{
    int w = getparam_x_resolution();
    int h = getparam_y_resolution();
    font_t* font;
    coord_t text_coord;
    int i, string_w, asc, desc;
    scalar_t y;
    
    y_offset += time_step * winsys_scale(CREDITS_SPEED + time_step*joystick_y*CREDITS_JOYSTICK_SPEED);
	if (y_offset<0)
	{
		y_offset=0;
	}
    y = CREDITS_MIN_Y+y_offset;
    
    text_coord.x=w/2;
    text_coord.y=y;
    text_coord.x_coord_type=ABSOLUTE_COORD;
    text_coord.y_coord_type=ABSOLUTE_COORD;
    text_coord.x_just=text_coord.y_just=CENTER_JUST;
    
    for (i=0; i<sizeof( credit_lines ) / sizeof( credit_lines[0] ); i++) {
        credit_line_t line = credit_lines[i];
        
        if ( !get_font_binding( line.binding, &font ) ) {
            print_warning( IMPORTANT_WARNING,
                          "Couldn't get font for binding %s",
                          line.binding );
        } else {
            get_font_metrics( font, line.text, &string_w, &asc, &desc );
            
            text_coord.y -= asc+desc;

            GameMenu_draw_text( line.text, 0, text_coord, line.binding );
        }
    }
    
    if ( text_coord.y > h+CREDITS_MAX_Y ) {
        go_back();
    }
}