Hello,
I have 2 question for you.
1. How do I make a folder inside the Documents folder? I want to save the settings there.
2. How do I add a keyboard and mouse input, like if you push on wasd, you can control a car etc.
- Jestin
Hello,
I have 2 question for you.
1. How do I make a folder inside the Documents folder? I want to save the settings there.
2. How do I add a keyboard and mouse input, like if you push on wasd, you can control a car etc.
- Jestin
1. How do I make a folder inside the Documents folder? I want to save the settings there.
For inputs you have 2 options:
Google around for Direct Input tutorials.
If you need text input, don't use neither of those. use the WM_CHAR event.
For inputs you have 2 options:
Google around for Direct Input tutorials.
- Listen for WM_KEYDOWN and WM_KEYUP events.
- Use Direct Input. (my recommendation). it is keyboard agnostic so WASD will be mapped to the same keys even on AZERTY keyboards.
If you need text input, don't use neither of those. use the WM_CHAR event.
1. How do I make a folder inside the Documents folder? I want to save the settings there.
Going off the assumption that you're using Windows (I don't think Linux has a "Documents" folder - Mac might?)
First off - application/game settings are typically stored in the application data folder, not the user's documents folder. The user's documents folder is more commonly used for save games.
Use SHGetKnownFolderPath to get the path to FOLDERID_Documents (for the documents folder) or FOLDERID_LocalAppData (for the data folder). Then add your folder name to the path with PathCombine (if you want to support older systems) or PathCchCombine (if you don't mind restricting your program to Windows 8 or newer).
Now that you have your path, you can use CreateDirectory to actually make the folder. Note that the parent folders need to exist, so if you want to do something like "MyCompany\MyGame" you'll have to create the MyCompany folder before you try creating MyGame.
I'll leave the answer of 2 to people more experienced with input systems, but to get raw keyboard and mouse input from Windows (i.e. button presses and mouse deltas), you'll want to use Raw Input. For text input and mouse cursor handling, use standard Windows messages.
Oh thanks for the tip to save it in the data folder :) I will try
Games/Projects Currently In Development:
Discord RPG Bot | D++ - The Lightweight C++ Discord API Library | TriviaBot Discord Trivia Bot