Devices - XBox One controller / PS4 controller - Keyboard - Mouse XBone controller: - X digital button - Y digital button - B digital button - A digital button - Left stick absolute axis - Right stick absolute axis - left bumper digital button - right bumper digital button - D-pad 4 digital buttons - view button digital button - menu button digital button PS4 DualShock4 - square digital button - circle digital button - triangle digital button - cross digital button - Left stick absolute axis - Right stick absolute axis - L1 digital button - R1 digital button - L2 digital button - R2 digital button - D-pad 4 digital buttons - L3 digital button - R3 digital button - options button digital button - touchpad digtial button (/swiping?) Mouse: - left button digital button - right button digital button - scrollwheel relative axis - movement (cursor) relative axis Keyboard: - lots of buttons digital button enum actions { MOVE_FORWARD, MOVE_BACKWARD, LOOK }; // platform independent class CHID { public: CHID(); ~CHID(); virtual bool Create() = 0; virtual bool Destroy() = 0; virtual bool DeviceReady() = 0; virtual bool Update() = 0; private: bool mDeviceReady; } // Win32HIDmouse.h class Mouse : public CHID { } // Win32HIDkbd.h class Keyboard : public CHID { } #define GAME_MOVE_PLAYER_FORWARD 1000 void Game::Update() { // update user input from HID's } ************* CHAT KYLOTAN: ************* I want to create a flexible input system, where depending on the platform you have HID's, on win32 that's a mouse, kbd and maybe xbone controller cozzie: these HID's have their own buttons, axes etc. cozzie: which I will normalize and somehow 'link' to those 'enums' cozzie: then in the platform specific main loop, I will retrieve HID input and register that as events cozzie: and when game::update takes places, I will process those events, to update the game cozzie: and I'm currently at the point to write this out in 'charcoal'/ sketch to see what the basic approach will be; and I basically started with the game specific actions (giving them a unique ID) cozzie: so far I have a parent/ base class for a HID, which will get derived/ child classes per platform specific HID, first mouse and keyboard for win32 cozzie: then I started to 'give out' ID's to game specific actions, and the rest is still theory :smiley: Kylotan: Right, well, those enums shouldn't be prefixed with HID, as they're nothing to do with HIDs Kylotan: If you want one per state, fine, but again that's gonna get awkward if you want to allow rebinding if they don't all have unique values cozzie: I agree; that's why I'm throwing it out here, when I'm still at the 'think about it' phase :smiley: cozzie: so let's remove the state from the game action names and find a solution if I want to allow rebinding(gewijzigd) Kylotan: One big enum for everything is usually sufficient, unless you know you'll need more cozzie: ok, so that would mean that different actions will need a prefix to distinct them somehow Kylotan: if you like cozzie: for example if the game is in menu state, the HID event that linked to "MENU_ITEM_UP" can be triggered cozzie: just 'UP' doesn't feel right, unless I can distinguish what to do based on the current state, is that what you mean? Kylotan: The names can be whatever you want them to be cozzie: maybe I'm trying to shortcut something here, I could have a layer to abstract the HID input to generic input, like 'UP', 'DOWN', 'LEFT', BUTTON_A etc. cozzie: and then you can bind game actions to those generic inputs, which in the background can be fed by any device Kylotan: No point really Kylotan: Nah cozzie: nah on whic point? :smiley: Kylotan: Both of the above Kylotan: It serves no purpose and breaks other things Kylotan: Bind each input to a specific in-game action. Create an enum of all those actions if you can. Make sure each state knows which actions are relevant and only accept/generate those events accordingly. cozzie: ok, clear cozzie: thanks