working with Double Hit Balls

This commit is contained in:
Vladislav Khorev 2017-02-27 02:07:37 +03:00
parent 51968df11c
commit 792d9bb356
11 changed files with 79 additions and 31 deletions

View File

@ -12,6 +12,8 @@ public:
virtual void Draw() { } virtual void Draw() { }
virtual void Update(cardinal) { } virtual void Update(cardinal) { }
virtual void OnTapUp(vec2) { } virtual void OnTapUp(vec2) { }
virtual void OnTapUpAfterMove(vec2) { }
virtual void OnTapDown(vec2) { } virtual void OnTapDown(vec2) { }
virtual void OnFling(vec2) { } virtual void OnFling(vec2) { }
virtual void OnScroll(vec2) { } virtual void OnScroll(vec2) { }

View File

@ -11,12 +11,13 @@
#include "main_code.h" #include "main_code.h"
boost::signal<void (vec2)> OnTapUpSignal; boost::signals2::signal<void (vec2)> OnTapUpSignal;
boost::signal<void (vec2)> OnTapDownSignal; boost::signals2::signal<void (vec2)> OnTapUpAfterMoveSignal;
boost::signal<void (vec2)> OnFlingSignal; boost::signals2::signal<void (vec2)> OnTapDownSignal;
boost::signal<void (vec2)> OnScrollSignal; boost::signals2::signal<void (vec2)> OnFlingSignal;
boost::signals2::signal<void (vec2)> OnScrollSignal;
boost::signal<void ()> OnDrawSignal; boost::signals2::signal<void ()> OnDrawSignal;
const std::string CONST_BLOCK_TEXTURE1 = "block1"; 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(&TGameLevel::OnTapUp, boost::ref(GameLevel), _1));
OnTapUpSignal.disconnect(boost::bind(&TGameMenu::OnTapUp, boost::ref(Menu), _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(&TGameLevel::OnFling, boost::ref(GameLevel), _1));
OnFlingSignal.disconnect(boost::bind(&TGameMenu::OnFling, boost::ref(Menu), _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])); 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) void TAndroidApplication::InnerOnMove(vec2 shift)
{ {
@ -151,6 +160,7 @@ void TAndroidApplication::ApplySignalsToMenu()
{ {
OnTapUpSignal.connect(boost::bind(&TGameMenu::OnTapUp, boost::ref(Menu), _1)); 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)); OnFlingSignal.connect(boost::bind(&TGameMenu::OnFling, boost::ref(Menu), _1));
OnScrollSignal.connect(boost::bind(&TGameMenu::OnScroll, boost::ref(Menu), _1)); OnScrollSignal.connect(boost::bind(&TGameMenu::OnScroll, boost::ref(Menu), _1));
OnTapDownSignal.connect(boost::bind(&TGameMenu::OnTapDown, boost::ref(Menu), _1)); OnTapDownSignal.connect(boost::bind(&TGameMenu::OnTapDown, boost::ref(Menu), _1));
@ -161,6 +171,7 @@ void TAndroidApplication::ApplySignalsToMenu()
void TAndroidApplication::DisapplySignalsToMenu() void TAndroidApplication::DisapplySignalsToMenu()
{ {
OnTapUpSignal.disconnect(boost::bind(&TGameMenu::OnTapUp, boost::ref(Menu), _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(&TGameMenu::OnFling, boost::ref(Menu), _1)); OnFlingSignal.disconnect(boost::bind(&TGameMenu::OnFling, boost::ref(Menu), _1));
OnScrollSignal.disconnect(boost::bind(&TGameMenu::OnScroll, boost::ref(Menu), _1)); OnScrollSignal.disconnect(boost::bind(&TGameMenu::OnScroll, boost::ref(Menu), _1));
OnTapDownSignal.disconnect(boost::bind(&TGameMenu::OnTapDown, boost::ref(Menu), _1)); OnTapDownSignal.disconnect(boost::bind(&TGameMenu::OnTapDown, boost::ref(Menu), _1));

View File

@ -22,7 +22,7 @@
#include "include/Engine.h" #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 "gamecode.h"
#include "menucode.h" #include "menucode.h"
@ -32,12 +32,14 @@
using namespace SE; using namespace SE;
extern boost::signal<void (vec2)> OnTapUpSignal; extern boost::signals2::signal<void (vec2)> OnTapUpSignal;
extern boost::signal<void (vec2)> OnTapDownSignal; extern boost::signals2::signal<void (vec2)> OnTapUpAfterMoveSignal;
extern boost::signal<void (vec2)> OnFlingSignal;
extern boost::signal<void (vec2)> OnScrollSignal;
extern boost::signal<void ()> OnDrawSignal; extern boost::signals2::signal<void (vec2)> OnTapDownSignal;
extern boost::signals2::signal<void (vec2)> OnFlingSignal;
extern boost::signals2::signal<void (vec2)> OnScrollSignal;
extern boost::signals2::signal<void ()> OnDrawSignal;
extern const std::string CONST_BLOCK_TEXTURE1; extern const std::string CONST_BLOCK_TEXTURE1;
extern const std::string CONST_BLOCK_TEXTURE2; extern const std::string CONST_BLOCK_TEXTURE2;
@ -138,6 +140,8 @@ public:
virtual void InnerOnTapDown(vec2 p); virtual void InnerOnTapDown(vec2 p);
virtual void InnerOnTapUp(vec2 p); virtual void InnerOnTapUp(vec2 p);
virtual void InnerOnTapUpAfterMove(vec2 p);
virtual void InnerOnMove(vec2 shift); virtual void InnerOnMove(vec2 shift);

View File

@ -133,6 +133,8 @@ void TGameMenu::Update(cardinal dt)
void TGameMenu::OnTapDown(vec2 pos) 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) if (pos.v[1]<64.f && pos.v[0]>=265.f-128.f && pos.v[0]<=265.f+128.f)
{ {
Application->GoFromMenuToCredits(); Application->GoFromMenuToCredits();
@ -176,6 +178,11 @@ void TGameMenu::OnTapUp(vec2 pos)
} }
} }
void TGameMenu::OnTapUpAfterMove(vec2 pos)
{
HoldToTap = false;
}
void TGameMenu::OnFling(vec2 slideSpeed) void TGameMenu::OnFling(vec2 slideSpeed)
{ {

View File

@ -26,6 +26,7 @@ public:
virtual void Update(cardinal dt); virtual void Update(cardinal dt);
virtual void OnTapDown(vec2 pos); virtual void OnTapDown(vec2 pos);
virtual void OnTapUp(vec2 pos); virtual void OnTapUp(vec2 pos);
virtual void OnTapUpAfterMove(vec2 pos);
virtual void OnFling(vec2 slideSpeed); virtual void OnFling(vec2 slideSpeed);
virtual void OnScroll(vec2 shift); virtual void OnScroll(vec2 shift);

View File

@ -88,14 +88,14 @@ class GLKViewTemplate: GLKView {
let number = Int32(n) let number = Int32(n)
SE_AppOnScroll(Int32(Float(prevLocation.x) - Float(location.x)), -Int32(Float(prevLocation.y) - Float(location.y)), number) 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<UITouch>, with event: UIEvent?) { override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
for touch in touches { for touch in touches {
let location = CGPoint(x: touch.location(in: self).x * xCoef, y: touch.location(in: self).y * yCoef) 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 { guard let n = touchDict[touch]?.number else {
return return

View File

@ -68,7 +68,7 @@
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference 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; }; 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; }; 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; }; 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 */ = { 4C49B2BA15B0991B003512CD /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
4C49B2B915B0991B003512CD /* salmontemplate.app */, 4C49B2B915B0991B003512CD /* Double Hit Balls.app */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
@ -249,9 +249,9 @@
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
4C49B2B815B0991B003512CD /* salmontemplate */ = { 4C49B2B815B0991B003512CD /* Double Hit Balls */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 4C49B2E215B0991B003512CD /* Build configuration list for PBXNativeTarget "salmontemplate" */; buildConfigurationList = 4C49B2E215B0991B003512CD /* Build configuration list for PBXNativeTarget "Double Hit Balls" */;
buildPhases = ( buildPhases = (
4C49B2B515B0991B003512CD /* Sources */, 4C49B2B515B0991B003512CD /* Sources */,
4C49B2B715B0991B003512CD /* Resources */, 4C49B2B715B0991B003512CD /* Resources */,
@ -263,9 +263,9 @@
84D0FEC81E274E3F00EC3FE5 /* PBXTargetDependency */, 84D0FEC81E274E3F00EC3FE5 /* PBXTargetDependency */,
84D0FEC01E274DF700EC3FE5 /* PBXTargetDependency */, 84D0FEC01E274DF700EC3FE5 /* PBXTargetDependency */,
); );
name = salmontemplate; name = "Double Hit Balls";
productName = doublehitballs; productName = doublehitballs;
productReference = 4C49B2B915B0991B003512CD /* salmontemplate.app */; productReference = 4C49B2B915B0991B003512CD /* Double Hit Balls.app */;
productType = "com.apple.product-type.application"; productType = "com.apple.product-type.application";
}; };
/* End PBXNativeTarget section */ /* End PBXNativeTarget section */
@ -277,12 +277,13 @@
LastUpgradeCheck = 0800; LastUpgradeCheck = 0800;
TargetAttributes = { TargetAttributes = {
4C49B2B815B0991B003512CD = { 4C49B2B815B0991B003512CD = {
DevelopmentTeam = R89DR83966; DevelopmentTeam = ALBGHC3Q4Z;
LastSwiftMigration = 0820; 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"; compatibilityVersion = "Xcode 3.2";
developmentRegion = English; developmentRegion = English;
hasScannedForEncodings = 0; hasScannedForEncodings = 0;
@ -304,7 +305,7 @@
); );
projectRoot = ""; projectRoot = "";
targets = ( targets = (
4C49B2B815B0991B003512CD /* salmontemplate */, 4C49B2B815B0991B003512CD /* Double Hit Balls */,
); );
}; };
/* End PBXProject section */ /* End PBXProject section */
@ -496,7 +497,8 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = R89DR83966; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = ALBGHC3Q4Z;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "template-Prefix.pch"; GCC_PREFIX_HEADER = "template-Prefix.pch";
@ -522,13 +524,16 @@
INFOPLIST_FILE = "template-Info.plist"; INFOPLIST_FILE = "template-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = fishrungames.doublehitballs; PRODUCT_BUNDLE_IDENTIFIER = fishrungames.doublehitballs;
PRODUCT_MODULE_NAME = doublehitballs;
PRODUCT_NAME = "$(TARGET_NAME)"; 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_OBJC_BRIDGING_HEADER = "salmontemplate-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0; SWIFT_VERSION = 3.0;
SYMROOT = build; SYMROOT = build;
TARGETED_DEVICE_FAMILY = 1; TARGETED_DEVICE_FAMILY = 1;
VALID_ARCHS = "arm64 armv7 armv7s i386 x86_64"; VALID_ARCHS = "arm64 armv7 armv7s";
WRAPPER_EXTENSION = app; WRAPPER_EXTENSION = app;
}; };
name = Debug; name = Debug;
@ -539,7 +544,8 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = R89DR83966; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = "";
GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "template-Prefix.pch"; GCC_PREFIX_HEADER = "template-Prefix.pch";
@ -564,11 +570,13 @@
INFOPLIST_FILE = "template-Info.plist"; INFOPLIST_FILE = "template-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = fishrungames.doublehitballs; PRODUCT_BUNDLE_IDENTIFIER = fishrungames.doublehitballs;
PRODUCT_MODULE_NAME = doublehitballs;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "salmontemplate-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "salmontemplate-Bridging-Header.h";
SWIFT_VERSION = 3.0; SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 1; TARGETED_DEVICE_FAMILY = 1;
VALID_ARCHS = "arm64 armv7 armv7s i386 x86_64"; VALID_ARCHS = "arm64 armv7 armv7s";
WRAPPER_EXTENSION = app; WRAPPER_EXTENSION = app;
}; };
name = Release; name = Release;
@ -576,7 +584,7 @@
/* End XCBuildConfiguration section */ /* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */ /* Begin XCConfigurationList section */
4C49B2B315B0991B003512CD /* Build configuration list for PBXProject "salmontemplate" */ = { 4C49B2B315B0991B003512CD /* Build configuration list for PBXProject "Double Hit Balls" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
4C49B2E015B0991B003512CD /* Debug */, 4C49B2E015B0991B003512CD /* Debug */,
@ -585,7 +593,7 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
4C49B2E215B0991B003512CD /* Build configuration list for PBXNativeTarget "salmontemplate" */ = { 4C49B2E215B0991B003512CD /* Build configuration list for PBXNativeTarget "Double Hit Balls" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
4C49B2E315B0991B003512CD /* Debug */, 4C49B2E315B0991B003512CD /* Debug */,

View File

@ -18,6 +18,11 @@ namespace SE {
void OnKeyboardHide(); void OnKeyboardHide();
} }
void SE_SetBindDrawableFunc(void(*funcPtr)())
{
SE::SetBindDrawableFunc(funcPtr);
}
//TApplication *app = NULL; //TApplication *app = NULL;
void SE_AppDeinit() { void SE_AppDeinit() {
SE::AppDeinit(); SE::AppDeinit();

View File

@ -9,12 +9,14 @@
#ifndef SENamespace_h #ifndef SENamespace_h
#define SENamespace_h #define SENamespace_h
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
//void SE_CreateEngine(); //void SE_CreateEngine();
//void SE_DestroyEngine(); //void SE_DestroyEngine();
//TApplication *app = NULL; //TApplication *app = NULL;
void SE_SetBindDrawableFunc(void(*funcPtr)());
void SE_AppDeinit(); void SE_AppDeinit();
void SE_AppUpdate(int dt); void SE_AppUpdate(int dt);
void SE_AppDraw(); void SE_AppDraw();

View File

@ -9,6 +9,9 @@
import UIKit import UIKit
import GLKit import GLKit
var defaultView: GLKView? = nil
class ViewControllerTemplate: GLKViewController, UITextFieldDelegate { class ViewControllerTemplate: GLKViewController, UITextFieldDelegate {
public var hiddenTextField: UITextField? public var hiddenTextField: UITextField?
@ -28,7 +31,12 @@ class ViewControllerTemplate: GLKViewController, UITextFieldDelegate {
view.context = self.context! view.context = self.context!
view.drawableDepthFormat = .format24 view.drawableDepthFormat = .format24
//defaultView = view self.preferredFramesPerSecond = 60
defaultView = view
SE_SetBindDrawableFunc({
defaultView?.bindDrawable()
});
setupGL() setupGL()

View File

@ -19,11 +19,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0</string> <string>1.1</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.0</string> <string>1.1</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>UILaunchImageFile</key> <key>UILaunchImageFile</key>