Giter Site home page Giter Site logo

Comments (1)

aduros avatar aduros commented on May 28, 2024

Hi, thanks for flagging this!

  • Dot and comma don’t do anything (they should be player 1 X and Z).
  • None of the numpad keys, which are supposed to be for player 3, do anything.

The native runtime doesn't currently listen to keys for players 3 and 4, but it should be easy to add.

  • W, Y, J, and V, despite not being documented as doing anything, are player 1 Z.
  • K, C, and spacebar, despite not being documented as doing anything, are player 1 X.

Some of these undocumented keys are actually to support Dvorak and German keyboards, as it looks like minifb has a limitation of not being able to map to a physical key location.

If you'd like to help with a PR, the source is here:

// Keyboard handling
const uint8_t* keyBuffer = mfb_get_key_buffer(window);
// Player 1
uint8_t gamepad = 0;
if (keyBuffer[KB_KEY_X] || keyBuffer[KB_KEY_V] || keyBuffer[KB_KEY_K] || keyBuffer[KB_KEY_SPACE]) {
gamepad |= W4_BUTTON_X;
}
if (keyBuffer[KB_KEY_Z] || keyBuffer[KB_KEY_C] || keyBuffer[KB_KEY_Y] || keyBuffer[KB_KEY_W] || keyBuffer[KB_KEY_J]) {
gamepad |= W4_BUTTON_Z;
}
if (keyBuffer[KB_KEY_LEFT]) {
gamepad |= W4_BUTTON_LEFT;
}
if (keyBuffer[KB_KEY_RIGHT]) {
gamepad |= W4_BUTTON_RIGHT;
}
if (keyBuffer[KB_KEY_UP]) {
gamepad |= W4_BUTTON_UP;
}
if (keyBuffer[KB_KEY_DOWN]) {
gamepad |= W4_BUTTON_DOWN;
}
w4_runtimeSetGamepad(0, gamepad);
// Player 2
gamepad = 0;
if (keyBuffer[KB_KEY_LEFT_SHIFT] || keyBuffer[KB_KEY_TAB]) {
gamepad |= W4_BUTTON_X;
}
if (keyBuffer[KB_KEY_A] || keyBuffer[KB_KEY_Q]) {
gamepad |= W4_BUTTON_Z;
}
if (keyBuffer[KB_KEY_S]) {
gamepad |= W4_BUTTON_LEFT;
}
if (keyBuffer[KB_KEY_F]) {
gamepad |= W4_BUTTON_RIGHT;
}
if (keyBuffer[KB_KEY_E]) {
gamepad |= W4_BUTTON_UP;
}
if (keyBuffer[KB_KEY_D]) {
gamepad |= W4_BUTTON_DOWN;
}
w4_runtimeSetGamepad(1, gamepad);

from wasm4.

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.