diff options
Diffstat (limited to 'src/frontend/mame/ui/selmenu.h')
-rw-r--r-- | src/frontend/mame/ui/selmenu.h | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/src/frontend/mame/ui/selmenu.h b/src/frontend/mame/ui/selmenu.h index 2dec44ac96c..5e85cb0ce96 100644 --- a/src/frontend/mame/ui/selmenu.h +++ b/src/frontend/mame/ui/selmenu.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods +// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods, Vas Crabb /*************************************************************************** ui/selmenu.h @@ -7,7 +7,6 @@ MAME system/software selection menu. ***************************************************************************/ - #ifndef MAME_FRONTEND_UI_SELMENU_H #define MAME_FRONTEND_UI_SELMENU_H @@ -35,6 +34,7 @@ public: protected: static constexpr std::size_t MAX_ICONS_RENDER = 128; + static constexpr std::size_t MAX_VISIBLE_SEARCH = 200; // tab navigation enum class focused_menu @@ -45,6 +45,20 @@ protected: RIGHTBOTTOM }; + struct texture_and_bitmap + { + template <typename T> + texture_and_bitmap(T &&tex) : texture(std::forward<T>(tex)) { } + texture_and_bitmap(texture_and_bitmap &&that) = default; + texture_and_bitmap &operator=(texture_and_bitmap &&that) = default; + + texture_ptr texture; + bitmap_argb32 bitmap; + }; + + template <typename Key, typename Compare = std::less<Key> > + using texture_lru = util::lru_cache_map<Key, texture_and_bitmap, Compare>; + class system_flags { public: @@ -117,11 +131,6 @@ protected: void draw_common_arrow(float origx1, float origy1, float origx2, float origy2, int current, int dmin, int dmax, float title); void draw_info_arrow(int ub, float origx1, float origx2, float oy1, float line_height, float text_size, float ud_arrow_width); - // forcing refresh - bool redraw_icon() const { return m_redraw_icon; } - void set_redraw_icon() { m_redraw_icon = true; } - void set_switch_image() { m_switch_image = true; } - bool draw_error_text(); template <typename Filter> @@ -130,6 +139,14 @@ protected: std::map<typename Filter::type, typename Filter::ptr> const &filters, float x1, float y1, float x2, float y2); + // icon helpers + void check_for_icons(char const *listname); + std::string make_icon_paths(char const *listname) const; + bool scale_icon(bitmap_argb32 &&src, texture_and_bitmap &dst) const; + + // forcing refresh + void set_switch_image() { m_switch_image = true; } + template <typename T> bool select_bios(T const &driver, bool inlist); bool select_part(software_info const &info, ui_software_info const &ui_info); @@ -235,7 +252,8 @@ private: void draw_toolbar(float x1, float y1, float x2, float y2); void draw_star(float x0, float y0); - virtual float draw_icon(int linenum, void *selectedref, float x1, float y1); + void draw_icon(int linenum, void *selectedref, float x1, float y1); + virtual render_texture *get_icon_texture(int linenum, void *selectedref) = 0; void get_title_search(std::string &title, std::string &search); @@ -294,7 +312,7 @@ private: int m_right_visible_lines; // right box lines - bool m_redraw_icon; + bool m_has_icons; bool m_switch_image; bool m_default_image; uint8_t m_image_view; |