MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / DrawImageButtons

Function DrawImageButtons

src/widget.cpp:362–369  ·  view source on GitHub ↗

* Draw an image button. * @param r Rectangle of the button. * @param type Widget type (#WWT_IMGBTN or #WWT_IMGBTN_2). * @param colour Colour of the button. * @param clicked Button is clicked. * @param img Sprite to draw. * @param align Alignment of the sprite. */

Source from the content-addressed store, hash-verified

360 * @param align Alignment of the sprite.
361 */
362static inline void DrawImageButtons(const Rect &r, WidgetType type, Colours colour, bool clicked, SpriteID img, StringAlignment align)
363{
364 assert(img != 0);
365 DrawFrameRect(r, colour, clicked ? FrameFlag::Lowered : FrameFlags{});
366
367 if ((type & WWT_MASK) == WWT_IMGBTN_2 && clicked) img++; // Show different image when clicked for #WWT_IMGBTN_2.
368 DrawSpriteIgnorePadding(img, PAL_NONE, r, align);
369}
370
371/**
372 * Draw a button with image and rext.

Callers 8

DrawVerticalScrollbarFunction · 0.85
DrawHorizontalScrollbarFunction · 0.85
DrawShadeBoxFunction · 0.85
DrawStickyBoxFunction · 0.85
DrawDefSizeBoxFunction · 0.85
DrawDebugBoxFunction · 0.85
DrawButtonDropdownFunction · 0.85
DrawMethod · 0.85

Calls 2

DrawSpriteIgnorePaddingFunction · 0.85
DrawFrameRectFunction · 0.70

Tested by

no test coverage detected