wInput v1.1.1

wInput is a simple but also powerful input management library for GameMaker that allows you to create actions and assign them different inputs with ease. It also includes a bunch of other helpful extra features, like detecting double and long presses, and input recording/playback.

API Reference

This library is only tested on the Windows, HTML5, and GXC targets, but it should work on other platforms as well. It also comes with an example project that will show you the basics.

Since I made this library primarily for my own personal projects, I will keep updating it on a regular basis.

This library is made by Mors (Website | Patreon).

Features

  • Support for keyboard, controller, and mouse input.
  • Support for multiple players.
  • Easy input remapping.
  • Detecting double and long presses.
  • Detecting the hold time and the last pressed action.
  • Mapping analog sticks as digital inputs.
  • Getting the input name as a string.
  • Input recording and playback.

...and more!

Basic Usage

enum key {
    left,
    right,
    up,
    down,
    jump,
}
input_system_init(1);
input_action_add(0, key.left, vk_left, gp_stickll);
input_action_add(0, key.right, vk_right, gp_sticklr);
input_action_add(0, key.up, vk_up, gp_sticklu);
input_action_add(0, key.down, vk_down, gp_stickld);
input_action_add(0, key.jump, ord("Z"), gp_face1);
if (input_check(key.left)) {
    x -= 2;
}
if (input_check(key.right)) {
    x += 2;
}
if (input_check(key.up)) {
    y -= 2;
}
if (input_check(key.down)) {
    y += 2;
}

To learn more about how to use this library, check out the API Reference.

Patreon

If you're supporting me on Patreon for the $5 tier or higher you will get this library for free. Head to my Patreon page to learn how to get your copy.

License

This product is licensed under the following terms:

  • You are allowed to use and modify this product for both personal or commercial purposes.
  • You are not allowed to redistribute this product or any parts of it in any shape or form if the source code is easily accessible.
  • cannot be held liable for any claim, damages, or other liabilities that may arise from, out of, or in connection with the product or the use or other dealings in the product.
  • I do not offer any warranty for this product, and therefore cannot guarantee any kind of official support. That being said, if you end up having any questions I will still try to answer them.
  • You're not required to give me any credit, you paid for the product after all. That being said, it would still be nice. :)

Changelog

You can view the full changelog on GitHub.


If you have any questions, you can ask them in the comments section down below, or create an issue in this library's GitHub repository.

StatusReleased
CategoryAssets
Rating
Rated 5.0 out of 5 stars
(1 total ratings)
AuthorMors
Made withGameMaker
Average sessionA few seconds
LanguagesEnglish
InputsKeyboard, Mouse, Gamepad (any)

Purchase

Buy Now$2.00 USD or more

In order to download this library you must purchase it at or above the minimum price of $2 USD. You will get access to the following files:

wInput.yyz 104 kB

Development log

Comments

Log in with itch.io to leave a comment.

Doesn't look like Issues are enabled on the github repo.  I saw these in the web demo but thought maybe it was just a browser thing:

Recording inputs doesn't seem to work.  I record a couple jumps with a mouse click and then try to playback and nothing happens.  I've also tried recording moving back and forth, same result.

If you press P again after starting playback, you get a crash. (black screen in browser).

Deleted 2 years ago

You record the inputs of each player individually, and in the example, you can only record the inputs of the first player. I guess I didn't make that clear enough.

The crash seems to be something I overlooked, sorry about that!

I'm noticing now that the white ball in my browser quickly walks itself off the screen when I load this page and my normal controller controls player 2 in the browser even though it properly controls player 1 in GMS2.

I did test this in GMS2 before but wasd is mapped to the second player too, along with the mouse click jump so I assumed that was the first player and the white ball was something else.  I also see now that the color of the text corresponds to the ball and only the white text has the record info. Got it!  Thanks for the info.

Also, may I suggest publishing a package with just scr_winput and an example obj_input_controller that can be imported into existing projects?  I just created one for myself but it would probably be useful for others and for updates.

Yeah, I guess should have done that from the beginning for all my libraries lol