* Add writeable configuration.

This commit is contained in:
iProgramInCpp
2023-08-06 22:21:18 +03:00
parent 56c2d55c5c
commit 9ef72164bb
10 changed files with 64 additions and 16 deletions

View File

@@ -209,6 +209,18 @@ std::vector<std::string> AppPlatform_windows::getOptionStrings()
return o;
}
void AppPlatform_windows::setOptionStrings(const std::vector<std::string>& str)
{
assert(str.size() % 2 == 0);
std::ofstream os("options.txt");
os << "#Config file for Minecraft PE. The # at the start denotes a comment, removing it makes it a command.\n\n";
for (int i = 0; i < int(str.size()); i += 2)
os << str[i] << '|' << str[i + 1] << '\n';
}
void AppPlatform_windows::setScreenSize(int width, int height)
{
m_ScreenWidth = width;

View File

@@ -47,6 +47,9 @@ public:
// Also add these to allow proper text input within the game.
bool shiftPressed() override;
void setShiftPressed(bool b);
// Also add these to allow saving options.
void setOptionStrings(const std::vector <std::string>& str) override;
void setScreenSize(int width, int height);

View File

@@ -276,6 +276,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLin
}
_cleanup:
g_pApp->saveOptions();
// disable OpenGL for the window
DisableOpenGL(hWnd, hDC, hRC);