Commit 74a4a6cf authored by Ruben Jesus Garcia Hernandez's avatar Ruben Jesus Garcia Hernandez
Browse files

ParkVR bluetooth controller support added.

Icons added.
parent eaa823d4
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>NOMAD VR</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIcons</key>
<dict/>
<key>CFBundleIcons~ipad</key>
<dict/>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.1</string>
<key>CFBundleVersion</key>
<string>2.1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>Used to scan QR codes</string>
<key>NSMainNibFile</key>
<string>launch</string>
<key>UIFileSharingEnabled</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>launch</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>magnetometer</string>
</array>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
......@@ -7,13 +7,16 @@
objects = {
/* Begin PBXBuildFile section */
1278CED81CEBF98600D93A88 /* NOMADVRSDK-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1278CED71CEBF98600D93A88 /* NOMADVRSDK-Info.plist */; };
1278CED81CEBF98600D93A88 /* NOMADVR-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1278CED71CEBF98600D93A88 /* NOMADVR-Info.plist */; };
12BEE9C01C8F5426002F8361 /* TreasureHuntAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 12BEE9B91C8F5426002F8361 /* TreasureHuntAppDelegate.m */; };
12BEE9C31C8F5426002F8361 /* TreasureHuntViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 12BEE9BF1C8F5426002F8361 /* TreasureHuntViewController.mm */; };
12BEE9C81C8F546B002F8361 /* launch.xib in Resources */ = {isa = PBXBuildFile; fileRef = 12BEE9C61C8F546B002F8361 /* launch.xib */; };
12BEE9CB1C8F54B8002F8361 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 12BEE9CA1C8F54B8002F8361 /* main.m */; };
12C3DC8F1CEBBA9E00D39B85 /* treasure_hunt_renderer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 12C3DC8C1CEBBA9E00D39B85 /* treasure_hunt_renderer.mm */; };
4D73CEB4207BCA7200C55317 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4D73CEB3207BCA7200C55317 /* Images.xcassets */; };
4D85FBEE2075203B008FD96D /* aux.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4D85FBEC2075203B008FD96D /* aux.cpp */; };
4D96EFB22077ACD000BD2694 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D96EFB12077ACD000BD2694 /* GameController.framework */; };
4D96EFB42077BE3B00BD2694 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D96EFB32077BE3B00BD2694 /* AudioToolbox.framework */; };
4DEE7BCE20629B0F00A0956C /* NOMADVRLib in Resources */ = {isa = PBXBuildFile; fileRef = 4DEE7BCD20629B0F00A0956C /* NOMADVRLib */; };
4DEE7BD22062A82000A0956C /* atoms.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEE7BD12062A82000A0956C /* atoms.cpp */; };
4DEE7BD52062A83800A0956C /* atomsGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEE7BD32062A83800A0956C /* atomsGL.cpp */; };
......@@ -34,8 +37,8 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
1278CED71CEBF98600D93A88 /* NOMADVRSDK-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "NOMADVRSDK-Info.plist"; sourceTree = SOURCE_ROOT; };
12BEE99E1C8F53AB002F8361 /* NOMADVRSDK.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NOMADVRSDK.app; sourceTree = BUILT_PRODUCTS_DIR; };
1278CED71CEBF98600D93A88 /* NOMADVR-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "NOMADVR-Info.plist"; sourceTree = SOURCE_ROOT; };
12BEE99E1C8F53AB002F8361 /* NOMADVR.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NOMADVR.app; sourceTree = BUILT_PRODUCTS_DIR; };
12BEE9B81C8F5426002F8361 /* TreasureHuntAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TreasureHuntAppDelegate.h; sourceTree = SOURCE_ROOT; };
12BEE9B91C8F5426002F8361 /* TreasureHuntAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TreasureHuntAppDelegate.m; sourceTree = SOURCE_ROOT; };
12BEE9BE1C8F5426002F8361 /* TreasureHuntViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TreasureHuntViewController.h; sourceTree = SOURCE_ROOT; };
......@@ -45,8 +48,11 @@
12C3DC8C1CEBBA9E00D39B85 /* treasure_hunt_renderer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = treasure_hunt_renderer.mm; sourceTree = SOURCE_ROOT; };
12C3DC8D1CEBBA9E00D39B85 /* treasure_hunt_renderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = treasure_hunt_renderer.h; sourceTree = SOURCE_ROOT; };
3A4028450E1F4537A4DE358F /* libPods-TreasureHuntNDK.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-TreasureHuntNDK.a"; sourceTree = BUILT_PRODUCTS_DIR; };
4D73CEB3207BCA7200C55317 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
4D85FBEC2075203B008FD96D /* aux.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = aux.cpp; sourceTree = "<group>"; };
4D85FBED2075203B008FD96D /* aux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aux.h; sourceTree = "<group>"; };
4D96EFB12077ACD000BD2694 /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; };
4D96EFB32077BE3B00BD2694 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
4DEE7BCD20629B0F00A0956C /* NOMADVRLib */ = {isa = PBXFileReference; lastKnownFileType = folder; name = NOMADVRLib; path = "/Users/lrz/gvr-ios-sdk/Samples/TreasureHuntNDK/NOMADVRLib"; sourceTree = "<absolute>"; };
4DEE7BD12062A82000A0956C /* atoms.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = atoms.cpp; path = NOMADVRLib/atoms.cpp; sourceTree = "<group>"; };
4DEE7BD32062A83800A0956C /* atomsGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = atomsGL.cpp; path = NOMADVRLib/atomsGL.cpp; sourceTree = "<group>"; };
......@@ -75,6 +81,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4D96EFB42077BE3B00BD2694 /* AudioToolbox.framework in Frameworks */,
4D96EFB22077ACD000BD2694 /* GameController.framework in Frameworks */,
C99E7A8E024DA5FE8D83A5BB /* libPods-TreasureHuntNDK.a in Frameworks */,
F27EE917D4C0E740BE5E6345 /* Pods_NOMADVRSDK.framework in Frameworks */,
);
......@@ -86,6 +94,8 @@
119687AEB1F830DBF8B32F90 /* Frameworks */ = {
isa = PBXGroup;
children = (
4D96EFB32077BE3B00BD2694 /* AudioToolbox.framework */,
4D96EFB12077ACD000BD2694 /* GameController.framework */,
3A4028450E1F4537A4DE358F /* libPods-TreasureHuntNDK.a */,
CAC7C8C2287795314AD5579A /* Pods_NOMADVRSDK.framework */,
);
......@@ -95,6 +105,7 @@
12BEE9951C8F53AB002F8361 = {
isa = PBXGroup;
children = (
4D73CEB3207BCA7200C55317 /* Images.xcassets */,
12BEE9A01C8F53AB002F8361 /* TreasureHunt */,
12BEE99F1C8F53AB002F8361 /* Products */,
4DEE7BDE2062ADCB00A0956C /* happyhttp */,
......@@ -109,7 +120,7 @@
12BEE99F1C8F53AB002F8361 /* Products */ = {
isa = PBXGroup;
children = (
12BEE99E1C8F53AB002F8361 /* NOMADVRSDK.app */,
12BEE99E1C8F53AB002F8361 /* NOMADVR.app */,
);
name = Products;
sourceTree = "<group>";
......@@ -123,7 +134,7 @@
12BEE9BF1C8F5426002F8361 /* TreasureHuntViewController.mm */,
12C3DC8C1CEBBA9E00D39B85 /* treasure_hunt_renderer.mm */,
12C3DC8D1CEBBA9E00D39B85 /* treasure_hunt_renderer.h */,
1278CED71CEBF98600D93A88 /* NOMADVRSDK-Info.plist */,
1278CED71CEBF98600D93A88 /* NOMADVR-Info.plist */,
12BEE9C61C8F546B002F8361 /* launch.xib */,
12BEE9A11C8F53AB002F8361 /* Supporting Files */,
);
......@@ -197,9 +208,9 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
12BEE99D1C8F53AB002F8361 /* NOMADVRSDK */ = {
12BEE99D1C8F53AB002F8361 /* NOMADVR */ = {
isa = PBXNativeTarget;
buildConfigurationList = 12BEE9B51C8F53AB002F8361 /* Build configuration list for PBXNativeTarget "NOMADVRSDK" */;
buildConfigurationList = 12BEE9B51C8F53AB002F8361 /* Build configuration list for PBXNativeTarget "NOMADVR" */;
buildPhases = (
ACFE6513C5D698691E7598BC /* [CP] Check Pods Manifest.lock */,
12BEE99A1C8F53AB002F8361 /* Sources */,
......@@ -212,9 +223,9 @@
);
dependencies = (
);
name = NOMADVRSDK;
name = NOMADVR;
productName = TreasureHunt;
productReference = 12BEE99E1C8F53AB002F8361 /* NOMADVRSDK.app */;
productReference = 12BEE99E1C8F53AB002F8361 /* NOMADVR.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
......@@ -232,7 +243,7 @@
};
};
};
buildConfigurationList = 12BEE9991C8F53AB002F8361 /* Build configuration list for PBXProject "NOMADVRSDK" */;
buildConfigurationList = 12BEE9991C8F53AB002F8361 /* Build configuration list for PBXProject "NOMADVR" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
......@@ -245,7 +256,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
12BEE99D1C8F53AB002F8361 /* NOMADVRSDK */,
12BEE99D1C8F53AB002F8361 /* NOMADVR */,
);
};
/* End PBXProject section */
......@@ -256,8 +267,9 @@
buildActionMask = 2147483647;
files = (
4DEE7BCE20629B0F00A0956C /* NOMADVRLib in Resources */,
4D73CEB4207BCA7200C55317 /* Images.xcassets in Resources */,
12BEE9C81C8F546B002F8361 /* launch.xib in Resources */,
1278CED81CEBF98600D93A88 /* NOMADVRSDK-Info.plist in Resources */,
1278CED81CEBF98600D93A88 /* NOMADVR-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -450,6 +462,8 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 9FD381D5B2D35CE778ED88B3 /* Pods-NOMADVRSDK.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
DEVELOPMENT_TEAM = 6DYZG82AAG;
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
......@@ -466,11 +480,12 @@
"\"${PODS_ROOT}/Headers/Public/GoogleToolboxForMac\"",
"\"${PODS_ROOT}/..\"",
);
INFOPLIST_FILE = "NOMADVRSDK-Info.plist";
INFOPLIST_FILE = "NOMADVR-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.test.TreasureHunt;
PRODUCT_NAME = NOMADVRSDK;
PRODUCT_BUNDLE_IDENTIFIER = com.lrz.NOMADVRIOS;
PRODUCT_NAME = NOMADVR;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
......@@ -478,6 +493,8 @@
isa = XCBuildConfiguration;
baseConfigurationReference = EB0170AE84675B1C851C3FA4 /* Pods-NOMADVRSDK.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
DEVELOPMENT_TEAM = 6DYZG82AAG;
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
......@@ -494,18 +511,19 @@
"\"${PODS_ROOT}/Headers/Public/GoogleToolboxForMac\"",
"\"${PODS_ROOT}/..\"",
);
INFOPLIST_FILE = "NOMADVRSDK-Info.plist";
INFOPLIST_FILE = "NOMADVR-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.test.TreasureHunt;
PRODUCT_NAME = NOMADVRSDK;
PRODUCT_BUNDLE_IDENTIFIER = com.lrz.NOMADVRIOS;
PRODUCT_NAME = NOMADVR;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
12BEE9991C8F53AB002F8361 /* Build configuration list for PBXProject "NOMADVRSDK" */ = {
12BEE9991C8F53AB002F8361 /* Build configuration list for PBXProject "NOMADVR" */ = {
isa = XCConfigurationList;
buildConfigurations = (
12BEE9B31C8F53AB002F8361 /* Debug */,
......@@ -514,7 +532,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
12BEE9B51C8F53AB002F8361 /* Build configuration list for PBXNativeTarget "NOMADVRSDK" */ = {
12BEE9B51C8F53AB002F8361 /* Build configuration list for PBXNativeTarget "NOMADVR" */ = {
isa = XCConfigurationList;
buildConfigurations = (
12BEE9B61C8F53AB002F8361 /* Debug */,
......
......@@ -3,13 +3,7 @@
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>TreasureHuntNDK.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<dict/>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>12BEE99D1C8F53AB002F8361</key>
......
......@@ -2,7 +2,7 @@
<Workspace
version = "1.0">
<FileRef
location = "group:/Users/lrz/gvr-ios-sdk/Samples/TreasureHuntNDK/NOMADVRSDK.xcodeproj">
location = "group:/Users/lrz/gvr-ios-sdk/Samples/TreasureHuntNDK/NOMADVR.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
......
......@@ -15,9 +15,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "12BEE99D1C8F53AB002F8361"
BuildableName = "NOMADVRSDK.app"
BlueprintName = "NOMADVRSDK"
ReferencedContainer = "container:NOMADVRSDK.xcodeproj">
BuildableName = "NOMADVR.app"
BlueprintName = "NOMADVR"
ReferencedContainer = "container:NOMADVR.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
......@@ -56,9 +56,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "12BEE99D1C8F53AB002F8361"
BuildableName = "NOMADVRSDK.app"
BlueprintName = "NOMADVRSDK"
ReferencedContainer = "container:NOMADVRSDK.xcodeproj">
BuildableName = "NOMADVR.app"
BlueprintName = "NOMADVR"
ReferencedContainer = "container:NOMADVR.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
......@@ -70,16 +70,6 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "12BEE99D1C8F53AB002F8361"
BuildableName = "NOMADVRSDK.app"
BlueprintName = "NOMADVRSDK"
ReferencedContainer = "container:NOMADVRSDK.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>TreasureHuntNDK.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
......@@ -26,13 +26,28 @@
@interface TreasureHuntViewController ()<GLKViewControllerDelegate, GVROverlayViewDelegate> {
gvr_context *_gvrContext;
std::unique_ptr<TreasureHuntRenderer> _renderer;
NSMutableArray *mycommands;
}
@end
NSString * filename;
@implementation TreasureHuntViewController
//https://stackoverflow.com/questions/3717141/how-to-detect-keyboard-events-on-hardware-keyboard-on-iphone-ios
- (BOOL)canBecomeFirstResponder
{
return YES;
}
- (NSArray *)keyCommands
{
return mycommands;
}
- (void)dealloc {
gvr_destroy(&_gvrContext);
}
......@@ -42,6 +57,8 @@ NSString * filename;
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
......@@ -89,12 +106,55 @@ NSString * filename;
_renderer->InitializeGl();
};
//https://gist.github.com/ferbass/0ddea86e6b2eb5915fabdbfe9f151a5e
fb.didSelectFile=didSelectFileCallback;
//[self.navigationController pushViewController:fb animated:YES];
[self presentViewController:fb animated:YES completion:nil];
_renderer.reset(new TreasureHuntRenderer(_gvrContext));
//keys
NSMutableArray *commands = [[NSMutableArray alloc] init];
/* Up */
[commands addObject:[UIKeyCommand keyCommandWithInput:UIKeyInputUpArrow modifierFlags:kNilOptions action:@selector(handleCommand:)]];
/* Down */
[commands addObject:[UIKeyCommand keyCommandWithInput:UIKeyInputDownArrow modifierFlags:kNilOptions action:@selector(handleCommand:)]];
/* Left */
[commands addObject:[UIKeyCommand keyCommandWithInput:UIKeyInputLeftArrow modifierFlags:kNilOptions action:@selector(handleCommand:)]];
/* Right */
[commands addObject:[UIKeyCommand keyCommandWithInput:UIKeyInputRightArrow modifierFlags:kNilOptions action:@selector(handleCommand:)]];
//VRPark, ABCD=uhyj, arrows: up down left right = wxad
UIKeyModifierFlags f[]={
//UIKeyModifierAlphaShift,
//UIKeyModifierShift,
//UIKeyModifierControl,
//UIKeyModifierAlternate,
//UIKeyModifierCommand,
//UIKeyModifierControl | UIKeyModifierAlternate,
//UIKeyModifierControl | UIKeyModifierCommand,
//UIKeyModifierAlternate | UIKeyModifierCommand,
//UIKeyModifierControl | UIKeyModifierAlternate | UIKeyModifierCommand,
kNilOptions
};
NSString *characters = @"uhyjwxad";
for (NSInteger i = 0; i < characters.length; i++) {
for (int j=0;j<1;j++) {
NSString *input = [characters substringWithRange:NSMakeRange(i, 1)];
[commands addObject:[UIKeyCommand keyCommandWithInput:input modifierFlags:f[j] action:@selector(handleCommand:)]];
}
}
mycommands = commands.copy;
// [self.addKeyCommand:mycommands];
}
- (void)handleCommand:(UIKeyCommand *)command
{
_renderer->keypress (command.input.UTF8String[0]);
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
// GVR only supports landscape right orientation for inserting the phone in the viewer.
return UIInterfaceOrientationMaskLandscapeRight;
......
......@@ -20,6 +20,9 @@
#import <OpenGLES/ES3/gl.h>
#import <OpenGLES/ES3/glext.h>
//https://www.raywenderlich.com/66532/ios-7-game-controller-tutorial
#include "GameController/GameController.h"
#include <memory>
#include <string>
#include <thread> // NOLINT
......@@ -75,7 +78,11 @@ class TreasureHuntRenderer {
*/
void OnResume();
void keypress (int k);
private:
NSArray<GCController *> *controllers=nullptr;
int CreateTexture(int width, int height, int textureFormat, int textureType);
/**
......
......@@ -14,6 +14,7 @@
* limitations under the License.
*/
#include "AudioToolbox/AudioToolbox.h"
#include "treasure_hunt_renderer.h"
#include <assert.h>
......@@ -153,7 +154,7 @@ static gvr::Recti CalculatePixelSpaceRect(const gvr::Sizei& texture_size,
static_cast<int>(rect.bottom), static_cast<int>(rect.top)};
return result;
}
static void CheckGLError(const char* label) {
int gl_error = glGetError();
if (gl_error != GL_NO_ERROR) {
......@@ -170,6 +171,41 @@ void TreasureHuntRenderer::setConfigFile (NSString * filename)
loadConfigFile();
}
void TreasureHuntRenderer::keypress (int k)
{
switch (k) { //A B C D -> Y A X B
//case 'u':
case 'h':
animateMovement=!animateMovement;
break;
case 'y':
animateTimesteps=!animateTimesteps;
break;
//case 'j':
//up down left right
case 'w':
currentSet++;
if (currentSet>TIMESTEPS-1)
currentSet=0;
break;
case 'x':
currentSet--;
if (currentSet<0)
currentSet=TIMESTEPS-1;
break;
case 'a':
currentIso++;
if (currentIso>ISOS)
currentIso=0;
break;
case 'd':
currentIso--;
if (currentIso<0)
currentIso=ISOS;
break;
}
}
void TreasureHuntRenderer::loadConfigFile(void)
{
......@@ -209,6 +245,8 @@ TreasureHuntRenderer::TreasureHuntRenderer(
: gvr_api_(gvr::GvrApi::WrapNonOwned(gvr_context)),
scratch_viewport_(gvr_api_->CreateBufferViewport())
{
controllers=[GCController controllers];
//won't have config file until later
// loadConfigFile();
}
......@@ -335,8 +373,8 @@ void TreasureHuntRenderer::DrawFrame() {
}
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);
glDisable(GL_CULL_FACE);
//glCullFace(GL_FRONT);
glDisable(GL_SCISSOR_TEST);
glDisable(GL_BLEND);
......@@ -378,6 +416,7 @@ void TreasureHuntRenderer::DrawFrame() {
void TreasureHuntRenderer::OnTriggerEvent() {
animateMovement=!animateMovement;
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
}
void TreasureHuntRenderer::OnPause() {
......@@ -779,6 +818,7 @@ void TreasureHuntRenderer::DrawEye(gvr::Eye eye, const gvr::Mat4f& view_matrix,
pixel_rect.right - pixel_rect.left,
pixel_rect.top - pixel_rect.bottom);
CheckGLError("Before glClear");
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
CheckGLError("ColorParam");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment