Exemple #1
0
/**
 * 
 *  rct2: 0x006EB2A8
 */
void widget_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
{
	switch (w->widgets[widgetIndex].type) {
	case WWT_FRAME:
		widget_frame_draw(dpi, w, widgetIndex);
		break;
	case WWT_RESIZE:
		widget_resize_draw(dpi, w, widgetIndex);
		break;
	case WWT_IMGBTN:
	case WWT_4:
		widget_button_draw(dpi, w, widgetIndex);
		break;
	case WWT_5:
	case WWT_COLORBTN:
	case WWT_TRNBTN:
	case WWT_TAB:
		widget_tab_draw(dpi, w, widgetIndex);
		break;
	case WWT_FLATBTN:
		widget_flat_button_draw(dpi, w, widgetIndex);
		break;
	case WWT_DROPDOWN_BUTTON:
	case WWT_11:
	case WWT_13:
		widget_text_button(dpi, w, widgetIndex);
		break;
	case WWT_12:
		widget_text_unknown(dpi, w, widgetIndex);
		break;
	case WWT_14:
		widget_text(dpi, w, widgetIndex);
		break;
	case WWT_SPINNER:
	case WWT_DROPDOWN:
	case WWT_VIEWPORT:
		widget_text_inset(dpi, w, widgetIndex);
		break;
	case WWT_18:
		break;
	case WWT_GROUPBOX:
		widget_groupbox_draw(dpi, w, widgetIndex);
		break;
	case WWT_CAPTION:
		widget_caption_draw(dpi, w, widgetIndex);
		break;
	case WWT_CLOSEBOX:
		widget_closebox_draw(dpi, w, widgetIndex);
		break;
	case WWT_SCROLL:
		widget_scroll_draw(dpi, w, widgetIndex);
		break;
	case WWT_CHECKBOX:
	case WWT_24:
		widget_checkbox_draw(dpi, w, widgetIndex);
		break;
	case WWT_25:
		break;
	}
}
Exemple #2
0
/**
 *
 *  rct2: 0x006EB861
 */
static void widget_flat_button_draw(rct_drawpixelinfo *dpi, rct_window *w, rct_widgetindex widgetIndex)
{
    if (!widget_is_disabled(w, widgetIndex) && widget_is_highlighted(w, widgetIndex)) {
        widget_button_draw(dpi, w, widgetIndex);
        return;
    }

    // Get the widget
    rct_widget *widget = &w->widgets[widgetIndex];

    // Resolve the absolute ltrb
    sint32 l = w->x + widget->left;
    sint32 t = w->y + widget->top;
    sint32 r = w->x + widget->right;
    sint32 b = w->y + widget->bottom;

    // Get the colour
    uint8 colour = w->colours[widget->colour];

    // Check if the button is pressed down
    if (widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex)) {
        if (widget->image == -2) {
            // Draw border with no fill
            gfx_fill_rect_inset(dpi, l, t, r, b, colour, INSET_RECT_FLAG_BORDER_INSET | INSET_RECT_FLAG_FILL_NONE);
            return;
        }

        // Draw the border with fill
        gfx_fill_rect_inset(dpi, l, t, r, b, colour, INSET_RECT_FLAG_BORDER_INSET);
    }

    // Draw image
    widget_draw_image(dpi, w, widgetIndex);
}
Exemple #3
0
/**
 * 
 *  rct2: 0x006EB861
 */
static void widget_flat_button_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
{
	rct_widget* widget;
	int l, t, r, b, press;
	uint32 image;
	uint8 colour;

	if (!widget_is_disabled(w, widgetIndex) && widget_is_highlighted(w, widgetIndex)) {
		widget_button_draw(dpi, w, widgetIndex);
		return;
	}

	// Get the widget
	widget = &w->widgets[widgetIndex];

	// Resolve the absolute ltrb
	l = w->x + widget->left;
	t = w->y + widget->top;
	r = w->x + widget->right;
	b = w->y + widget->bottom;

	// Get the colour
	colour = w->colours[widget->colour];

	// Check if the button is pressed down
	if (widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex)) {
		if (widget->image == -2) {
			// Draw border with no fill
			gfx_fill_rect_inset(dpi, l, t, r, b, colour, 0x20 | 0x10);
			return;
		}

		// Draw the border with fill
		gfx_fill_rect_inset(dpi, l, t, r, b, colour, 0x20);
	}

	// Draw image
	widget_draw_image(dpi, w, widgetIndex);
}