Code Monkey home page Code Monkey logo

ebitengine-input's Introduction

I worked on NoVerify static analyzer for PHP and KPHP compiler at vk.com. Before that, I was a part of Intel Go team: I added AVX-512 support and some compiler optimizations there, but most of the time I was tinkering the Go x86-64 assembler.

I try to maintain several[1] good[2] static[3] analyzers[4].
Sometimes I create dev tools like phpgrep (structural PHP code search using AST patterns).

Some facts about me:

  • I do not approve the ways of Russia government (wars, crazy mass propaganda, censorship, ...) ⬜️🟦⬜️
  • I enjoy 3D-printing and drawing
  • I love video games and game development
  • My tech talks and articles can be found at github.com/quasilyte/talks
  • Co-host of the GolangKazan Go community
  • You can call me Alex

ebitengine-input's People

Contributors

dkotik avatar harbdog avatar mcarpenter622 avatar phalasz avatar quasilyte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ebitengine-input's Issues

Is*JustReleased function for Actions?

It would be great to be able to have an ActionIsJustReleased function, just like ebitengine's inpututil package which provides IsKeyJustReleased, IsMouseButtonJustReleased, and IsGamepadButtonJustReleased.

ActionReleased for taps

How would a tap release event work?
Should it trigger the next frame after the tap action was registered and reported as just pressed?
Or should it be triggered during the same frame as JustPressed?

TODO: maybe look what Godot does in this situation.

Action Strength?

Hello, great work on this input add-on! Really appreciate the community making tools like this - I was wondering if I missed it or not, but is there an action strength system (so that you can, for example, tilt the stick on a gamepad to move at variable rates)?

Make it possible to simulate key release events

I'm going to implement #25, but without simulated events support.
So it will be possible to handle a key release event, but it will not be possible to Emit an event that would simulate it without an actual input.

I'm leaving this issue as a reminder. I'll reference it from the code.

ActionKeyNames called with AnyDevice mask is not returning for all devices

According to the doc using the AnyDevice mask from the ActionKeyNames function should return key names for all devices, but it is currently only returning keys for keyboard and mouse devices, but not gamepad. Adding the following to the Init code of the configfile example shows the problem:

        ...
	g.inputHandler = g.inputSystem.NewHandler(0, keymap)

	for a := range keymap {
		actionKey := actionString(a)
		fmt.Printf("%s: %v\n", actionKey, g.inputHandler.ActionKeyNames(a, input.AnyDevice))
	}

They keymap.json used in the example has some gamepad bindings, but they are not shown as expected of the AnyDevice mask

Restart: [ctrl+r]
Secret: [ctrl+shift+q]
Left: [left a]        
Right: [right d]      
Pause: [space]   

Request: Add a way to subscribe to an action

The library works well as is, but I personally have a preference to attach an event listener and have the library call my function when the action occurs rather than having to check it manually in the update loop. It essentially does the same thing but eliminates some boilerplate for the users of the library.

Mouse movement?

It might be a good idea to add the ability to use mouse movement on the X and Y axes as input sources as well to match joystick movement.

Fake/virtual input

Hey, it doesn't seem like there's any feature for faking or reproducing input programmatically. I know this was just released a few days ago, but it's looking so good that I had to ask! Are there any plans or desire for this?

If you consider this outside the scope of the project, please feel free to close the issue.

KeyPressDuration in EventInfo

Would be great to have key press duration made available in the EventInfo object.
Would make it easier to handle checks on how long a key was pressed for. Maybe only adding it in for PressedActionInfo

If there is interest I'm happy to draft a PR with some proposed changes for discussion.

Add mouse button press StartPos

When a mouse is being pressed, the cursor can still move.
So when the released event happens, the cursor location can be different.

It would be convenient to have a StartPos for mouse events.

Right now the StartPos is only set for the touch events.

Prefer the longest key combination for events

Let's imagine a situation where the user is pressing the ctrl+left mouse button.

The keymap may have these actions:

  • ctrl+lmb = ping (ActionPing)
  • lmb = move to the spot (ActionMove)

If we check for ActionMove while pressing ctrl+lmb, it would still match, as lmb is indeed being pressed. This could lead to a double action activation (ActionMove and ActionPing). This might not be the expected behavior.

We could try to resolve these conflicts in favor of the longest match, which would be ActionPing in this case.
This resolution is not implemented yet.

Or we can just document this behavior and make it a user's problem to solve.

This conflict resolution, even if implemented in the future, should be optional.
It should be configured via the SystemConfig upon system creation (default=false).
This would prevent the backward-incompatible behavior as well as give the user some freedom in the way they want the input events to be handled.

Add tests for the virtual input

This is the easiest part of the library to test.

But also, it's a part that may be optimized later: right now it works under an assumption that simulated events are both rare (not happen often) and not numerous. If some game will spam simulated events inside a single frame, we'll end up with big slices. Big slices are an issue for our linear search algorithm.

Maybe we need to do a sorting inside System.Update() method of all current events and do a binary search. For the small number of events, like <10 it won't make much of a difference, but for the 1000+ events it will work much better. But maybe there is even a better solution.

Having tests and benchmarks would make optimizations/refactoring easier there.

Is it possible to catch a "click&pull" and "touch&swipe" event?

I need the user to be able to click on an object and pull it into some direction. When the user releases the mouse button, the object would move into the desired direction. And I need the same behavior with a touch pad (mobile).

Is this possible with this module somehow?

Thanks in advance,
Tom

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.