Day 4 of the Level Editor project
Today we want to introduce saving and loading to our project. In game.h, we introduce these new variables: unsigned int levelSizeX; unsigned int levelSizeY; Keys *keyPressed; keyPressed stores keys that have been detected as pressed, so that we can perform an action as soon as the key is released. In the Initialize method of game.cpp, we initialize keyPressed: keyPressed = new Keys(); Now we have to append the following code to the Update method so that the action is performed once the respective key is released: if (g_keys->keyDown['S']) { keyPressed->keyDown['S'] = true; } else if (keyPressed->keyDown['S'] && !g_keys->keyDown['S']) { SaveLevel(); keyPressed->keyDown['S'] = false; } if (g_keys->keyDown['L']) { keyPressed->keyDown['L'] = true; } else if (keyPressed->keyDown['L'] && !g_keys->keyDown['L']) { LoadLevel(); keyPre