diff --git a/game/game_area_interface.h b/game/game_area_interface.h index 2a549af..f75270f 100644 --- a/game/game_area_interface.h +++ b/game/game_area_interface.h @@ -12,6 +12,8 @@ public: virtual void Draw() { } virtual void Update(cardinal) { } virtual void OnTapUp(vec2) { } + virtual void OnTapUpAfterMove(vec2) { } + virtual void OnTapDown(vec2) { } virtual void OnFling(vec2) { } virtual void OnScroll(vec2) { } diff --git a/game/main_code.cpp b/game/main_code.cpp index 9fc5c4f..0540ccb 100644 --- a/game/main_code.cpp +++ b/game/main_code.cpp @@ -11,12 +11,13 @@ #include "main_code.h" -boost::signal OnTapUpSignal; -boost::signal OnTapDownSignal; -boost::signal OnFlingSignal; -boost::signal OnScrollSignal; +boost::signals2::signal OnTapUpSignal; +boost::signals2::signal OnTapUpAfterMoveSignal; +boost::signals2::signal OnTapDownSignal; +boost::signals2::signal OnFlingSignal; +boost::signals2::signal OnScrollSignal; -boost::signal OnDrawSignal; +boost::signals2::signal OnDrawSignal; const std::string CONST_BLOCK_TEXTURE1 = "block1"; @@ -109,6 +110,9 @@ void TAndroidApplication::InnerDeinit() OnTapUpSignal.disconnect(boost::bind(&TGameLevel::OnTapUp, boost::ref(GameLevel), _1)); OnTapUpSignal.disconnect(boost::bind(&TGameMenu::OnTapUp, boost::ref(Menu), _1)); + OnTapUpAfterMoveSignal.disconnect(boost::bind(&TGameMenu::OnTapUpAfterMove, boost::ref(Menu), _1)); + + OnFlingSignal.disconnect(boost::bind(&TGameLevel::OnFling, boost::ref(GameLevel), _1)); OnFlingSignal.disconnect(boost::bind(&TGameMenu::OnFling, boost::ref(Menu), _1)); @@ -136,6 +140,11 @@ void TAndroidApplication::InnerOnTapUp(vec2 p) { OnTapUpSignal(vec2(p.v[0], p.v[1])); } + +void TAndroidApplication::InnerOnTapUpAfterMove(vec2 p) +{ + OnTapUpAfterMoveSignal(vec2(p.v[0], p.v[1])); +} void TAndroidApplication::InnerOnMove(vec2 shift) { @@ -151,6 +160,7 @@ void TAndroidApplication::ApplySignalsToMenu() { OnTapUpSignal.connect(boost::bind(&TGameMenu::OnTapUp, boost::ref(Menu), _1)); + OnTapUpAfterMoveSignal.connect(boost::bind(&TGameMenu::OnTapUpAfterMove, boost::ref(Menu), _1)); OnFlingSignal.connect(boost::bind(&TGameMenu::OnFling, boost::ref(Menu), _1)); OnScrollSignal.connect(boost::bind(&TGameMenu::OnScroll, boost::ref(Menu), _1)); OnTapDownSignal.connect(boost::bind(&TGameMenu::OnTapDown, boost::ref(Menu), _1)); @@ -161,6 +171,7 @@ void TAndroidApplication::ApplySignalsToMenu() void TAndroidApplication::DisapplySignalsToMenu() { OnTapUpSignal.disconnect(boost::bind(&TGameMenu::OnTapUp, boost::ref(Menu), _1)); + OnTapUpAfterMoveSignal.disconnect(boost::bind(&TGameMenu::OnTapUpAfterMove, boost::ref(Menu), _1)); OnFlingSignal.disconnect(boost::bind(&TGameMenu::OnFling, boost::ref(Menu), _1)); OnScrollSignal.disconnect(boost::bind(&TGameMenu::OnScroll, boost::ref(Menu), _1)); OnTapDownSignal.disconnect(boost::bind(&TGameMenu::OnTapDown, boost::ref(Menu), _1)); diff --git a/game/main_code.h b/game/main_code.h index 1df873e..144b51d 100644 --- a/game/main_code.h +++ b/game/main_code.h @@ -22,7 +22,7 @@ #include "include/Engine.h" -#include "boost/signal.hpp"//Signal must be included after asio +#include "boost/signals2.hpp"//Signal must be included after asio #include "gamecode.h" #include "menucode.h" @@ -32,12 +32,14 @@ using namespace SE; -extern boost::signal OnTapUpSignal; -extern boost::signal OnTapDownSignal; -extern boost::signal OnFlingSignal; -extern boost::signal OnScrollSignal; +extern boost::signals2::signal OnTapUpSignal; +extern boost::signals2::signal OnTapUpAfterMoveSignal; -extern boost::signal OnDrawSignal; +extern boost::signals2::signal OnTapDownSignal; +extern boost::signals2::signal OnFlingSignal; +extern boost::signals2::signal OnScrollSignal; + +extern boost::signals2::signal OnDrawSignal; extern const std::string CONST_BLOCK_TEXTURE1; extern const std::string CONST_BLOCK_TEXTURE2; @@ -138,6 +140,8 @@ public: virtual void InnerOnTapDown(vec2 p); virtual void InnerOnTapUp(vec2 p); + + virtual void InnerOnTapUpAfterMove(vec2 p); virtual void InnerOnMove(vec2 shift); diff --git a/game/menucode.cpp b/game/menucode.cpp index 7225427..da41f9b 100644 --- a/game/menucode.cpp +++ b/game/menucode.cpp @@ -133,6 +133,8 @@ void TGameMenu::Update(cardinal dt) void TGameMenu::OnTapDown(vec2 pos) { + HoldToTap = true; + if (pos.v[1]<64.f && pos.v[0]>=265.f-128.f && pos.v[0]<=265.f+128.f) { Application->GoFromMenuToCredits(); @@ -176,6 +178,11 @@ void TGameMenu::OnTapUp(vec2 pos) } } +void TGameMenu::OnTapUpAfterMove(vec2 pos) +{ + HoldToTap = false; +} + void TGameMenu::OnFling(vec2 slideSpeed) { diff --git a/game/menucode.h b/game/menucode.h index 0d3d355..0302212 100644 --- a/game/menucode.h +++ b/game/menucode.h @@ -26,6 +26,7 @@ public: virtual void Update(cardinal dt); virtual void OnTapDown(vec2 pos); virtual void OnTapUp(vec2 pos); + virtual void OnTapUpAfterMove(vec2 pos); virtual void OnFling(vec2 slideSpeed); virtual void OnScroll(vec2 shift); diff --git a/proj.ios/CustomGLKView.swift b/proj.ios/CustomGLKView.swift index 248944c..c1e2263 100644 --- a/proj.ios/CustomGLKView.swift +++ b/proj.ios/CustomGLKView.swift @@ -88,14 +88,14 @@ class GLKViewTemplate: GLKView { 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)!!!!") + //print("location is:\(location)!!!!") } } override func touchesEnded(_ 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) - print("location is:\(location)!!!!") + //print("location is:\(location)!!!!") guard let n = touchDict[touch]?.number else { return diff --git a/proj.ios/salmontemplate.xcodeproj/project.pbxproj b/proj.ios/Double Hit Balls.xcodeproj/project.pbxproj similarity index 95% rename from proj.ios/salmontemplate.xcodeproj/project.pbxproj rename to proj.ios/Double Hit Balls.xcodeproj/project.pbxproj index 4b151b8..eda4107 100755 --- a/proj.ios/salmontemplate.xcodeproj/project.pbxproj +++ b/proj.ios/Double Hit Balls.xcodeproj/project.pbxproj @@ -68,7 +68,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 4C49B2B915B0991B003512CD /* salmontemplate.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = salmontemplate.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 4C49B2B915B0991B003512CD /* Double Hit Balls.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Double Hit Balls.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 4C49B2BD15B0991B003512CD /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 4C49B2BF15B0991B003512CD /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 4C49B2C115B0991B003512CD /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; @@ -145,7 +145,7 @@ 4C49B2BA15B0991B003512CD /* Products */ = { isa = PBXGroup; children = ( - 4C49B2B915B0991B003512CD /* salmontemplate.app */, + 4C49B2B915B0991B003512CD /* Double Hit Balls.app */, ); name = Products; sourceTree = ""; @@ -249,9 +249,9 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 4C49B2B815B0991B003512CD /* salmontemplate */ = { + 4C49B2B815B0991B003512CD /* Double Hit Balls */ = { isa = PBXNativeTarget; - buildConfigurationList = 4C49B2E215B0991B003512CD /* Build configuration list for PBXNativeTarget "salmontemplate" */; + buildConfigurationList = 4C49B2E215B0991B003512CD /* Build configuration list for PBXNativeTarget "Double Hit Balls" */; buildPhases = ( 4C49B2B515B0991B003512CD /* Sources */, 4C49B2B715B0991B003512CD /* Resources */, @@ -263,9 +263,9 @@ 84D0FEC81E274E3F00EC3FE5 /* PBXTargetDependency */, 84D0FEC01E274DF700EC3FE5 /* PBXTargetDependency */, ); - name = salmontemplate; + name = "Double Hit Balls"; productName = doublehitballs; - productReference = 4C49B2B915B0991B003512CD /* salmontemplate.app */; + productReference = 4C49B2B915B0991B003512CD /* Double Hit Balls.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -277,12 +277,13 @@ LastUpgradeCheck = 0800; TargetAttributes = { 4C49B2B815B0991B003512CD = { - DevelopmentTeam = R89DR83966; + DevelopmentTeam = ALBGHC3Q4Z; LastSwiftMigration = 0820; + ProvisioningStyle = Manual; }; }; }; - buildConfigurationList = 4C49B2B315B0991B003512CD /* Build configuration list for PBXProject "salmontemplate" */; + buildConfigurationList = 4C49B2B315B0991B003512CD /* Build configuration list for PBXProject "Double Hit Balls" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; @@ -304,7 +305,7 @@ ); projectRoot = ""; targets = ( - 4C49B2B815B0991B003512CD /* salmontemplate */, + 4C49B2B815B0991B003512CD /* Double Hit Balls */, ); }; /* End PBXProject section */ @@ -496,7 +497,8 @@ CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; - DEVELOPMENT_TEAM = R89DR83966; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEVELOPMENT_TEAM = ALBGHC3Q4Z; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "template-Prefix.pch"; @@ -522,13 +524,16 @@ INFOPLIST_FILE = "template-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = fishrungames.doublehitballs; + PRODUCT_MODULE_NAME = doublehitballs; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = "050564d3-7073-4ca0-a471-06a062ff337c"; + PROVISIONING_PROFILE_SPECIFIER = "Double Hit Balls Development Profile 2017-02-26"; SWIFT_OBJC_BRIDGING_HEADER = "salmontemplate-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 3.0; SYMROOT = build; TARGETED_DEVICE_FAMILY = 1; - VALID_ARCHS = "arm64 armv7 armv7s i386 x86_64"; + VALID_ARCHS = "arm64 armv7 armv7s"; WRAPPER_EXTENSION = app; }; name = Debug; @@ -539,7 +544,8 @@ CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; - DEVELOPMENT_TEAM = R89DR83966; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEVELOPMENT_TEAM = ""; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "template-Prefix.pch"; @@ -564,11 +570,13 @@ INFOPLIST_FILE = "template-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = fishrungames.doublehitballs; + PRODUCT_MODULE_NAME = doublehitballs; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; SWIFT_OBJC_BRIDGING_HEADER = "salmontemplate-Bridging-Header.h"; SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 1; - VALID_ARCHS = "arm64 armv7 armv7s i386 x86_64"; + VALID_ARCHS = "arm64 armv7 armv7s"; WRAPPER_EXTENSION = app; }; name = Release; @@ -576,7 +584,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 4C49B2B315B0991B003512CD /* Build configuration list for PBXProject "salmontemplate" */ = { + 4C49B2B315B0991B003512CD /* Build configuration list for PBXProject "Double Hit Balls" */ = { isa = XCConfigurationList; buildConfigurations = ( 4C49B2E015B0991B003512CD /* Debug */, @@ -585,7 +593,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 4C49B2E215B0991B003512CD /* Build configuration list for PBXNativeTarget "salmontemplate" */ = { + 4C49B2E215B0991B003512CD /* Build configuration list for PBXNativeTarget "Double Hit Balls" */ = { isa = XCConfigurationList; buildConfigurations = ( 4C49B2E315B0991B003512CD /* Debug */, diff --git a/proj.ios/SENamespaceWrapper.cpp b/proj.ios/SENamespaceWrapper.cpp index d16ac9d..8383667 100644 --- a/proj.ios/SENamespaceWrapper.cpp +++ b/proj.ios/SENamespaceWrapper.cpp @@ -18,6 +18,11 @@ namespace SE { void OnKeyboardHide(); } +void SE_SetBindDrawableFunc(void(*funcPtr)()) +{ + SE::SetBindDrawableFunc(funcPtr); +} + //TApplication *app = NULL; void SE_AppDeinit() { SE::AppDeinit(); diff --git a/proj.ios/SENamespaceWrapper.h b/proj.ios/SENamespaceWrapper.h index 8490729..c5b99f7 100644 --- a/proj.ios/SENamespaceWrapper.h +++ b/proj.ios/SENamespaceWrapper.h @@ -9,12 +9,14 @@ #ifndef SENamespace_h #define SENamespace_h + #ifdef __cplusplus extern "C" { #endif //void SE_CreateEngine(); //void SE_DestroyEngine(); //TApplication *app = NULL; + void SE_SetBindDrawableFunc(void(*funcPtr)()); void SE_AppDeinit(); void SE_AppUpdate(int dt); void SE_AppDraw(); diff --git a/proj.ios/ViewController.swift b/proj.ios/ViewController.swift index 3d39c86..1fa9452 100644 --- a/proj.ios/ViewController.swift +++ b/proj.ios/ViewController.swift @@ -9,6 +9,9 @@ import UIKit import GLKit + +var defaultView: GLKView? = nil + class ViewControllerTemplate: GLKViewController, UITextFieldDelegate { public var hiddenTextField: UITextField? @@ -28,7 +31,12 @@ class ViewControllerTemplate: GLKViewController, UITextFieldDelegate { view.context = self.context! view.drawableDepthFormat = .format24 - //defaultView = view + self.preferredFramesPerSecond = 60 + + defaultView = view + SE_SetBindDrawableFunc({ + defaultView?.bindDrawable() + }); setupGL() diff --git a/proj.ios/template-Info.plist b/proj.ios/template-Info.plist index 2f9b20a..3f8a6b7 100755 --- a/proj.ios/template-Info.plist +++ b/proj.ios/template-Info.plist @@ -19,11 +19,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0 + 1.1 CFBundleSignature ???? CFBundleVersion - 1.0 + 1.1 LSRequiresIPhoneOS UILaunchImageFile