aod6060 / dsge

This is a simple 2D engine for my projects.
MIT License
1 stars 0 forks source link

Adding Gamepad InputMapping #16

Closed aod6060 closed 2 hours ago

aod6060 commented 2 hours ago
          Added in the gamepad. What I'm going to do is add in a InputMapping like system for the gamepad which I'll push to an other issue.

Originally posted by @aod6060 in https://github.com/aod6060/dsge/issues/12#issuecomment-2481811450

aod6060 commented 2 hours ago

Alright time to added in an iterface that will allow for the gamepad to have inputmapping. However, this will be implemented separately from the keyboard and mouse input mapping due to the gamepad being different for those to input devices.

aod6060 commented 2 hours ago

Here is the function interface for this input mapping interface for the gamepad. Its pretty similar to the normal inputmapping interface.

    struct InputMapping {
        PlayerControllerName name;
        ControllerButton button;
    };

    // Regular boolean check
    bool isInputMappingReleased(InputMapping* mapping);
    bool isInputMappingPressedOnce(InputMapping* mapping);
    bool isInputMappingPressed(InputMapping* mapping);
    bool isInputMappingReleasedOnce(InputMapping* mapping);

    // Axis Functions
    float getInputMappingAxisReleased(InputMapping& negative, InputMapping& positive);
    float getInputMappingAxisPressedOnce(InputMapping& negative, InputMapping& positive);
    float getInputMappingAxisPressed(InputMapping& negative, InputMapping& positive);
    float getInputMappingAxisReleasedOnce(InputMapping& negative, InputMapping& positive);

    // Value Functions
    float getInputMappingValueReleased(InputMapping& mapping);
    float getInputMappingValuePressedOnce(InputMapping& mapping);
    float getInputMappingValuePressed(InputMapping& mapping);
    float getInputMappingValueReleasedOnce(InputMapping& mapping);
aod6060 commented 2 hours ago

I messed up. Here is the actual interface for the gamepad input mapping.

    struct InputMapping {
        PlayerControllerName name;
        ControllerButton button;
    };

    void initInputMapping(InputMapping* mapping, PlayerControllerName name, ControllerButton button);

    // Regular boolean check
    bool isInputMappingReleased(InputMapping* mapping);
    bool isInputMappingPressedOnce(InputMapping* mapping);
    bool isInputMappingPressed(InputMapping* mapping);
    bool isInputMappingReleasedOnce(InputMapping* mapping);

    // Axis Functions
    float getInputMappingAxisReleased(InputMapping* negative, InputMapping* positive);
    float getInputMappingAxisPressedOnce(InputMapping* negative, InputMapping* positive);
    float getInputMappingAxisPressed(InputMapping* negative, InputMapping* positive);
    float getInputMappingAxisReleasedOnce(InputMapping* negative, InputMapping* positive);

    // Value Functions
    float getInputMappingValueReleased(InputMapping* mapping);
    float getInputMappingValuePressedOnce(InputMapping* mapping);
    float getInputMappingValuePressed(InputMapping* mapping);
    float getInputMappingValueReleasedOnce(InputMapping* mapping);
aod6060 commented 2 hours ago

Alright I'm done with this issue. So I think I'm finished with this issue for now. I'm going to start working on the configuration issue and app/render issue next.