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

Discord Server

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 input.
  • 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;
}

Details

This library comes with 43 methods. The descriptions for each one of these functions are included within the script file.

  • input_check(action_index, player[OPTIONAL])
  • input_check_pressed(action_index, player[OPTIONAL])
  • keyboard_check_released(action_index, player[OPTIONAL])
  • input_check_double(action_index, player[OPTIONAL])
  • input_check_double_pressed(action_index, player[OPTIONAL])
  • input_check_double_released(action_index, player[OPTIONAL])
  • input_check_long(action_index, player[OPTIONAL])
  • input_check_analogue(action_index, player[OPTIONAL])
  • input_check_hold_time(action_index, player[OPTIONAL])
  • input_get_last_pressed(player[OPTIONAL])
  • input_get_type()
  • input_action_add(player_index, action_index, keyboard_key[OPTIONAL], gamepad_button[OPTIONAL], mouse_button[OPTIONAL])
  • input_action_remap(player_index, action_index, keyboard_key[OPTIONAL], gamepad_button[OPTIONAL], mouse_button[OPTIONAL])
  • input_action_link(from, to)
  • input_action_get_keyboard_key(action_index, player[OPTIONAL])
  • input_action_get_gamepad_button(action_index, player[OPTIONAL])
  • input_action_get_mouse_button(action_index, player[OPTIONAL])
  • input_system_init(player_count)
  • input_system_start()
  • input_system_update()
  • input_system_destroy()
  • input_system_async()
  • input_system_set_player_count(player_count)
  • input_system_set_analog_threshold(analog_threshold)
  • input_system_set_axis_deadzone(axis_deadzone)
  • input_system_set_double_press_delay(double_press_delay)
  • input_system_set_long_press_threshold(long_press_threshold)
  • input_system_set_tick_speed(tick_speed)
  • input_system_get_player_count()
  • input_system_get_analog_threshold()
  • input_system_get_axis_deadzone()
  • input_system_get_double_press_delay()
  • input_system_get_long_press_threshold()
  • input_system_get_tick_speed()
  • input_action_get_name(action_index, brackets[OPTIONAL], player[OPTIONAL])
  • keyboard_get_key_name(key_index)
  • gamepad_get_button_name(button_index)
  • mouse_get_button_name(button_index)
  • input_recording_start(player[OPTIONAL])
  • input_recording_stop(player[OPTIONAL])
  • input_recording_play(recording, callback[OPTIONAL], player[OPTIONAL])
  • input_is_recording()
  • input_is_playing()

The library should work on all platforms, but it was only tested on Windows and HTML5. If you end up having any issues please let me know though, I'd be more than happy to help.

Since I made this library primarily for my own personal projects it will keep getting updated on a regular basis, as long as I keep using GameMaker that is.

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 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, but it still would be nice. :)

Changelog

v1.0.0 (02/10/2020):

  • Initial release.
Published 25 days ago
StatusReleased
CategoryAssets
AuthorMors
Made withGameMaker: Studio
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:

WalrusInput.gml 36 kB
WalrusInput.yyz 114 kB

Leave a comment

Log in with itch.io to leave a comment.