A banner image showing two game controllers

XINPUT APPLICATION

In order to deal more intensively with C++ and the Windows API, I started already at the end of 2021 to implement my own projects in the context of Win32, C++ and game engines. Here it offered itself to implement an input system for controllers.

A gif showing the xinput application

IMPLEMENTATION

For the implementation I used the event-based input system Rewired for Unity. I really liked working with this system. Unlike inputs in Unity, which were often queried via if or switch structures within the update method (in the meantime, Unity has fundamentally reworked its input system. As far as I know it now works very similar to Rewired), in Rewired delegates can be used for individual input events. This makes the system a bit clearer and easier to handle, since different subsystems that process input can simply subscribe to the events and are automatically supplied with the necessary data.

An image showing code of the xinput system class

When implementing the delegates I had to deal with some difficulties and ambiguities, especially when the same event is subscribed by multiple instances. Also, implementing function pointers within a class was challenging. I was only able to solve these problems provisionally at the time, which was not a big deal since they were not of the highest relevance to me at the time.

The project is available for download for Windows here. Today I would implement some aspects differently. I will also probably implement a new XInput system in my continuous project, which can be found here.

RETURN

This webpage does not use cookies and does not save data.
Happy browsing!

Got it!