* Fix options and screenshot saving.

This commit is contained in:
iProgramInCpp
2023-11-04 15:01:40 +02:00
parent 492ee48125
commit 4877dfde6d
3 changed files with 38 additions and 0 deletions

View File

@@ -55,8 +55,31 @@ void AppPlatform_android::buyGame()
{
}
bool AppPlatform_android::hasFileSystemAccess()
{
return true;
}
void AppPlatform_android::setExternalStoragePath(const std::string& path)
{
m_storageDir = path;
}
void AppPlatform_android::saveScreenshot(const std::string& fileName, int width, int height)
{
std::string saveName = m_storageDir + "/" + fileName;
LOG_I("Saving in %s", saveName.c_str());
int npixels = width * height;
uint32_t* pixels = new uint32_t[npixels];
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
stbi_flip_vertically_on_write(true);
stbi_write_png(saveName.c_str(), width, height, 4, pixels, width * 4);
delete[] pixels;
}
int AppPlatform_android::getScreenWidth() const