mame/src/frontend/mame/ui/simpleselgame.h
Vas Crabb d4589e0b29 Input refactoring:
osd/modules/input, emu/inpttype.cpp: Made most default joystick
assignments supplied by input modules.  Input modules take available
controls into consideration when generating default assignments.

emu/inpttype.ipp: Added a separate "Back" UI input separate from Cancel.
You may want an easier to hit combination for moving to the previous
menu than for exiting or cancelling input.  They both default to Escape.

emu/inpttype.ipp: Added a UI Help control.  Currently only used by
analog inputs menu

emu/inpttype.h: Moved I/O port field type enum to its own header and
sorted UI controls so they appear in a more logical order.

ui: Don't use UI Select to restore defaults - people should be getting
used to the UI Clear input by now.  UI Select cycles multi-value items
instead.

ui/inputmap.cpp: Don't use immediate cancel to cycle between clearing
and restoring default assignment (use UI Clear instead).

osd: Reduced the number of files needing to include the dreaded emu.h.
Got some implementation out of headers.
2023-02-18 06:18:45 +11:00

68 lines
1.9 KiB
C++

// license:BSD-3-Clause
// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods
/***************************************************************************
ui/selgame.h
Game selector
***************************************************************************/
#ifndef MAME_FRONTEND_UI_SIMPLESELGAME_H
#define MAME_FRONTEND_UI_SIMPLESELGAME_H
#pragma once
#include "menu.h"
class driver_enumerator;
namespace ui {
class simple_menu_select_game : public menu
{
public:
simple_menu_select_game(mame_ui_manager &mui, render_container &container, const char *gamename);
virtual ~simple_menu_select_game();
// force game select menu
static void force_game_select(mame_ui_manager &mui, render_container &container);
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual bool custom_ui_back() override { return !m_search.empty(); }
private:
enum { VISIBLE_GAMES_IN_LIST = 15 };
virtual void populate() override;
virtual void handle(event const *ev) override;
// internal methods
void build_driver_list();
void inkey_select(const event &menu_event);
void inkey_cancel();
void inkey_special(const event &menu_event);
// internal state
bool m_nomatch;
bool m_error;
bool m_rerandomize;
std::string m_search;
int m_matchlist[VISIBLE_GAMES_IN_LIST];
std::vector<const game_driver *> m_driverlist;
std::unique_ptr<driver_enumerator> m_drivlist;
// cached driver flags
const game_driver * m_cached_driver;
machine_flags::type m_cached_flags;
device_t::feature_type m_cached_unemulated;
device_t::feature_type m_cached_imperfect;
rgb_t m_cached_color;
};
} // namespace ui
#endif // MAME_FRONTEND_UI_SIMPLESELGAME_H