Anda perlu menggunakan serialisasi untuk menyimpan variabel Anda dalam memori ke hard drive Anda. Ada banyak jenis serialisasi, dalam. NET XML adalah format yang umum, meskipun ada serialisator biner dan JSON. Saya bukan programmer C ++, tetapi sebuah pencarian cepat menghasilkan contoh serialisasi dalam C ++:
There are libraries, that offer serializing functionalities. Some are mentioned in other answers.
The variables you will be interested in are going to probably be related to game state. For example, you will probably want to know this type of information
- The player was playing level 3
- The player was at X, Y world coordinates
- The player has three items in his backpack
- Weapon
- Armor
- Food
You wont really care what textures are being used (unless your player can change their appearance, that's a special case), because they are usually the same. You need to focus on saving important gamestate data.
When you start your game, you start as normal for a "new" game (this loads your textures, models, etc) but at appropriate time you load the values from your save file back into the game state object replacing the "default" new game state. Then you allow the player to resume playing.
I've greatly simplified it here, but you should get the general idea. If you have a more specific question ask a new question here and we can try to help you with it.