Code Monkey home page Code Monkey logo

Comments (3)

larsiusprime avatar larsiusprime commented on August 18, 2024

Yeah, this would be great. In the original Defender's Quest, you could navigate the entire screen using the keyboard, via both Tabs to jump from button to button, as well as a "virtual mouse" that let you move with the arrow keys and click with enter (or any custom settings you wanted).

So this sort of framework should definitely be added.

from flixel-ui.

larsiusprime avatar larsiusprime commented on August 18, 2024

I need to understand how input works in general for Flixel, so this isn't final, but here's what I'm thinking so far:

flixel.addons.ui.FlxInputManager

FlxInputManager accepts a settings file from the user, and creates bindings for various input events.

Input events:

  • Virtual Mouse Click (a button press or anything else that counts as a mouse click)
  • Virtual Mouse Movement (keypress or anything that should move the mouse cursor)
  • Tab jump forward (keypress or anything, tab by default, that jumps mouse cursor to next clickable thing)
  • Tab jump backward (same as above, but opposite direction)
  • User defined hotkeys (broadcasts generic signals to active FlxUI objects)

FlxUI will automatically package together all clickable elements on the screen into an array, perhaps "tab_list." By default it will add items from top left to bottom right, as well as adding individual elements by group and/or hierarchy (so all the elements of a radio button group come one after another).

When FlxUI receives the "tab jump forward/backward" signal it will move the mouse cursor to the "center" of the next/previous object in tab_list.

(Is it possible to force the mouse to move to an arbitrary position?)

FlxInputManager will have some other things to do:

--If "virtual mouse" is enabled, listen for virtual mouse movement, and if present, move the mouse cursor.
--(Do same for clicking, and find way to emulate a true mouse click at a low level).

I'll start by making this work with keyboard commands, and then we can expand to make it work for gamepads. If we're truly ambitious, the framework could support things like mouse/touch gestures, but let's not get crazy just yet.

from flixel-ui.

larsiusprime avatar larsiusprime commented on August 18, 2024

I have basically done almost everything you mentioned here with FlxUICursor. It could be improved/extended upon, but I think we should open new issues for specific wish-list stuff, the main thrust of this is now done.

See this demo:
https://github.com/HaxeFlixel/flixel-demos/tree/dev/User%20Interface/Cursor

from flixel-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.