コード例 #1
0
ファイル: uiinput.cpp プロジェクト: Robbbert/store1
void ui_input_manager::frame_update()
{
	/* 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 || m_seqpressed[code] != SEQ_PRESSED_RESET)
			m_seqpressed[code] = pressed;
	}

	// perform mouse hit testing
	ioport_field *mouse_field = m_current_mouse_down ? find_mouse_field() : nullptr;
	if (m_current_mouse_field != mouse_field)
	{
		// clear the old field if there was one
		if (m_current_mouse_field != nullptr)
			m_current_mouse_field->set_value(0);

		// set the new field if it exists and isn't already being pressed
		if (mouse_field != nullptr && !mouse_field->digital_value())
			mouse_field->set_value(1);

		// update internal state
		m_current_mouse_field = mouse_field;
	}
}
コード例 #2
0
ファイル: uiinput.cpp プロジェクト: dlabi/mame
void ui_input_manager::frame_update()
{
	/* 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 || m_seqpressed[code] != SEQ_PRESSED_RESET)
			m_seqpressed[code] = pressed;
	}
}
コード例 #3
0
ファイル: uiinput.cpp プロジェクト: toughkidcst/mame
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;
    }
}
コード例 #4
0
ファイル: uiinput.cpp プロジェクト: Robbbert/store1
bool ui_input_manager::pressed_repeat(int code, int speed)
{
	bool pressed;

g_profiler.start(PROFILER_INPUT);

	/* get the status of this key (assumed to be only in the defaults) */
	assert(code >= IPT_UI_CONFIGURE && code <= IPT_OSD_16);
	pressed = (m_seqpressed[code] == SEQ_PRESSED_TRUE);

	/* if down, handle it specially */
	if (pressed)
	{
		osd_ticks_t tps = osd_ticks_per_second();

		/* if this is the first press, set a 3x delay and leave pressed = 1 */
		if (m_next_repeat[code] == 0)
			m_next_repeat[code] = osd_ticks() + 3 * speed * tps / 60;

		/* if this is an autorepeat case, set a 1x delay and leave pressed = 1 */
		else if (speed > 0 && (osd_ticks() + tps - m_next_repeat[code]) >= tps)
		{
			// In the autorepeatcase, we need to double check the key is still pressed
			// as there can be a delay between the key polling and our processing of the event
			m_seqpressed[code] = machine().ioport().type_pressed(ioport_type(code));
			pressed = (m_seqpressed[code] == SEQ_PRESSED_TRUE);
			if (pressed)
				m_next_repeat[code] += 1 * speed * tps / 60;
		}

		/* otherwise, reset pressed = 0 */
		else
			pressed = false;
	}

	/* if we're not pressed, reset the memory field */
	else
		m_next_repeat[code] = 0;

g_profiler.stop();

	return pressed;
}