fixed a memory leaks in app delegate
* adjusted the touch sensitivity of the iOS port for deck menu selection. Decks were being selected even though the selection was touched. It was highlighted but as soon as you let go it would instantly select (OK button) select the selected deck. This isn't a problem on Android as the SDL already handles this as far as I can tell. I limited this to only iOS so I don't accidentally mess up the other ports.
This commit is contained in:
@@ -115,6 +115,8 @@
|
|||||||
NSString *resPath = [NSString stringWithFormat: @"%@/Res", docsPath];
|
NSString *resPath = [NSString stringWithFormat: @"%@/Res", docsPath];
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
|
|
||||||
|
[compoundPredicate release], compoundPredicate = nil;
|
||||||
|
|
||||||
if ( ([resourceZipFiles count] > 0 ) && ![fileManager fileExistsAtPath: userPath] )
|
if ( ([resourceZipFiles count] > 0 ) && ![fileManager fileExistsAtPath: userPath] )
|
||||||
[fileManager createDirectoryAtPath: userPath withIntermediateDirectories: YES attributes:nil error:nil ];
|
[fileManager createDirectoryAtPath: userPath withIntermediateDirectories: YES attributes:nil error:nil ];
|
||||||
|
|
||||||
@@ -206,6 +208,8 @@
|
|||||||
[fm moveItemAtPath: fromPath toPath: toPath error: nil];
|
[fm moveItemAtPath: fromPath toPath: toPath error: nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[playerDataPredicate release], playerDataPredicate = nil;
|
||||||
|
|
||||||
[self createManifest: docsPath];
|
[self createManifest: docsPath];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"readyToStartGame" object: nil];
|
[[NSNotificationCenter defaultCenter] postNotificationName: @"readyToStartGame" object: nil];
|
||||||
@@ -243,6 +247,8 @@
|
|||||||
|
|
||||||
- (void) setupNetworkListeners
|
- (void) setupNetworkListeners
|
||||||
{
|
{
|
||||||
|
NSLog(@"App checking network connections");
|
||||||
|
|
||||||
hostReach = [[Reachability reachabilityForGoogleDNS] retain];
|
hostReach = [[Reachability reachabilityForGoogleDNS] retain];
|
||||||
internetReach = [[Reachability reachabilityForInternetConnection] retain];
|
internetReach = [[Reachability reachabilityForInternetConnection] retain];
|
||||||
wifiReach = [[Reachability reachabilityForLocalWiFi] retain];
|
wifiReach = [[Reachability reachabilityForLocalWiFi] retain];
|
||||||
|
|||||||
@@ -14,13 +14,16 @@ private:
|
|||||||
bool mHasFocus;
|
bool mHasFocus;
|
||||||
bool mScrollEnabled;
|
bool mScrollEnabled;
|
||||||
bool mDisplayInitialized;
|
bool mDisplayInitialized;
|
||||||
|
bool mIsValidSelection;
|
||||||
|
|
||||||
DeckMenu* parent;
|
DeckMenu* parent;
|
||||||
int fontId;
|
int fontId;
|
||||||
string mText;
|
string mText;
|
||||||
float mTitleResetWidth;
|
float mTitleResetWidth;
|
||||||
static float mYOffset;
|
static float mYOffset;
|
||||||
|
|
||||||
|
void checkUserClick();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
string imageFilename;
|
string imageFilename;
|
||||||
string desc;
|
string desc;
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#define ITEM_PX_WIDTH 190.0f
|
#define ITEM_PX_WIDTH 190.0f
|
||||||
|
#define kItemXOffset 22
|
||||||
|
#define kItemYHeight 20
|
||||||
|
|
||||||
const int kHorizontalScrollSpeed = 30; // higher numbers mean faster scrolling
|
const int kHorizontalScrollSpeed = 30; // higher numbers mean faster scrolling
|
||||||
|
|
||||||
@@ -17,6 +19,8 @@ DeckMenuItem::DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, f
|
|||||||
WFont * mFont = WResourceManager::Instance()->GetWFont(fontId);
|
WFont * mFont = WResourceManager::Instance()->GetWFont(fontId);
|
||||||
meta = deckMetaData;
|
meta = deckMetaData;
|
||||||
mText = trim(text);
|
mText = trim(text);
|
||||||
|
mIsValidSelection = false;
|
||||||
|
|
||||||
if (autoTranslate)
|
if (autoTranslate)
|
||||||
mText = _(mText);
|
mText = _(mText);
|
||||||
|
|
||||||
@@ -113,25 +117,46 @@ void DeckMenuItem::Render()
|
|||||||
RenderWithOffset(0);
|
RenderWithOffset(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeckMenuItem::checkUserClick()
|
||||||
|
{
|
||||||
|
#ifdef IOS
|
||||||
|
int x1 = 0, y1 = 0;
|
||||||
|
if ( mEngine->GetLeftClickCoordinates(x1, y1))
|
||||||
|
{
|
||||||
|
mIsValidSelection = false;
|
||||||
|
int x2 = kItemXOffset, y2 = static_cast<int>(mY + mYOffset);
|
||||||
|
if ( (x1 >= x2) && (x1 <= (x2 + ITEM_PX_WIDTH)) && (y1 >= y2) && (y1 < (y2 + kItemYHeight)))
|
||||||
|
mIsValidSelection = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mIsValidSelection = true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DeckMenuItem::Entering()
|
void DeckMenuItem::Entering()
|
||||||
{
|
{
|
||||||
|
checkUserClick();
|
||||||
mHasFocus = true;
|
mHasFocus = true;
|
||||||
parent->mSelectionTargetY = mY;
|
parent->mSelectionTargetY = mY;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeckMenuItem::Leaving(JButton key)
|
bool DeckMenuItem::Leaving(JButton key)
|
||||||
{
|
{
|
||||||
|
// check to see if the user clicked on the object, if so return true.
|
||||||
|
checkUserClick();
|
||||||
mHasFocus = false;
|
mHasFocus = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeckMenuItem::ButtonPressed()
|
bool DeckMenuItem::ButtonPressed()
|
||||||
{
|
{
|
||||||
return true;
|
return mIsValidSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckMenuItem::Relocate(float x, float y)
|
void DeckMenuItem::Relocate(float x, float y)
|
||||||
{
|
{
|
||||||
|
checkUserClick();
|
||||||
mX = x;
|
mX = x;
|
||||||
mY = y;
|
mY = y;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user