ios stuff
This commit is contained in:
parent
6c05bac1ac
commit
c96eab18dd
@ -15,7 +15,7 @@
|
|||||||
4C49B2CC15B0991B003512CD /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4C49B2CA15B0991B003512CD /* InfoPlist.strings */; };
|
4C49B2CC15B0991B003512CD /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4C49B2CA15B0991B003512CD /* InfoPlist.strings */; };
|
||||||
4C49B2CE15B0991B003512CD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C49B2CD15B0991B003512CD /* main.m */; };
|
4C49B2CE15B0991B003512CD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C49B2CD15B0991B003512CD /* main.m */; };
|
||||||
4C49B2D215B0991B003512CD /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C49B2D115B0991B003512CD /* AppDelegate.m */; };
|
4C49B2D215B0991B003512CD /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C49B2D115B0991B003512CD /* AppDelegate.m */; };
|
||||||
4C49B2D915B0991B003512CD /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C49B2D815B0991B003512CD /* ViewController.m */; };
|
4C49B2D915B0991B003512CD /* ViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4C49B2D815B0991B003512CD /* ViewController.mm */; };
|
||||||
4C49B2DC15B0991B003512CD /* ViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C49B2DA15B0991B003512CD /* ViewController_iPhone.xib */; };
|
4C49B2DC15B0991B003512CD /* ViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C49B2DA15B0991B003512CD /* ViewController_iPhone.xib */; };
|
||||||
4C49B2DF15B0991B003512CD /* ViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C49B2DD15B0991B003512CD /* ViewController_iPad.xib */; };
|
4C49B2DF15B0991B003512CD /* ViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C49B2DD15B0991B003512CD /* ViewController_iPad.xib */; };
|
||||||
4C4C807515BA8F460037C6CE /* libsquirrel.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C4C807415BA8F460037C6CE /* libsquirrel.a */; };
|
4C4C807515BA8F460037C6CE /* libsquirrel.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C4C807415BA8F460037C6CE /* libsquirrel.a */; };
|
||||||
@ -29,7 +29,7 @@
|
|||||||
4C77831915BABE26003D5142 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C77831515BABD8B003D5142 /* OpenAL.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 */; };
|
4C7AD44C15B1D77700A599F6 /* ios_api.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7AD44B15B1D77700A599F6 /* ios_api.cpp */; };
|
||||||
4C7FBF53165C1CDF008C1538 /* libboost.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C7FBF52165C1CDF008C1538 /* libboost.a */; };
|
4C7FBF53165C1CDF008C1538 /* libboost.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C7FBF52165C1CDF008C1538 /* libboost.a */; };
|
||||||
4CCC0ECC15B30D6B005432FB /* CustomGLKView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCC0ECB15B30D6B005432FB /* CustomGLKView.m */; };
|
4CCC0ECC15B30D6B005432FB /* CustomGLKView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4CCC0ECB15B30D6B005432FB /* CustomGLKView.mm */; };
|
||||||
4CE6A9D215B2F979006A3965 /* assets in Resources */ = {isa = PBXBuildFile; fileRef = 4CE6A9D115B2F979006A3965 /* assets */; };
|
4CE6A9D215B2F979006A3965 /* assets in Resources */ = {isa = PBXBuildFile; fileRef = 4CE6A9D115B2F979006A3965 /* assets */; };
|
||||||
4CE6A9DE15B2F99F006A3965 /* creditscode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE6A9D315B2F99F006A3965 /* creditscode.cpp */; };
|
4CE6A9DE15B2F99F006A3965 /* creditscode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE6A9D315B2F99F006A3965 /* creditscode.cpp */; };
|
||||||
4CE6A9DF15B2F99F006A3965 /* gamecode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE6A9D615B2F99F006A3965 /* gamecode.cpp */; };
|
4CE6A9DF15B2F99F006A3965 /* gamecode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE6A9D615B2F99F006A3965 /* gamecode.cpp */; };
|
||||||
@ -70,7 +70,7 @@
|
|||||||
4C49B2D015B0991B003512CD /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
4C49B2D015B0991B003512CD /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||||
4C49B2D115B0991B003512CD /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
4C49B2D115B0991B003512CD /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
||||||
4C49B2D715B0991B003512CD /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
|
4C49B2D715B0991B003512CD /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
|
||||||
4C49B2D815B0991B003512CD /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
|
4C49B2D815B0991B003512CD /* ViewController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewController.mm; sourceTree = "<group>"; };
|
||||||
4C49B2DB15B0991B003512CD /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPhone.xib; sourceTree = "<group>"; };
|
4C49B2DB15B0991B003512CD /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPhone.xib; sourceTree = "<group>"; };
|
||||||
4C49B2DE15B0991B003512CD /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPad.xib; sourceTree = "<group>"; };
|
4C49B2DE15B0991B003512CD /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPad.xib; sourceTree = "<group>"; };
|
||||||
4C4C807415BA8F460037C6CE /* libsquirrel.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libsquirrel.a; path = "../../libs/SQUIRREL2_1_1_sqplus/build-ios/ios-device/libsquirrel.a"; sourceTree = "<group>"; };
|
4C4C807415BA8F460037C6CE /* libsquirrel.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libsquirrel.a; path = "../../libs/SQUIRREL2_1_1_sqplus/build-ios/ios-device/libsquirrel.a"; sourceTree = "<group>"; };
|
||||||
@ -86,7 +86,7 @@
|
|||||||
4C7C584A15C31E6500CAE4F4 /* libboost.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libboost.a; path = "../../libs/boost_1_47_0/build-ios/ios-simulator/libboost.a"; sourceTree = "<group>"; };
|
4C7C584A15C31E6500CAE4F4 /* libboost.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libboost.a; path = "../../libs/boost_1_47_0/build-ios/ios-simulator/libboost.a"; sourceTree = "<group>"; };
|
||||||
4C7FBF52165C1CDF008C1538 /* libboost.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libboost.a; path = "../../../libs/boost_1_52_0/build-ios/ios-device/libboost.a"; sourceTree = "<group>"; };
|
4C7FBF52165C1CDF008C1538 /* libboost.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libboost.a; path = "../../../libs/boost_1_52_0/build-ios/ios-device/libboost.a"; sourceTree = "<group>"; };
|
||||||
4CCC0ECA15B30D6A005432FB /* CustomGLKView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomGLKView.h; sourceTree = "<group>"; };
|
4CCC0ECA15B30D6A005432FB /* CustomGLKView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomGLKView.h; sourceTree = "<group>"; };
|
||||||
4CCC0ECB15B30D6B005432FB /* CustomGLKView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomGLKView.m; sourceTree = "<group>"; };
|
4CCC0ECB15B30D6B005432FB /* CustomGLKView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CustomGLKView.mm; sourceTree = "<group>"; };
|
||||||
4CCC0ECD15B310FB005432FB /* ios_api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ios_api.h; sourceTree = "<group>"; };
|
4CCC0ECD15B310FB005432FB /* ios_api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ios_api.h; sourceTree = "<group>"; };
|
||||||
4CE6A9D115B2F979006A3965 /* assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = assets; path = ../assets; sourceTree = "<group>"; };
|
4CE6A9D115B2F979006A3965 /* assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = assets; path = ../assets; sourceTree = "<group>"; };
|
||||||
4CE6A9D315B2F99F006A3965 /* creditscode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = creditscode.cpp; path = ../../jni/creditscode.cpp; sourceTree = "<group>"; };
|
4CE6A9D315B2F99F006A3965 /* creditscode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = creditscode.cpp; path = ../../jni/creditscode.cpp; sourceTree = "<group>"; };
|
||||||
@ -171,12 +171,12 @@
|
|||||||
4C49B2D015B0991B003512CD /* AppDelegate.h */,
|
4C49B2D015B0991B003512CD /* AppDelegate.h */,
|
||||||
4C49B2D115B0991B003512CD /* AppDelegate.m */,
|
4C49B2D115B0991B003512CD /* AppDelegate.m */,
|
||||||
4C49B2D715B0991B003512CD /* ViewController.h */,
|
4C49B2D715B0991B003512CD /* ViewController.h */,
|
||||||
4C49B2D815B0991B003512CD /* ViewController.m */,
|
4C49B2D815B0991B003512CD /* ViewController.mm */,
|
||||||
4C49B2DA15B0991B003512CD /* ViewController_iPhone.xib */,
|
4C49B2DA15B0991B003512CD /* ViewController_iPhone.xib */,
|
||||||
4C49B2DD15B0991B003512CD /* ViewController_iPad.xib */,
|
4C49B2DD15B0991B003512CD /* ViewController_iPad.xib */,
|
||||||
4C49B2C815B0991B003512CD /* Supporting Files */,
|
4C49B2C815B0991B003512CD /* Supporting Files */,
|
||||||
4CCC0ECA15B30D6A005432FB /* CustomGLKView.h */,
|
4CCC0ECA15B30D6A005432FB /* CustomGLKView.h */,
|
||||||
4CCC0ECB15B30D6B005432FB /* CustomGLKView.m */,
|
4CCC0ECB15B30D6B005432FB /* CustomGLKView.mm */,
|
||||||
);
|
);
|
||||||
path = doublehitballs;
|
path = doublehitballs;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -327,14 +327,14 @@
|
|||||||
files = (
|
files = (
|
||||||
4C49B2CE15B0991B003512CD /* main.m in Sources */,
|
4C49B2CE15B0991B003512CD /* main.m in Sources */,
|
||||||
4C49B2D215B0991B003512CD /* AppDelegate.m in Sources */,
|
4C49B2D215B0991B003512CD /* AppDelegate.m in Sources */,
|
||||||
4C49B2D915B0991B003512CD /* ViewController.m in Sources */,
|
4C49B2D915B0991B003512CD /* ViewController.mm in Sources */,
|
||||||
4C7AD44C15B1D77700A599F6 /* ios_api.cpp in Sources */,
|
4C7AD44C15B1D77700A599F6 /* ios_api.cpp in Sources */,
|
||||||
4CE6A9DE15B2F99F006A3965 /* creditscode.cpp in Sources */,
|
4CE6A9DE15B2F99F006A3965 /* creditscode.cpp in Sources */,
|
||||||
4CE6A9DF15B2F99F006A3965 /* gamecode.cpp in Sources */,
|
4CE6A9DF15B2F99F006A3965 /* gamecode.cpp in Sources */,
|
||||||
4CE6A9E015B2F99F006A3965 /* loadingcode.cpp in Sources */,
|
4CE6A9E015B2F99F006A3965 /* loadingcode.cpp in Sources */,
|
||||||
4CE6A9E115B2F99F006A3965 /* main_code.cpp in Sources */,
|
4CE6A9E115B2F99F006A3965 /* main_code.cpp in Sources */,
|
||||||
4CE6A9E215B2F99F006A3965 /* menucode.cpp in Sources */,
|
4CE6A9E215B2F99F006A3965 /* menucode.cpp in Sources */,
|
||||||
4CCC0ECC15B30D6B005432FB /* CustomGLKView.m in Sources */,
|
4CCC0ECC15B30D6B005432FB /* CustomGLKView.mm in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -6,12 +6,8 @@
|
|||||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#import <GLKit/GLKit.h>
|
#import "include/Utils/IosApi/ObjC/GLKViewTemplate.h"
|
||||||
|
|
||||||
@interface CustomGLKView : GLKView
|
@interface CustomGLKView : GLKViewTemplate
|
||||||
|
|
||||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
|
|
||||||
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
|
|
||||||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -1,68 +0,0 @@
|
|||||||
//
|
|
||||||
// CustomGLKView.m
|
|
||||||
// doublehitballs
|
|
||||||
//
|
|
||||||
// Created by vvv ооо on 15.07.12.
|
|
||||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "CustomGLKView.h"
|
|
||||||
#import "ios_api.h"
|
|
||||||
|
|
||||||
bool touchMoved = false;
|
|
||||||
CGPoint prev_loc;
|
|
||||||
|
|
||||||
|
|
||||||
@implementation CustomGLKView
|
|
||||||
|
|
||||||
- (id)initWithFrame:(CGRect)frame
|
|
||||||
{
|
|
||||||
self = [super initWithFrame:frame];
|
|
||||||
if (self) {
|
|
||||||
// Initialization code
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
|
|
||||||
{
|
|
||||||
|
|
||||||
CGPoint location = [[[touches allObjects] objectAtIndex:0] locationInView:self];
|
|
||||||
|
|
||||||
prev_loc = location;
|
|
||||||
|
|
||||||
touchMoved = false;
|
|
||||||
|
|
||||||
AppOnTapDown(location.x, self.bounds.size.height - location.y);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
|
|
||||||
{
|
|
||||||
CGPoint location = [[[touches allObjects] objectAtIndex:0] locationInView:self];
|
|
||||||
|
|
||||||
CGPoint prevLocation = [[[touches allObjects] objectAtIndex:0] previousLocationInView:self];
|
|
||||||
|
|
||||||
if (abs(prev_loc.x - location.x) > 10 || abs(prev_loc.y - location.y) > 10)
|
|
||||||
{
|
|
||||||
touchMoved = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
AppOnScroll(prevLocation.x - location.x, prevLocation.y - location.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
|
|
||||||
{
|
|
||||||
CGPoint location = [[[touches allObjects] objectAtIndex:0] locationInView:self];
|
|
||||||
|
|
||||||
if (!touchMoved)
|
|
||||||
{
|
|
||||||
AppOnTapUp(location.x, self.bounds.size.height - location.y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
@ -6,9 +6,10 @@
|
|||||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
|
||||||
#import <GLKit/GLKit.h>
|
|
||||||
|
|
||||||
@interface ViewController : GLKViewController
|
#import "include/Utils/IosApi/ObjC/ViewControllerTemplate.h"
|
||||||
|
|
||||||
|
@interface ViewController : ViewControllerTemplate
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -1,113 +0,0 @@
|
|||||||
//
|
|
||||||
// ViewController.m
|
|
||||||
// doublehitballs
|
|
||||||
//
|
|
||||||
// Created by vvv ооо on 13.07.12.
|
|
||||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "ViewController.h"
|
|
||||||
#import "ios_api.h"
|
|
||||||
|
|
||||||
extern GLKView* defaultView; //Find this in IosApi.h/mm in Engine
|
|
||||||
|
|
||||||
|
|
||||||
@interface ViewController () {
|
|
||||||
}
|
|
||||||
|
|
||||||
@property (strong, nonatomic) EAGLContext *context;
|
|
||||||
@property (strong, nonatomic) GLKBaseEffect *effect;
|
|
||||||
|
|
||||||
- (void)setupGL;
|
|
||||||
- (void)tearDownGL;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation ViewController
|
|
||||||
|
|
||||||
@synthesize context = _context;
|
|
||||||
@synthesize effect = _effect;
|
|
||||||
|
|
||||||
- (void)viewDidLoad
|
|
||||||
{
|
|
||||||
[super viewDidLoad];
|
|
||||||
|
|
||||||
self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
|
|
||||||
|
|
||||||
if (!self.context) {
|
|
||||||
NSLog(@"Failed to create ES context");
|
|
||||||
}
|
|
||||||
|
|
||||||
GLKView *view = (GLKView *)self.view;
|
|
||||||
view.context = self.context;
|
|
||||||
view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
|
|
||||||
|
|
||||||
defaultView = (GLKView *)self.view;
|
|
||||||
|
|
||||||
[self setupGL];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)viewDidUnload
|
|
||||||
{
|
|
||||||
[super viewDidUnload];
|
|
||||||
|
|
||||||
[self tearDownGL];
|
|
||||||
|
|
||||||
if ([EAGLContext currentContext] == self.context) {
|
|
||||||
[EAGLContext setCurrentContext:nil];
|
|
||||||
}
|
|
||||||
self.context = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)didReceiveMemoryWarning
|
|
||||||
{
|
|
||||||
[super didReceiveMemoryWarning];
|
|
||||||
// Release any cached data, images, etc. that aren't in use.
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
|
|
||||||
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
|
|
||||||
} else {
|
|
||||||
return YES;
|
|
||||||
}*/
|
|
||||||
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setupGL
|
|
||||||
{
|
|
||||||
[EAGLContext setCurrentContext:self.context];
|
|
||||||
|
|
||||||
AppInit();
|
|
||||||
|
|
||||||
GLKView *view = (GLKView *)self.view;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)tearDownGL
|
|
||||||
{
|
|
||||||
[EAGLContext setCurrentContext:self.context];
|
|
||||||
|
|
||||||
AppDeinit();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - GLKView and GLKViewController delegate methods
|
|
||||||
|
|
||||||
- (void)update
|
|
||||||
{
|
|
||||||
|
|
||||||
AppUpdate(self.timeSinceLastUpdate * 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect
|
|
||||||
{
|
|
||||||
|
|
||||||
AppDraw();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
@ -1,55 +1,8 @@
|
|||||||
#include "include/Engine.h"
|
#include "include/Engine.h"
|
||||||
#include "main_code.h"
|
#include "main_code.h"
|
||||||
|
|
||||||
TAndroidApplication* App;
|
|
||||||
|
|
||||||
|
void CustomAppInit()
|
||||||
extern "C" void AppInit()
|
|
||||||
{
|
{
|
||||||
CreateEngine();
|
AppInit<TAndroidApplication>(480, 320);
|
||||||
App = new TAndroidApplication;
|
|
||||||
App->OuterInit(480, 320, 480, 320);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void AppDeinit()
|
|
||||||
{
|
|
||||||
|
|
||||||
App->OuterDeinit();
|
|
||||||
delete App;
|
|
||||||
DestroyEngine();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" void AppUpdate(int dt)
|
|
||||||
{
|
|
||||||
App->OuterUpdate(dt);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" void AppDraw()
|
|
||||||
{
|
|
||||||
App->OuterDraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void AppOnTapDown(int posx, int posy)
|
|
||||||
{
|
|
||||||
App->OuterOnTapDown(vec2(posx, posy));
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void AppOnTapUp(int posx, int posy)
|
|
||||||
{
|
|
||||||
App->OuterOnTapUp(vec2(posx, posy));
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void AppOnTapUpAfterScroll(int posx, int posy)
|
|
||||||
{
|
|
||||||
App->OuterOnTapUpAfterShift(vec2(posx, posy));
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void AppOnScroll(int shiftx, int shifty)
|
|
||||||
{
|
|
||||||
App->OuterOnMove(vec2(shiftx, shifty));
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1 @@
|
|||||||
//
|
void CustomAppInit();
|
||||||
// Header.h
|
|
||||||
// doublehitballs
|
|
||||||
//
|
|
||||||
// Created by vvv ооо on 15.07.12.
|
|
||||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
void AppInit();
|
|
||||||
void AppDeinit();
|
|
||||||
void AppUpdate(int dt);
|
|
||||||
void AppDraw();
|
|
||||||
void AppOnTapDown(int posx, int posy);
|
|
||||||
void AppOnTapUp(int posx, int posy);
|
|
||||||
void AppOnScroll(int shiftx, int shifty);
|
|
@ -65,7 +65,7 @@ void TGameCredits::Update(cardinal dt)
|
|||||||
|
|
||||||
void TGameCredits::OnTapDown(vec2 p)
|
void TGameCredits::OnTapDown(vec2 p)
|
||||||
{
|
{
|
||||||
App->GoFromCreditsToMenu();
|
Application->GoFromCreditsToMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TGameCredits::StartAppear()
|
void TGameCredits::StartAppear()
|
||||||
|
@ -890,7 +890,7 @@ void TGameLevel::SetPause()
|
|||||||
RenderBufferReady = false;
|
RenderBufferReady = false;
|
||||||
LevelState = CONST_LEVELSTATE_GO_TO_PAUSE;
|
LevelState = CONST_LEVELSTATE_GO_TO_PAUSE;
|
||||||
StateTimer = CONST_PAUSE_APPEAR_TIME;
|
StateTimer = CONST_PAUSE_APPEAR_TIME;
|
||||||
App->MarkSetGameLevelPause();
|
Application->MarkSetGameLevelPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TGameLevel::ReleasePause()
|
void TGameLevel::ReleasePause()
|
||||||
@ -906,7 +906,7 @@ void TGameLevel::ReleasePause()
|
|||||||
{
|
{
|
||||||
LevelState = CONST_LEVELSTATE_PLAYING;
|
LevelState = CONST_LEVELSTATE_PLAYING;
|
||||||
}
|
}
|
||||||
App->MarkReleaseGameLevelPause();
|
Application->MarkReleaseGameLevelPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TGameLevel::IsPaused()
|
bool TGameLevel::IsPaused()
|
||||||
@ -1085,8 +1085,8 @@ void TGameLevel::Update(cardinal dt)
|
|||||||
|
|
||||||
if (noMoreBlocks && LevelState != CONST_LEVELSTATE_FINISH_FREEZE)
|
if (noMoreBlocks && LevelState != CONST_LEVELSTATE_FINISH_FREEZE)
|
||||||
{
|
{
|
||||||
App->OpenNextLevel();
|
Application->OpenNextLevel();
|
||||||
App->MarkSetGameLevelPause();
|
Application->MarkSetGameLevelPause();
|
||||||
SetFinishFreeze();
|
SetFinishFreeze();
|
||||||
CheckGlError();
|
CheckGlError();
|
||||||
|
|
||||||
@ -1538,11 +1538,9 @@ void TGameLevel::OnScroll(vec2 shift)
|
|||||||
else if (LevelState == CONST_LEVELSTATE_PAUSE)
|
else if (LevelState == CONST_LEVELSTATE_PAUSE)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef TARGET_WIN32
|
|
||||||
OutScale += shift.v[1]/320.f;
|
OutScale += shift.v[1]/320.f;
|
||||||
#else
|
|
||||||
OutScale -= shift.v[1]/320.f;
|
|
||||||
#endif
|
|
||||||
TryGoToMenu();
|
TryGoToMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1553,7 +1551,7 @@ void TGameLevel::TryGoToMenu()
|
|||||||
{
|
{
|
||||||
OutScale = 0.5f;
|
OutScale = 0.5f;
|
||||||
LevelState = CONST_LEVELSTATE_NODRAW;
|
LevelState = CONST_LEVELSTATE_NODRAW;
|
||||||
App->GoFromGameToMenu();
|
Application->GoFromGameToMenu();
|
||||||
}
|
}
|
||||||
if (OutScale > 1.f)
|
if (OutScale > 1.f)
|
||||||
{
|
{
|
||||||
|
@ -46,9 +46,13 @@ const std::string CONST_CREDITS_TEXTURE = "credits";
|
|||||||
|
|
||||||
const float CONST_CREDITS_SHOW_TIME = 150.f;
|
const float CONST_CREDITS_SHOW_TIME = 150.f;
|
||||||
|
|
||||||
|
TAndroidApplication* Application;
|
||||||
|
|
||||||
void TAndroidApplication::InnerInit()
|
void TAndroidApplication::InnerInit()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Application = this;
|
||||||
|
|
||||||
#ifdef TARGET_WIN32
|
#ifdef TARGET_WIN32
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
ResourceManager->PathToResources = "resources/";
|
ResourceManager->PathToResources = "resources/";
|
||||||
|
@ -32,15 +32,9 @@
|
|||||||
using namespace SE;
|
using namespace SE;
|
||||||
|
|
||||||
|
|
||||||
#ifdef TARGET_WIN32
|
|
||||||
class TAndroidApplication;
|
class TAndroidApplication;
|
||||||
extern TAndroidApplication* App;
|
extern TAndroidApplication* Application;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TARGET_IOS
|
|
||||||
class TAndroidApplication;
|
|
||||||
extern TAndroidApplication* App;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern boost::signal<void (vec2)> OnTapUpSignal;
|
extern boost::signal<void (vec2)> OnTapUpSignal;
|
||||||
extern boost::signal<void (vec2)> OnTapDownSignal;
|
extern boost::signal<void (vec2)> OnTapDownSignal;
|
||||||
@ -145,26 +139,14 @@ public:
|
|||||||
|
|
||||||
void LoadResources();
|
void LoadResources();
|
||||||
|
|
||||||
#ifdef TARGET_WIN32
|
virtual void InnerOnTapDown(vec2 p);
|
||||||
|
|
||||||
|
virtual void InnerOnTapUp(vec2 p);
|
||||||
|
|
||||||
|
virtual void InnerOnMove(vec2 shift);
|
||||||
|
|
||||||
|
virtual void OnFling(vec2 v);
|
||||||
|
|
||||||
virtual void InnerOnTapDown(vec2 p);
|
|
||||||
|
|
||||||
virtual void InnerOnTapUp(vec2 p);
|
|
||||||
|
|
||||||
virtual void InnerOnMove(vec2 shift);
|
|
||||||
|
|
||||||
virtual void OnFling(vec2 v);
|
|
||||||
#endif
|
|
||||||
#ifdef TARGET_IOS
|
|
||||||
|
|
||||||
virtual void InnerOnTapDown(vec2 p);
|
|
||||||
|
|
||||||
virtual void InnerOnTapUp(vec2 p);
|
|
||||||
|
|
||||||
virtual void InnerOnMove(vec2 shift);
|
|
||||||
|
|
||||||
virtual void OnFling(vec2 v);
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ void TGameMenu::OnTapDown(vec2 pos)
|
|||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
App->GoFromMenuToCredits();
|
Application->GoFromMenuToCredits();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ void TGameMenu::OnTapUp(vec2 pos)
|
|||||||
if (SelectedGame != -1)
|
if (SelectedGame != -1)
|
||||||
{
|
{
|
||||||
MenuPos = -CONST_MENU_WINDOW_DISTANCE*SelectedGame-40.f;
|
MenuPos = -CONST_MENU_WINDOW_DISTANCE*SelectedGame-40.f;
|
||||||
App->GoFromMenuToGame(SelectedGame);
|
Application->GoFromMenuToGame(SelectedGame);
|
||||||
SelectedGame = -1;
|
SelectedGame = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user