mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-09 14:47:02 +02:00
#15 fix multi-touch support
This commit is contained in:
@@ -31,7 +31,7 @@ int getTime() {
|
||||
return (int)((mach_absolute_time() * info.numer) / (kOneMillion * info.denom));
|
||||
}
|
||||
|
||||
#define SND_BUF_SIZE 4096
|
||||
#define SND_BUF_SIZE 8192
|
||||
|
||||
static AudioQueueRef audioQueue;
|
||||
|
||||
@@ -92,14 +92,15 @@ void soundInit() {
|
||||
return;
|
||||
}
|
||||
|
||||
GLKView *view = (GLKView *)self.view;
|
||||
view.context = self.context;
|
||||
self.preferredFramesPerSecond = 60;
|
||||
|
||||
GLKView *view = (GLKView *)self.view;
|
||||
view.multipleTouchEnabled = YES;
|
||||
view.context = self.context;
|
||||
view.drawableDepthFormat = GLKViewDrawableDepthFormat16;
|
||||
view.drawableColorFormat = GLKViewDrawableColorFormatRGBA8888;
|
||||
[EAGLContext setCurrentContext:self.context];
|
||||
|
||||
self.view.multipleTouchEnabled = YES;
|
||||
|
||||
Stream::contentDir[0] = Stream::cacheDir[0] = 0;
|
||||
|
||||
@@ -147,13 +148,14 @@ void soundInit() {
|
||||
Game::render();
|
||||
}
|
||||
|
||||
enum { TOUCH_DOWN, TOUCH_UP, TOUCH_MOVE };
|
||||
|
||||
- (void) doTouch:(UIEvent*)event {
|
||||
float scale = [[UIScreen mainScreen] scale];
|
||||
|
||||
NSSet* touchSet = [event allTouches];
|
||||
for (UITouch *touch in touchSet) {
|
||||
if (touch.phase == UITouchPhaseStationary)
|
||||
continue;
|
||||
|
||||
CGPoint pos = [touch locationInView:self.view];
|
||||
NSUInteger id = int(touch);
|
||||
|
||||
@@ -161,9 +163,10 @@ enum { TOUCH_DOWN, TOUCH_UP, TOUCH_MOVE };
|
||||
if (key == ikNone) return;
|
||||
Input::setPos(key, vec2(pos.x, pos.y) * scale);
|
||||
|
||||
if (touch.phase != UITouchPhaseMoved)
|
||||
if (touch.phase != UITouchPhaseMoved) {
|
||||
Input::setDown(key, touch.phase == UITouchPhaseBegan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
|
@@ -209,6 +209,12 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0430;
|
||||
TargetAttributes = {
|
||||
996585A7160A31450097B128 = {
|
||||
DevelopmentTeam = L49L654K86;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 996585A2160A31450097B128 /* Build configuration list for PBXProject "openlara" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
@@ -324,9 +330,12 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
DEVELOPMENT_TEAM = L49L654K86;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "openlara-Prefix.pch";
|
||||
INFOPLIST_FILE = "openlara-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
PRODUCT_NAME = "${TARGET_NAME}";
|
||||
PROVISIONING_PROFILE = "";
|
||||
WRAPPER_EXTENSION = app;
|
||||
@@ -337,9 +346,12 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
DEVELOPMENT_TEAM = L49L654K86;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "openlara-Prefix.pch";
|
||||
INFOPLIST_FILE = "openlara-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
PRODUCT_NAME = "${TARGET_NAME}";
|
||||
PROVISIONING_PROFILE = "";
|
||||
WRAPPER_EXTENSION = app;
|
||||
|
Reference in New Issue
Block a user