Simulant  21.12-194
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
image.h
1 #pragma once
2 
3 #include "widget.h"
4 
5 namespace smlt {
6 namespace ui {
7 
8 
9 /* An Image widget, useful for health indicators etc.
10  *
11  * All images have their resize mode set to fixed width and do not
12  * allow text.
13  */
14 class Image:
15  public Widget {
16 
17  void clear_layers();
18 
19 public:
20  using Widget::init; // Pull in init to satisfy Managed<Image>
21  using Widget::clean_up;
22 
23  Image(UIManager* owner, UIConfig* config);
24  virtual ~Image() {}
25 
26  /* Set the texture of the Image. By default the image will be sized to the
27  * full size of the texture, all set_source_rect to use a subsection of the texture */
28  void set_texture(const TexturePtr& texture_id);
29 
30  /* Selects the source region of the texture to display in the image */
31  void set_source_rect(const UICoord& bottom_left, const UICoord& size);
32 
33  bool set_resize_mode(ResizeMode resize_mode) override;
34 };
35 
36 }
37 }
smlt::ui::UIManager
Definition: ui_manager.h:54
smlt::ui::UICoord
Definition: ui_config.h:106
smlt::ui::Image
Definition: image.h:15
smlt
Definition: animation.cpp:25
smlt::ui::Widget
Definition: widget.h:84
smlt::ui::UIConfig
Definition: ui_config.h:172