schveiguy / raylib-d

Resurrected copy of onroundit's raylib-d
zlib License
57 stars 14 forks source link

Is IsKeyPressedRepeat going to be put in? #40

Closed joelcnz closed 1 year ago

joelcnz commented 1 year ago

Here's some of an idea that worked for me with SDL:

    bool keyInput() { // eg. g_keys[Keyboard.Key.A].keyInput
        if (! g_keystate[tKey])
            _keyState = KeyState.up;

        if (g_keystate[tKey] && _keyState == KeyState.up) {
            _keyState = KeyState.down;
            _stopWatchStart.reset;
            _stopWatchStart.start;

            return true;
        }

        if (_keyState == KeyState.down && _stopWatchStart.peek.total!"msecs" > _startPause)  {
            _keyState = KeyState.smallGap;
            _stopWatchPause.reset;
            _stopWatchPause.start;
        }

        if (_keyState == KeyState.smallGap && _stopWatchPause.peek.total!"msecs" > _pauseTime) {
            _keyState = KeyState.down;

            return true;
        }

        return false;
    }
schveiguy commented 1 year ago

Hmm it seems to be there. https://github.com/schveiguy/raylib-d/blob/master/source/raylib/package.d#L1139

joelcnz commented 1 year ago

Error: undefined identifier IsKeyPressedRepeat

The others work.

I noticed it's the only one with the comment desktop only. (Only PLATFORM_DESKTOP) I'm using a MacBook Pro.

schveiguy commented 1 year ago

What version of raylib-d are you using? This function was added in 5.0.

joelcnz commented 1 year ago

Yeah, that's it. Thanks.