Engine System Proposal
A downloadable project
Engine System Design – Controller Input system
This system will help the users to read input from different controllers like xbox, ps controller or any gamepad. Users can know the state of any key on the gamepad. This system also gives input from the two sticks ranging from -1 to 1 like how it does in unreal.
Features
- It should be very simple to use. Just have your project reference this project and use the functions that are made available through the namespace interface.
- Functions provided are
- IsKeyPressed(keycode)
- GetLeftStickInput()
- GetRightStickInput()
- Call back function KeyPressEventCallback(keycode)
- Function returning angle of the stick – GetStickRotation()
- A human write and readable lua file which specifies actions for binding certain keys (Like Jump – Gamepad face right button)
How to use
- The IsKeyPressed function is used to poll every frame.
- Users can also use the KeyPressEventCallBack(keycode) which gets called everytime a key is pressed, the keycode can be used to check if it is something you want.
- The Analog stick Input will be updated every frame even though the stick is idle. It will give a value between 1 and -1 depending on the direction the stick is in.
- The GetStickRotation() function gives the angle in which the stick is (ranging from 0 -360 degrees or also in radians)
Stretch goals
- Different event callbacks for double presses and single presses.
- Invert axis for sticks
Challenges I expect
- Reading and outputting the analog input seems challenging
- Event callbacks might also be tricky to implement as to what happens when two or more key presses are registered at the same time.
Leave a comment
Log in with itch.io to leave a comment.