本文整理汇总了C++中running_machine::ioport方法的典型用法代码示例。如果您正苦于以下问题:C++ running_machine::ioport方法的具体用法?C++ running_machine::ioport怎么用?C++ running_machine::ioport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类running_machine
的用法示例。
在下文中一共展示了running_machine::ioport方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
machine_info::machine_info(running_machine &machine)
: m_machine(machine)
{
// calculate "has..." values
m_has_configs = false;
m_has_analog = false;
m_has_dips = false;
m_has_bioses = false;
// scan the input port array to see what options we need to enable
for (auto &port : machine.ioport().ports())
for (ioport_field &field : port.second->fields())
{
if (field.type() == IPT_DIPSWITCH)
m_has_dips = true;
if (field.type() == IPT_CONFIG)
m_has_configs = true;
if (field.is_analog())
m_has_analog = true;
}
for (device_t &device : device_iterator(machine.root_device()))
for (const rom_entry &rom : device.rom_region_vector())
if (ROMENTRY_ISSYSTEM_BIOS(&rom)) { m_has_bioses = true; break; }
}
示例2: ui_input_frame_update
void ui_input_frame_update(running_machine &machine)
{
ui_input_private *uidata = machine.ui_input_data;
/* update the state of all the UI keys */
for (ioport_type code = ioport_type(IPT_UI_FIRST + 1); code < IPT_UI_LAST; ++code)
{
bool pressed = machine.ioport().type_pressed(code);
if (!pressed || uidata->seqpressed[code] != SEQ_PRESSED_RESET)
uidata->seqpressed[code] = pressed;
}
}
示例3: crosshair_init
void crosshair_init(running_machine &machine)
{
/* request a callback upon exiting */
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(crosshair_exit), &machine));
/* clear all the globals */
memset(&global, 0, sizeof(global));
/* setup the default auto visibility time */
global.auto_time = CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT;
/* determine who needs crosshairs */
for (ioport_port *port = machine.ioport().first_port(); port != NULL; port = port->next())
for (ioport_field *field = port->first_field(); field != NULL; field = field->next())
if (field->crosshair_axis() != CROSSHAIR_AXIS_NONE)
{
int player = field->player();
assert(player < MAX_PLAYERS);
/* mark as used and set the default visibility and mode */
global.usage = TRUE;
global.used[player] = TRUE;
global.mode[player] = CROSSHAIR_VISIBILITY_DEFAULT;
global.visible[player] = (CROSSHAIR_VISIBILITY_DEFAULT == CROSSHAIR_VISIBILITY_OFF) ? FALSE : TRUE;
/* for now, use the main screen */
global.screen[player] = machine.primary_screen;
create_bitmap(machine, player);
}
/* register callbacks for when we load/save configurations */
if (global.usage)
config_register(machine, "crosshairs", config_saveload_delegate(FUNC(crosshair_load), &machine), config_saveload_delegate(FUNC(crosshair_save), &machine));
/* register the animation callback */
if (machine.primary_screen != NULL)
machine.primary_screen->register_vblank_callback(vblank_state_delegate(FUNC(animate), &machine));
}
示例4:
crosshair_manager::crosshair_manager(running_machine &machine)
: m_machine(machine)
{
/* request a callback upon exiting */
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(crosshair_manager::exit), this));
/* setup the default auto visibility time */
m_auto_time = CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT;
/* determine who needs crosshairs */
for (auto &port : machine.ioport().ports())
for (ioport_field &field : port.second->fields())
if (field.crosshair_axis() != CROSSHAIR_AXIS_NONE)
{
int player = field.player();
assert(player < MAX_PLAYERS);
/* mark as used and set the default visibility and mode */
m_usage = TRUE;
m_used[player] = TRUE;
m_mode[player] = CROSSHAIR_VISIBILITY_DEFAULT;
m_visible[player] = (CROSSHAIR_VISIBILITY_DEFAULT == CROSSHAIR_VISIBILITY_OFF) ? FALSE : TRUE;
/* for now, use the main screen */
m_screen[player] = machine.first_screen();
create_bitmap(player);
}
/* register callbacks for when we load/save configurations */
if (m_usage)
machine.configuration().config_register("crosshairs", config_saveload_delegate(FUNC(crosshair_manager::config_load), this), config_saveload_delegate(FUNC(crosshair_manager::config_save), this));
/* register the animation callback */
if (machine.first_screen() != nullptr)
machine.first_screen()->register_vblank_callback(vblank_state_delegate(FUNC(crosshair_manager::animate), this));
}
示例5:
crosshair_manager::crosshair_manager(running_machine &machine)
: m_machine(machine)
, m_usage(false)
, m_animation_counter(0)
, m_auto_time(CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT)
{
/* request a callback upon exiting */
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&crosshair_manager::exit, this));
for (int player = 0; player < MAX_PLAYERS; player++)
m_crosshair[player] = std::make_unique<render_crosshair>(machine, player);
/* determine who needs crosshairs */
for (auto &port : machine.ioport().ports())
for (ioport_field &field : port.second->fields())
if (field.crosshair_axis() != CROSSHAIR_AXIS_NONE)
{
int player = field.player();
assert(player < MAX_PLAYERS);
/* mark as used and set the default visibility and mode */
m_usage = true;
m_crosshair[player]->set_used(true);
m_crosshair[player]->set_mode(CROSSHAIR_VISIBILITY_DEFAULT);
m_crosshair[player]->set_visible(CROSSHAIR_VISIBILITY_DEFAULT != CROSSHAIR_VISIBILITY_OFF);
m_crosshair[player]->set_default_bitmap();
}
/* register callbacks for when we load/save configurations */
if (m_usage)
machine.configuration().config_register("crosshairs", config_saveload_delegate(&crosshair_manager::config_load, this), config_saveload_delegate(&crosshair_manager::config_save, this));
/* register the animation callback */
if (machine.first_screen() != nullptr)
machine.first_screen()->register_vblank_callback(vblank_state_delegate(&crosshair_manager::animate, this));
}