Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Game Center. Fix for iOS 9 arrays not being populated. Fix fo… #16

Merged
merged 1 commit into from
Oct 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions iBrogue_iPad.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "iBrogue_iPad/iBrogue_iPad-Prefix.pch";
INFOPLIST_FILE = "iBrogue_iPad/iBrogue_iPad-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = SethHoward.iBrogue;
Expand Down Expand Up @@ -641,7 +641,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "iBrogue_iPad/iBrogue_iPad-Prefix.pch";
INFOPLIST_FILE = "iBrogue_iPad/iBrogue_iPad-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = SethHoward.iBrogue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<dict>
<key>Brogue.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>3</integer>
</dict>
Expand All @@ -19,11 +21,6 @@
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>iBrogue_iPad_what.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions iBrogue_iPad/Images.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
"filename" : "Icon-167.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Brogue Icon.png",
"scale" : "1x"
},
{
"idiom" : "car",
"size" : "60x60",
Expand Down
8 changes: 4 additions & 4 deletions iBrogue_iPad/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Aj1-6Q-hr4">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Aj1-6Q-hr4">
<device id="ipad12_9" orientation="landscape">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -243,7 +243,7 @@
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="seedButtonPressed:" destination="Aj1-6Q-hr4" eventType="touchUpOutside" id="TdT-jc-XEl"/>
<action selector="seedButtonPressed:" destination="Aj1-6Q-hr4" eventType="touchUpInside" id="J1u-kC-IQf"/>
</connections>
</button>
</subviews>
Expand Down
19 changes: 11 additions & 8 deletions iBrogue_iPad/PlatformCode/BrogueViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ import UIKit

// MARK: - UIBrogueTouchEvent

final class UIBrogueTouchEvent: NSObject, NSCopying {
let phase: UITouch.Phase
let location: CGPoint
@objc class UIBrogueTouchEvent: NSObject, NSCopying {
@objc let phase: UITouch.Phase
@objc let location: CGPoint

required init(phase: UITouch.Phase, location: CGPoint) {
self.phase = phase
Expand Down Expand Up @@ -113,8 +113,8 @@ final class BrogueViewController: UIViewController {
@IBOutlet fileprivate weak var leaderBoardButton: UIButton!
@IBOutlet fileprivate weak var seedButton: UIButton!

var seedKeyDown = false
var lastBrogueGameEvent: BrogueGameEvent = .showTitle {
@objc var seedKeyDown = false
@objc var lastBrogueGameEvent: BrogueGameEvent = .showTitle {
didSet {
DispatchQueue.main.async {
switch self.lastBrogueGameEvent {
Expand Down Expand Up @@ -154,6 +154,8 @@ final class BrogueViewController: UIViewController {
magView.viewToMagnify = skViewPort
magView.hideMagnifier()
inputTextField.delegate = self

GameCenterManager.sharedInstance()?.authenticateLocalUser()
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
Expand Down Expand Up @@ -289,7 +291,7 @@ extension BrogueViewController {
}
}

func dequeTouchEvent() -> UIBrogueTouchEvent? {
@objc func dequeTouchEvent() -> UIBrogueTouchEvent? {
var event: UIBrogueTouchEvent?

synchronized(touchEvents) {
Expand All @@ -302,7 +304,7 @@ extension BrogueViewController {
return event
}

func hasTouchEvent() -> Bool {
@objc func hasTouchEvent() -> Bool {
return !touchEvents.isEmpty
}
}
Expand Down Expand Up @@ -386,7 +388,7 @@ extension BrogueViewController {
}

// cannot be optional for backward compat
func dequeKeyEvent() -> UInt8 {
@objc func dequeKeyEvent() -> UInt8 {
var event: UInt8!

synchronized(keyEvents) {
Expand All @@ -400,6 +402,7 @@ extension BrogueViewController {
return event
}

@objc(hasKeyEvent)
func hasKeyEvent() -> Bool {
return !keyEvents.isEmpty
}
Expand Down
4 changes: 2 additions & 2 deletions iBrogue_iPad/PlatformCode/RogueDriver.mm
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ void nextKeyOrMouseEvent(rogueEvent *returnEvent, __unused boolean textInput, bo
break;
}

x = COLS * touch.location.x / width;
y = ROWS * touch.location.y / height;
x = COLS * float(touch.location.x) / width;
y = ROWS * float(touch.location.y) / height;

returnEvent->param1 = x;
returnEvent->param2 = y;
Expand Down
15 changes: 10 additions & 5 deletions iBrogue_iPad/PlatformCode/RogueScene.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extension CGSize {

// To see Swift classes from ObjC they MUST be prefaced with @objc and be public/open
@objc public class RogueScene: SKScene {
fileprivate let grid: CGSize
fileprivate let gridSize: CGSize
fileprivate let cellSize: CGSize

fileprivate var fgTextures = [SKTexture]()
Expand All @@ -57,9 +57,14 @@ extension CGSize {
}()

public init(size: CGSize, rows: Int, cols: Int) {
grid = CGSize(rows: rows, cols: cols)
gridSize = CGSize(rows: rows, cols: cols)
cellSize = CGSize(width: CGFloat(size.width) / CGFloat(cols), height: CGFloat(size.height) / CGFloat(rows))
super.init(size: size)

if #available(iOS 10.0, *) {}
else {
sceneDidLoad()
}
}

required public init?(coder aDecoder: NSCoder) {
Expand All @@ -78,10 +83,10 @@ extension RogueScene {
}

override public func sceneDidLoad() {
for x in 0...grid.cols {
for x in 0...gridSize.cols {
var row = [Cell]()
for y in 0...grid.rows {
let newCell = Cell(x: CGFloat(x) * cellSize.width, y: CGFloat(grid.rows - y - 1) * cellSize.height, size: CGSize(width: cellSize.width, height: cellSize.height))
for y in 0...gridSize.rows {
let newCell = Cell(x: CGFloat(x) * cellSize.width, y: CGFloat(gridSize.rows - y - 1) * cellSize.height, size: CGSize(width: cellSize.width, height: cellSize.height))
row.append(newCell)
}
cells.append(row)
Expand Down
2 changes: 1 addition & 1 deletion iBrogue_iPad/PlatformCode/SKViewPort.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SKViewPort: SKView {
rogueScene.scaleMode = .fill
super.init(coder: aDecoder)

// showsFPS = true
// showsFPS = true
// showsNodeCount = true
ignoresSiblingOrder = true
}
Expand Down
2 changes: 1 addition & 1 deletion iBrogue_iPad/iBrogue_iPad-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.5</string>
<string>1.3.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down