Update preprocessor checks to support SDL

This commit is contained in:
Nathan Fulton 2016-03-14 15:40:02 -04:00
parent 19d74d3da6
commit 573c8aafd3
12 changed files with 25 additions and 27 deletions

View File

@ -138,7 +138,7 @@ private:
bool DoModalGameOptionsForm(Palette *ppal, bool fInGame)
{
#ifndef IPHONE
#if !defined(IPHONE) && !defined(SDL)
ShellForm *pfrm = (ShellForm *)gpmfrmm->LoadForm(gpiniForms, kidfGameOptions, new GameOptionsForm());
if (pfrm == NULL)
return false;
@ -160,8 +160,7 @@ bool DoModalGameOptionsForm(Palette *ppal, bool fInGame)
pfrm->Show(false);
delete pfrm;
#else
// iPhone only has InGameOptions
// iPhone and SDL builds only have InGameOptions
ShellForm *pfrm = (ShellForm *)gpmfrmm->LoadForm(gpiniForms,
kidfInGameOptions, new InGameOptionsForm());
if (pfrm == NULL) {
@ -334,7 +333,7 @@ bool InGameOptionsForm::Init(FormMgr *pfrmm, IniReader *pini, word idf)
m_wfHandicap = gwfHandicap;
m_nScrollSpeed = gnScrollSpeed;
#ifdef IPHONE
#if defined(IPHONE) || defined(SDL)
GetControlPtr(kidcLassoSelection)->Show(false);
#endif

View File

@ -696,7 +696,7 @@ void PlaceStructureForm::GetSubRects(WCoord wx, WCoord wy, Rect *prcInside,
wrcInside.bottom = WcFromTc(m_ty + m_pstruc->ctyReserve);
WRect wrcOutside = wrcInside;
#ifdef IPHONE
#if defined(IPHONE) || defined(SDL)
if (wrcOutside.Width() < WcFromTc(3)) {
wrcOutside.Inflate((WcFromTc(3) - wrcOutside.Width()) / 2, 0);
}

View File

@ -50,7 +50,7 @@ bool HelpControl::Init(Form *pfrm, IniReader *pini, FindProp *pfind)
m_cyPageAmount = (int)((long)m_rc.Height() * 85 / 100);
#ifdef IPHONE
#if defined(IPHONE) || defined(SDL)
m_wf |= kfHelpScrollPosition;
#endif
@ -729,7 +729,7 @@ int HelpControl::FindNextPosition(int nchFrom, int cyAmount, bool *pfLargeFont,
fph.nDistY = cyAmount;
fph.cySpan = cyAmount;
fph.cyControl = m_rc.Height();
#ifdef IPHONE
#if defined(IPHONE) || defined(SDL)
fph.nCondition = knFindPosFingerScroll;
#else
fph.nCondition = fCondition ? knFindPosAtLeastY : knFindPosAtMostY;
@ -1054,12 +1054,12 @@ bool HelpForm::DoModal(const char *pszLink, const char *pszFile)
if (pszLink != NULL)
pctl->FollowLink(pszLink);
#ifdef IPHONE
Control *pctlT = GetControlPtr(kidcNextPage);
pctlT->Show(false);
pctlT->Show(true);
pctlT = GetControlPtr(kidcPrevPage);
pctlT->Show(false);
#endif
pctlT->Show(true);
pctlT = GetControlPtr(kidcBack);
pctlT->Show(true);
int idc;
ShellForm::DoModal(&idc, false);

View File

@ -315,7 +315,7 @@ void InputUIForm::InGameMenu()
ShellForm *pfrm = (ShellForm *)gpmfrmm->LoadForm(gpiniForms, kidfInGameMenu, new ShellForm());
#ifdef IPHONE
#if defined(IPHONE) || defined(__IPHONEOS__) || defined(__ANDROID__)
pfrm->GetControlPtr(kidcExitGame)->Show(false);
#endif

View File

@ -147,7 +147,7 @@ void ReplicatorGob::Draw(DibBitmap *pbm, int xViewOrigin, int yViewOrigin, int n
m_ani.SetStrip(m_fEnabled ? 2 : 0);
m_ani.Draw(pbm, x, y, side);
m_ani.SetStrip(m_fEnabled ? 3 : 1);
#ifdef IPHONE
#if defined(IPHONE) || defined(SDL)
// When this is scaled up by 1 1/3 (scaling 24 art to 32),
// the upper right quadrant piece is 55 high, which translates after
// rounding to 73, yet the lower right quad piece wants to go at

View File

@ -167,7 +167,7 @@ SimUIForm::SimUIForm(word wfRole, dword gameid, Chatter *chatter)
m_nStateMoveTarget = 0;
m_ppenh = NULL;
#ifdef IPHONE
#if defined(IPHONE) || defined(__IPHONEOS__) || defined(__ANDROID__)
SetUIType(kuitFinger);
#else
SetUIType(kuitStylus);
@ -2539,7 +2539,7 @@ void MiniMapControl::OnPenEvent(Event *pevt)
return;
}
#ifdef IPHONE
#if defined(IPHONE) || defined(__IPHONEOS__) || defined(__ANDROID__)
// If already waiting for pen down timeout, then just update the x,y
if (m_wfMm & kfMmPenDownTimeout) {

View File

@ -78,7 +78,7 @@ long gtStressTimeout;
#endif
#ifndef PIL
#if defined(IPHONE) && !defined(DEV_BUILD) && !defined(BETA_TIMEOUT)
#if (defined(IPHONE) || defined(SDL)) && (!defined(DEV_BUILD) && !defined(BETA_TIMEOUT))
char *gszVersion = "1.6";
#else
char *gszVersion = "+++VERSION+++";
@ -1721,9 +1721,9 @@ bool Game::AskResignGame(bool fTellHost)
{
bool fAppStopping = gevm.IsAppStopping();
bool fAsk = true;
#ifdef IPHONE
// When an iPhone game exits, it exits without the opportunity to
// confirm with the user. So if Iphone and the app is stopping, just
#if defined(IPHONE) || defined(__IPHONEOS__) || defined (__ANDROID__)
// When an iPhone or Android game exits, it exits without the opportunity to
// confirm with the user. So if iPhone and the app is stopping, just
// resign.
if (fAppStopping) {
fAsk = false;
@ -2631,7 +2631,7 @@ bool Game::GetVar(const char *pszName, char *pszBuff, int cbBuff)
strncpyz(pszBuff, gfGrayscale ? "1" : "0", cbBuff);
} else if (stricmp(pszName, "$iphone") == 0) {
#ifdef IPHONE
#if defined(IPHONE) || defined(__IPHONEOS__)
strncpyz(pszBuff, "1", cbBuff);
#else
strncpyz(pszBuff, "0", cbBuff);

View File

@ -1822,7 +1822,7 @@ struct FlickVector {
dword cms;
};
#define kcevtPenHistory 32 // keep power of 2
#define kcmsFlickQuantum 100
#define kcmsFlickQuantum 150
class EventMgr // evm
{

View File

@ -927,7 +927,7 @@ bool ListControl::Init(Form *pfrm, IniReader *pini, FindProp *pfind)
m_cyItem = pfnt->GetHeight() + kcyListLineSpace - pfnt->GetLineOverlap();
m_cxEllipsis = pfnt->GetTextExtent("...");
#ifdef IPHONE
#if defined(IPHONE) || defined(__IPHONEOS__) || defined(__ANDROID__)
m_wf |= kfLstcScrollPosition;
#endif

View File

@ -74,12 +74,10 @@ bool Display::Init()
// Absolutely do not mess with SDL_FULLSCREEN if there is any chance the app
// will crash or stop at a breakpoint. If it does you will be lost in full
// screen mode! (ssh from another machine and kill the Xcode process)
videoflags = SDL_SWSURFACE | SDL_WINDOW_ALLOW_HIGHDPI;
videoflags = SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_SHOWN;
#if defined(__IPHONEOS__) || defined(__ANDROID__)
videoflags = videoflags | SDL_WINDOW_BORDERLESS;
SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeRight LandscapeLeft");
#else
videoflags = SDL_SWSURFACE | SDL_WINDOW_ALLOW_HIGHDPI;
#endif
// The host wants to process mouse and touch events separately

View File

@ -13,11 +13,12 @@
// To determine if running on simulator, the sdk sets TARGET_IPHONE_SIMULATOR
// to 0 or 1.
#if defined(IPHONE) || defined(__IPHONEOS__)
#include <TargetConditionals.h>
#if TARGET_IPHONE_SIMULATOR == 1
#define SIMULATOR
#endif
#endif
namespace wi {

View File

@ -229,7 +229,7 @@ long SoundMgr::FilterSleepTicks(long ct)
// limit sleeping Further, if we DO limit sleeping we will cause problems
// for the background Bluetooth communications threads.
#if !defined(CE) && !defined(IPHONE)
#if !defined(CE) && !defined(IPHONE) && !defined(SDL)
// If we have sound effects to play, don't sleep
if (m_psndd != NULL) {