Example #1
0
        keycode_map m_keycode_map = new keycode_map();     // keycode map


        // construction/destruction
        //-------------------------------------------------
        //  natural_keyboard - constructor
        //-------------------------------------------------
        public natural_keyboard(running_machine machine)
        {
            m_machine         = machine;
            m_in_use          = false;
            m_bufbegin        = 0;
            m_bufend          = 0;
            m_fieldnum        = 0;
            m_status_keydown  = false;
            m_last_cr         = false;
            m_timer           = null;
            m_current_rate    = attotime.zero;
            m_queue_chars     = null;
            m_accept_char     = null;
            m_charqueue_empty = null;


            // try building a list of keycodes; if none are available, don't bother
            build_codes(machine.ioport());
            if (!m_keycode_map.empty())
            {
                m_buffer.resize(KEY_BUFFER_SIZE);
                m_timer = machine.scheduler().timer_alloc(timer);
            }

            // retrieve option setting
            set_in_use(machine.options().natural_keyboard());
        }
Example #2
0
        /*-------------------------------------------------
        *   frame_update - looks through pressed
        *   input as per events pushed our way and posts
        *   corresponding IPT_UI_* events
        *  -------------------------------------------------*/
        void frame_update(running_machine machine)
        {
            /* update the state of all the UI keys */
            for (ioport_type code = (ioport_type)(ioport_type.IPT_UI_FIRST + 1); code < ioport_type.IPT_UI_LAST; ++code)
            {
                bool pressed = machine.ioport().type_pressed(code);
                if (!pressed || m_seqpressed[(int)code] != SEQ_PRESSED_RESET)
                {
                    m_seqpressed[(int)code] = pressed ? (byte)1 : (byte)0;
                }
            }

            // perform mouse hit testing
            ioport_field mouse_field = m_current_mouse_down ? find_mouse_field() : null;

            if (m_current_mouse_field != mouse_field)
            {
                // clear the old field if there was one
                if (m_current_mouse_field != null)
                {
                    m_current_mouse_field.set_value(0);
                }

                // set the new field if it exists and isn't already being pressed
                if (mouse_field != null && !mouse_field.digital_value())
                {
                    mouse_field.set_value(1);
                }

                // update internal state
                m_current_mouse_field = mouse_field;
            }
        }
Example #3
0
        u16 m_auto_time;                                                     // time in seconds to turn invisible


        // construction/destruction
        //-------------------------------------------------
        //  crosshair_manager - constructor
        //-------------------------------------------------
        public 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_notification.MACHINE_NOTIFY_EXIT, exit);

            for (int player = 0; player < MAX_PLAYERS; player++)
            {
                m_crosshair[player] = new render_crosshair(machine, player);
            }

            /* determine who needs crosshairs */
            foreach (var port in machine.ioport().ports())
            {
                foreach (ioport_field field in port.Value.fields())
                {
                    if (field.crosshair_axis() != crosshair_axis_t.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_load, config_save);
            }

            /* register the animation callback */
            screen_device first_screen = new screen_device_enumerator(machine.root_device()).first();

            if (first_screen != null)
            {
                first_screen.register_vblank_callback(animate);
            }
        }