diff --git a/proj.ios/CustomGLKView.h b/proj.ios/CustomGLKView.h deleted file mode 100755 index 77acd11..0000000 --- a/proj.ios/CustomGLKView.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// CustomGLKView.h -// doublehitballs -// -// Created by vvv ооо on 15.07.12. -// Copyright (c) 2012 __MyCompanyName__. All rights reserved. -// - -#import "include/Utils/IosApi/ObjC/GLKViewTemplate.h" - -@interface CustomGLKView : GLKViewTemplate - -@end diff --git a/proj.ios/CustomGLKView.mm b/proj.ios/CustomGLKView.mm deleted file mode 100755 index 5b9214c..0000000 --- a/proj.ios/CustomGLKView.mm +++ /dev/null @@ -1,5 +0,0 @@ -#import "CustomGLKView.h" - -@implementation CustomGLKView - -@end \ No newline at end of file diff --git a/proj.ios/CustomGLKView.swift b/proj.ios/CustomGLKView.swift index c071e34..248944c 100644 --- a/proj.ios/CustomGLKView.swift +++ b/proj.ios/CustomGLKView.swift @@ -10,15 +10,16 @@ import Foundation import GLKit struct TTouchHashData { - var first: CGPoint! - var second: Bool! - var number: Int! + var first: CGPoint? + var second: Bool? + var number: Int? } - - class GLKViewTemplate: GLKView { + let xCoef: CGFloat = 480 / UIScreen.main.bounds.size.width + let yCoef: CGFloat = 320 / UIScreen.main.bounds.size.height + var touchDict: [UITouch: TTouchHashData] = [:] override init(frame: CGRect) { @@ -59,28 +60,53 @@ class GLKViewTemplate: GLKView { override func touchesBegan(_ touches: Set, with event: UIEvent?) { for touch in touches { - let location = touch.location(in: self) - let prevLocation = touch.previousLocation(in: self) + let location = CGPoint(x: touch.location(in: self).x * xCoef, y: touch.location(in: self).y * yCoef) + addTouchToHash(touch: touch) - if abs(touchDict[touch]!.first!.x - location.x) > 10 || abs(touchDict[touch]!.first!.y - location.y) > 10 { + guard let n = touchDict[touch]?.number else { + return + } + + let number = Int32(n) + print(bounds.size.height * yCoef - location.y) + SE_AppOnTapDown(Int32(location.x), Int32(bounds.size.height * yCoef - location.y), number) + } + } + + override func touchesMoved(_ touches: Set, with event: UIEvent?) { + for touch in touches { + let location = CGPoint(x: touch.location(in: self).x * xCoef, y: touch.location(in: self).y * yCoef) + let prevLocation = CGPoint(x: touch.previousLocation(in: self).x * xCoef, y: touch.previousLocation(in: self).y * yCoef) + + guard let x = touchDict[touch]?.first?.x, let y = touchDict[touch]?.first?.y, let n = touchDict[touch]?.number else { + return + } + if abs(x - location.x) > 10 || abs(y - location.y) > 10 { touchDict[touch]?.second = true } - let number = Int32(touchDict[touch]!.number) + let number = Int32(n) SE_AppOnScroll(Int32(Float(prevLocation.x) - Float(location.x)), -Int32(Float(prevLocation.y) - Float(location.y)), number) + print("location is:\(location)!!!!") } } override func touchesEnded(_ touches: Set, with event: UIEvent?) { for touch in touches { - let location = touch.location(in: self) - let number = Int32(touchDict[touch]!.number) + let location = CGPoint(x: touch.location(in: self).x * xCoef, y: touch.location(in: self).y * yCoef) + print("location is:\(location)!!!!") + + guard let n = touchDict[touch]?.number else { + return + } + + let number = Int32(n) if touchDict[touch]!.second == true { - SE_AppOnTapUpAfterMove(Int32(location.x), Int32(bounds.size.height - location.y), number) + SE_AppOnTapUpAfterMove(Int32(location.x), Int32(bounds.size.height * yCoef - location.y), number) } else { - SE_AppOnTapUp(Int32(location.x), Int32(bounds.size.height - location.y), number) + SE_AppOnTapUp(Int32(location.x), Int32(bounds.size.height * yCoef - location.y), number) } touchDict.removeValue(forKey: touch) } @@ -93,3 +119,9 @@ class GLKViewTemplate: GLKView { } } + +class CustomGLKView: GLKViewTemplate { + required init?(coder aDecoder: NSCoder) { + super.init(frame: UIScreen.main.bounds) + } +} diff --git a/proj.ios/LaunchScreen.storyboard b/proj.ios/LaunchScreen.storyboard new file mode 100644 index 0000000..5a6523e --- /dev/null +++ b/proj.ios/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/proj.ios/en.lproj/ViewController_iPad.xib b/proj.ios/en.lproj/ViewController_iPad.xib index eb81e88..8f94e41 100755 --- a/proj.ios/en.lproj/ViewController_iPad.xib +++ b/proj.ios/en.lproj/ViewController_iPad.xib @@ -1,133 +1,29 @@ - - - - 1296 - 11E53 - 2182 - 1138.47 - 569.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 1181 - - - IBProxyObject - IBUIView - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 274 - {{0, 20}, {768, 1004}} - - - - 3 - MQA - - 2 - - - - 2 - - IBIPadFramework - - - - - - - view - - - - 3 - - - - - - 0 - - - - - - 1 - - - - - -1 - - - File's Owner - - - -2 - - - - - - - ViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - CustomGLKView - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - - 3 - - - - - CustomGLKView - GLKView - - IBProjectSource - ./Classes/CustomGLKView.h - - - - ViewController - GLKViewController - - IBProjectSource - ./Classes/ViewController.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - YES - 3 - 1181 - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/proj.ios/en.lproj/ViewController_iPhone.xib b/proj.ios/en.lproj/ViewController_iPhone.xib index 96a4a92..a6e33b1 100755 --- a/proj.ios/en.lproj/ViewController_iPhone.xib +++ b/proj.ios/en.lproj/ViewController_iPhone.xib @@ -1,111 +1,31 @@ - - - - 1296 - 11E53 - 2182 - 1138.47 - 569.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 1181 - - - IBProxyObject - IBUIView - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - {320, 460} - - - 3 - MQA - - 2 - - - NO - IBCocoaTouchFramework - - - - - - - view - - - - 3 - - - - - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - - - - - ViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - CustomGLKView - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - - 4 - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - YES - 3 - 1181 - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/proj.ios/salmontemplate.xcodeproj/project.pbxproj b/proj.ios/salmontemplate.xcodeproj/project.pbxproj index a58d2b9..3b789bb 100755 --- a/proj.ios/salmontemplate.xcodeproj/project.pbxproj +++ b/proj.ios/salmontemplate.xcodeproj/project.pbxproj @@ -21,15 +21,15 @@ 4C77831815BABE26003D5142 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C77831415BABD8B003D5142 /* AudioToolbox.framework */; }; 4C77831915BABE26003D5142 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C77831515BABD8B003D5142 /* OpenAL.framework */; }; 4C7AD44C15B1D77700A599F6 /* ios_api.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7AD44B15B1D77700A599F6 /* ios_api.cpp */; }; - 4CCC0ECC15B30D6B005432FB /* CustomGLKView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4CCC0ECB15B30D6B005432FB /* CustomGLKView.mm */; }; 4CE6A9D215B2F979006A3965 /* assets in Resources */ = {isa = PBXBuildFile; fileRef = 4CE6A9D115B2F979006A3965 /* assets */; }; 74AC9EBD1E2CE407003C9749 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74AC9EBC1E2CE407003C9749 /* ViewController.swift */; }; 74AC9EC11E2CF533003C9749 /* SENamespaceWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 74AC9EBF1E2CF533003C9749 /* SENamespaceWrapper.cpp */; }; - 74C3AE3B1E2E35F9003C07F2 /* main_code.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 74C3AE3A1E2E35F9003C07F2 /* main_code.cpp */; }; + 74CBC8701E2E5D050001871E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 74CBC86F1E2E5D050001871E /* LaunchScreen.storyboard */; }; 74EEBAEF1E2D13A6004C6C65 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74EEBAEE1E2D13A6004C6C65 /* AppDelegate.swift */; }; 74EEBAF11E2D1C7C004C6C65 /* CustomGLKView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74EEBAF01E2D1C7C004C6C65 /* CustomGLKView.swift */; }; 84D0FEBE1E274DDD00EC3FE5 /* libSalmon Engine.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C902A7815C5735700FBC901 /* libSalmon Engine.a */; }; 84D0FEC91E274E4A00EC3FE5 /* libvorbis-tremor-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D0FEC61E274E3700EC3FE5 /* libvorbis-tremor-ios.a */; }; + 84D0FECC1E274EBC00EC3FE5 /* main_code.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84D0FECA1E274EBC00EC3FE5 /* main_code.cpp */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -82,19 +82,18 @@ 4C77831515BABD8B003D5142 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; 4C7AD44B15B1D77700A599F6 /* ios_api.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ios_api.cpp; sourceTree = ""; }; 4C902A7015C5735500FBC901 /* Salmon Engine.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "Salmon Engine.xcodeproj"; path = "../../Engine/iOS/Salmon Engine/Salmon Engine.xcodeproj"; sourceTree = ""; }; - 4CCC0ECA15B30D6A005432FB /* CustomGLKView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomGLKView.h; sourceTree = ""; }; - 4CCC0ECB15B30D6B005432FB /* CustomGLKView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CustomGLKView.mm; sourceTree = ""; }; 4CCC0ECD15B310FB005432FB /* ios_api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ios_api.h; sourceTree = ""; }; 4CE6A9D115B2F979006A3965 /* assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = assets; path = ../assets; sourceTree = ""; }; 74AC9EBB1E2CE407003C9749 /* salmontemplate-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "salmontemplate-Bridging-Header.h"; sourceTree = ""; }; 74AC9EBC1E2CE407003C9749 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 74AC9EBF1E2CF533003C9749 /* SENamespaceWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SENamespaceWrapper.cpp; sourceTree = ""; }; 74AC9EC01E2CF533003C9749 /* SENamespaceWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SENamespaceWrapper.h; sourceTree = ""; }; - 74C3AE3A1E2E35F9003C07F2 /* main_code.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main_code.cpp; path = ../game/main_code.cpp; sourceTree = ""; }; - 74C3AE3C1E2E35FD003C07F2 /* main_code.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = main_code.h; path = ../game/main_code.h; sourceTree = ""; }; + 74CBC86F1E2E5D050001871E /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; 74EEBAEE1E2D13A6004C6C65 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 74EEBAF01E2D1C7C004C6C65 /* CustomGLKView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomGLKView.swift; sourceTree = ""; }; 84D0FEC11E274E3700EC3FE5 /* vorbis-tremor-ios.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "vorbis-tremor-ios.xcodeproj"; path = "../../libs/vorbis-tremor-ios/vorbis-tremor-ios.xcodeproj"; sourceTree = ""; }; + 84D0FECA1E274EBC00EC3FE5 /* main_code.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main_code.cpp; path = ../game/main_code.cpp; sourceTree = ""; }; + 84D0FECB1E274EBC00EC3FE5 /* main_code.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = main_code.h; path = ../game/main_code.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -163,9 +162,8 @@ 74EEBAF01E2D1C7C004C6C65 /* CustomGLKView.swift */, 4C49B2DA15B0991B003512CD /* ViewController_iPhone.xib */, 4C49B2DD15B0991B003512CD /* ViewController_iPad.xib */, + 74CBC86F1E2E5D050001871E /* LaunchScreen.storyboard */, 4C49B2C815B0991B003512CD /* Supporting Files */, - 4CCC0ECA15B30D6A005432FB /* CustomGLKView.h */, - 4CCC0ECB15B30D6B005432FB /* CustomGLKView.mm */, ); name = Sources; sourceTree = ""; @@ -212,8 +210,8 @@ 4CE6A9E315B2F9A4006A3965 /* Game */ = { isa = PBXGroup; children = ( - 74C3AE3A1E2E35F9003C07F2 /* main_code.cpp */, - 74C3AE3C1E2E35FD003C07F2 /* main_code.h */, + 84D0FECA1E274EBC00EC3FE5 /* main_code.cpp */, + 84D0FECB1E274EBC00EC3FE5 /* main_code.h */, ); name = Game; sourceTree = ""; @@ -312,6 +310,7 @@ buildActionMask = 2147483647; files = ( 4C49B2CC15B0991B003512CD /* InfoPlist.strings in Resources */, + 74CBC8701E2E5D050001871E /* LaunchScreen.storyboard in Resources */, 4C49B2DC15B0991B003512CD /* ViewController_iPhone.xib in Resources */, 4C49B2DF15B0991B003512CD /* ViewController_iPad.xib in Resources */, 4CE6A9D215B2F979006A3965 /* assets in Resources */, @@ -329,12 +328,11 @@ buildActionMask = 2147483647; files = ( 74EEBAEF1E2D13A6004C6C65 /* AppDelegate.swift in Sources */, - 74C3AE3B1E2E35F9003C07F2 /* main_code.cpp in Sources */, 74EEBAF11E2D1C7C004C6C65 /* CustomGLKView.swift in Sources */, + 84D0FECC1E274EBC00EC3FE5 /* main_code.cpp in Sources */, 74AC9EBD1E2CE407003C9749 /* ViewController.swift in Sources */, 74AC9EC11E2CF533003C9749 /* SENamespaceWrapper.cpp in Sources */, 4C7AD44C15B1D77700A599F6 /* ios_api.cpp in Sources */, - 4CCC0ECC15B30D6B005432FB /* CustomGLKView.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/proj.ios/template-Info.plist b/proj.ios/template-Info.plist index b45d6f6..bef12fa 100755 --- a/proj.ios/template-Info.plist +++ b/proj.ios/template-Info.plist @@ -28,6 +28,8 @@ UILaunchImageFile Splash-landscape.png + UILaunchStoryboardName + LaunchScreen UIPrerenderedIcon UIRequiredDeviceCapabilities