mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 03:59:36 +00:00
Lots of Android fixes and stubs. Increase SDL log level on Android. Add GL context loss handling.
This commit is contained in:
@@ -326,25 +326,24 @@ public:
|
||||
|
||||
void AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualHeight, float &pixelScaleX, float &pixelScaleY) override
|
||||
{
|
||||
if (physicalWidth < 640)
|
||||
physicalWidth = 640;
|
||||
|
||||
if (physicalHeight < 480)
|
||||
physicalHeight = 480;
|
||||
|
||||
double minMul = 1.0;
|
||||
|
||||
if (isAutoScale)
|
||||
if (isAutoScale || physicalWidth < 640 && physicalHeight < 480)
|
||||
{
|
||||
double xMul = static_cast<double>(physicalWidth) / 640.0;
|
||||
double yMul = static_cast<double>(physicalHeight) / 480.0;
|
||||
|
||||
double granularity = 2.0;
|
||||
minMul = std::min(xMul, yMul);
|
||||
|
||||
xMul = floor(xMul * granularity) / granularity;
|
||||
yMul = floor(yMul * granularity) / granularity;
|
||||
if (minMul >= 1.0)
|
||||
{
|
||||
double granularity = 2.0;
|
||||
|
||||
minMul = std::max<double>(1.0, std::min(xMul, yMul));
|
||||
xMul = floor(xMul * granularity) / granularity;
|
||||
yMul = floor(yMul * granularity) / granularity;
|
||||
|
||||
minMul = std::min(xMul, yMul);
|
||||
}
|
||||
}
|
||||
|
||||
virtualWidth = physicalWidth / minMul;
|
||||
|
||||
@@ -13,11 +13,14 @@
|
||||
#include "WindowManager.h"
|
||||
|
||||
int gpAppMain();
|
||||
void gpAppInit();
|
||||
|
||||
class GpAppInterfaceImpl final : public GpAppInterface
|
||||
{
|
||||
public:
|
||||
void ApplicationInit() override;
|
||||
int ApplicationMain() override;
|
||||
|
||||
void PL_IncrementTickCounter(uint32_t count) override;
|
||||
void PL_Render(IGpDisplayDriver *displayDriver) override;
|
||||
void PL_HostFileSystem_SetInstance(PortabilityLayer::HostFileSystem *instance) override;
|
||||
@@ -32,6 +35,10 @@ public:
|
||||
bool PL_AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY) override;
|
||||
};
|
||||
|
||||
void GpAppInterfaceImpl::ApplicationInit()
|
||||
{
|
||||
gpAppInit();
|
||||
}
|
||||
|
||||
int GpAppInterfaceImpl::ApplicationMain()
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "GpIOStream.h"
|
||||
#include "House.h"
|
||||
#include "MenuManager.h"
|
||||
#include "RenderedFont.h"
|
||||
#include "ResolveCachingColor.h"
|
||||
#include "WindowManager.h"
|
||||
@@ -425,6 +426,12 @@ void PreloadFonts()
|
||||
StepLoadScreen(1);
|
||||
}
|
||||
|
||||
void gpAppInit()
|
||||
{
|
||||
// This is called before the display driver is initialized
|
||||
InstallResolutionHandler();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- main
|
||||
// Here is main(). The first function called when Glider PRO comes up.
|
||||
|
||||
@@ -439,7 +446,9 @@ int gpAppMain()
|
||||
|
||||
ToolBoxInit();
|
||||
CheckOurEnvirons();
|
||||
InstallResolutionHandler();
|
||||
|
||||
if (thisMac.isTouchscreen)
|
||||
PortabilityLayer::MenuManager::GetInstance()->SetMenuTouchScreenStyle(true);
|
||||
|
||||
if (!thisMac.hasColor)
|
||||
RedAlert(kErrNeedColorQD);
|
||||
|
||||
@@ -224,7 +224,10 @@ void OpenMainWindow (void)
|
||||
mainWindowRect.bottom - mainWindowRect.top, false);
|
||||
|
||||
const short mainWindowLeft = (thisMac.fullScreen.left + thisMac.fullScreen.right + thisMac.constrainedScreen.left - thisMac.constrainedScreen.right) / 2;
|
||||
const short mainWindowTop = (thisMac.fullScreen.top + thisMac.fullScreen.bottom + thisMac.constrainedScreen.top - thisMac.constrainedScreen.bottom) / 2 + kScoreboardTall;
|
||||
short mainWindowTop = (thisMac.fullScreen.top + thisMac.fullScreen.bottom + thisMac.constrainedScreen.top - thisMac.constrainedScreen.bottom) / 2;
|
||||
|
||||
if (!PortabilityLayer::MenuManager::GetInstance()->IsMenuTouchScreenStyle())
|
||||
mainWindowTop += kScoreboardTall;
|
||||
|
||||
MoveWindow(boardWindow, mainWindowLeft, 0, true);
|
||||
MoveWindow(mainWindow, mainWindowLeft, mainWindowTop, true); // thisMac.menuHigh
|
||||
|
||||
@@ -711,7 +711,7 @@ bool ExportSourceToStream (GpIOStream *stream)
|
||||
|
||||
void DoExportSourceCode (void)
|
||||
{
|
||||
GpIOStream *stream = PortabilityLayer::HostFileSystem::GetInstance()->OpenFile(PortabilityLayer::VirtualDirectories::kPrefs, "SourceExport.zip", true, GpFileCreationDispositions::kCreateOrOverwrite);
|
||||
GpIOStream *stream = PortabilityLayer::HostFileSystem::GetInstance()->OpenFile(PortabilityLayer::VirtualDirectories::kSourceExport, "SourceExport.zip", true, GpFileCreationDispositions::kCreateOrOverwrite);
|
||||
if (!stream)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user