Skip to content

Commit f30507f

Browse files
committed
fixed connection between iPad and iPhone
functionality to hide boards in edition mode fixed bug toolbar buttons could not be tapped on lower half of the button frame
1 parent 98eef84 commit f30507f

19 files changed

+165
-171
lines changed

TangoHapps.xcodeproj/project.pbxproj

+10-11
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
254EFDAE1A17B82800289A18 /* newProject.png in Resources */ = {isa = PBXBuildFile; fileRef = 254EFDAC1A17B82800289A18 /* newProject.png */; };
3030
254EFDAF1A17B82800289A18 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 254EFDAD1A17B82800289A18 /* [email protected] */; };
3131
25643B8E19B0E52000F8E9CB /* THMenubarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 25643B8C19B0E51F00F8E9CB /* THMenubarViewController.m */; };
32-
25643B8F19B0E52000F8E9CB /* THMenubar.xib in Resources */ = {isa = PBXBuildFile; fileRef = 25643B8D19B0E51F00F8E9CB /* THMenubar.xib */; };
3332
2577302F1A17858800F038D1 /* segBg.png in Resources */ = {isa = PBXBuildFile; fileRef = 257730291A17858800F038D1 /* segBg.png */; };
3433
257730301A17858800F038D1 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 2577302A1A17858800F038D1 /* [email protected] */; };
3534
257730311A17858800F038D1 /* segBgSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = 2577302B1A17858800F038D1 /* segBgSelected.png */; };
@@ -1123,7 +1122,6 @@
11231122
254EFDAD1A17B82800289A18 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
11241123
25643B8B19B0E51F00F8E9CB /* THMenubarViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = THMenubarViewController.h; sourceTree = "<group>"; };
11251124
25643B8C19B0E51F00F8E9CB /* THMenubarViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = THMenubarViewController.m; sourceTree = "<group>"; };
1126-
25643B8D19B0E51F00F8E9CB /* THMenubar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = THMenubar.xib; sourceTree = "<group>"; };
11271125
257730291A17858800F038D1 /* segBg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = segBg.png; sourceTree = "<group>"; };
11281126
2577302A1A17858800F038D1 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
11291127
2577302B1A17858800F038D1 /* segBgSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = segBgSelected.png; sourceTree = "<group>"; };
@@ -3592,8 +3590,8 @@
35923590
9AF501F4167B84B40020241C /* classes */ = {
35933591
isa = PBXGroup;
35943592
children = (
3595-
9AFA04B01B42C89500D7C0D5 /* TextIT */,
35963593
9A84265017564A80009495AB /* Tango */,
3594+
9AFA04B01B42C89500D7C0D5 /* TextIT */,
35973595
9AF502D6167B84B40020241C /* utils */,
35983596
9AF501F5167B84B40020241C /* communication */,
35993597
9A8572B4172AD64C00510D23 /* assets */,
@@ -4028,7 +4026,6 @@
40284026
9AF60BC416A04D9F00178439 /* THTabbar.xib */,
40294027
9AF60BC516A04D9F00178439 /* THTabbarViewSection.xib */,
40304028
9A87C06016A4140C0059CC2E /* THGridItem.xib */,
4031-
25643B8D19B0E51F00F8E9CB /* THMenubar.xib */,
40324029
9AF502E5167B84B40020241C /* communication */,
40334030
9AF502F5167B84B40020241C /* utils */,
40344031
);
@@ -4763,7 +4760,6 @@
47634760
9AEB07581C899888000D399E /* or.png in Resources */,
47644761
251F678719C4A1A300EF9807 /* [email protected] in Resources */,
47654762
9AFA04D41B443CFA00D7C0D5 /* [email protected] in Resources */,
4766-
25643B8F19B0E52000F8E9CB /* THMenubar.xib in Resources */,
47674763
9A82EB771B7DFA4F00567421 /* [email protected] in Resources */,
47684764
9A5931D217E5CD4500B20D99 /* propertiesIcon.png in Resources */,
47694765
9A5BD74F1860C52E00842833 /* [email protected] in Resources */,
@@ -5555,7 +5551,7 @@
55555551
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
55565552
ONLY_ACTIVE_ARCH = YES;
55575553
OTHER_LDFLAGS = "-ObjC";
5558-
PRODUCT_BUNDLE_IDENTIFIER = de.tum.in.www1.InteractexDesigner;
5554+
PRODUCT_BUNDLE_IDENTIFIER = de.tum.in.www1.InteractexDesignerApp;
55595555
PRODUCT_NAME = "Interactex Designer";
55605556
SKIP_INSTALL = NO;
55615557
SWIFT_OBJC_BRIDGING_HEADER = "TangoHapps/classes/utils/TangoHapps-Bridging-Header.h";
@@ -5579,7 +5575,7 @@
55795575
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
55805576
ONLY_ACTIVE_ARCH = YES;
55815577
OTHER_LDFLAGS = "-ObjC";
5582-
PRODUCT_BUNDLE_IDENTIFIER = de.tum.in.www1.InteractexDesigner;
5578+
PRODUCT_BUNDLE_IDENTIFIER = de.tum.in.www1.InteractexDesignerApp;
55835579
PRODUCT_NAME = "Interactex Designer";
55845580
SKIP_INSTALL = NO;
55855581
SWIFT_OBJC_BRIDGING_HEADER = "TangoHapps/classes/utils/TangoHapps-Bridging-Header.h";
@@ -5631,7 +5627,7 @@
56315627
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
56325628
ONLY_ACTIVE_ARCH = YES;
56335629
OTHER_LDFLAGS = "-ObjC";
5634-
PRODUCT_BUNDLE_IDENTIFIER = de.tum.in.www1.InteractexDesigner;
5630+
PRODUCT_BUNDLE_IDENTIFIER = de.tum.in.www1.InteractexDesignerApp;
56355631
PRODUCT_NAME = "Interactex Designer";
56365632
SKIP_INSTALL = NO;
56375633
SWIFT_OBJC_BRIDGING_HEADER = "TangoHapps/classes/utils/TangoHapps-Bridging-Header.h";
@@ -5646,14 +5642,15 @@
56465642
buildSettings = {
56475643
ASSETCATALOG_COMPILER_APPICON_NAME = ClientIcons;
56485644
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = ClientLaunchImage;
5645+
CODE_SIGN_IDENTITY = "iPhone Developer";
56495646
FRAMEWORK_SEARCH_PATHS = ./Frameworks;
56505647
GCC_PRECOMPILE_PREFIX_HEADER = YES;
56515648
GCC_PREFIX_HEADER = "TangoHappsClient/TangoHappsClient-Prefix.pch";
56525649
INFOPLIST_FILE = "TangoHappsClient/TangoHappsClient-Info.plist";
56535650
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
56545651
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
56555652
ONLY_ACTIVE_ARCH = YES;
5656-
PRODUCT_BUNDLE_IDENTIFIER = de.tum.in.www1.InteractexClient;
5653+
PRODUCT_BUNDLE_IDENTIFIER = de.tum.in.www1.InteractexClientApp;
56575654
PRODUCT_NAME = "Interactex Client";
56585655
SKIP_INSTALL = NO;
56595656
SWIFT_OBJC_BRIDGING_HEADER = "TangoHapps/classes/utils/TangoHapps-Bridging-Header.h";
@@ -5668,14 +5665,15 @@
56685665
buildSettings = {
56695666
ASSETCATALOG_COMPILER_APPICON_NAME = ClientIcons;
56705667
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = ClientLaunchImage;
5668+
CODE_SIGN_IDENTITY = "iPhone Developer";
56715669
FRAMEWORK_SEARCH_PATHS = ./Frameworks;
56725670
GCC_PRECOMPILE_PREFIX_HEADER = YES;
56735671
GCC_PREFIX_HEADER = "TangoHappsClient/TangoHappsClient-Prefix.pch";
56745672
INFOPLIST_FILE = "TangoHappsClient/TangoHappsClient-Info.plist";
56755673
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
56765674
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
56775675
ONLY_ACTIVE_ARCH = YES;
5678-
PRODUCT_BUNDLE_IDENTIFIER = de.tum.in.www1.InteractexClient;
5676+
PRODUCT_BUNDLE_IDENTIFIER = de.tum.in.www1.InteractexClientApp;
56795677
PRODUCT_NAME = "Interactex Client";
56805678
SKIP_INSTALL = NO;
56815679
SWIFT_OBJC_BRIDGING_HEADER = "TangoHapps/classes/utils/TangoHapps-Bridging-Header.h";
@@ -5690,14 +5688,15 @@
56905688
buildSettings = {
56915689
ASSETCATALOG_COMPILER_APPICON_NAME = ClientIcons;
56925690
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = ClientLaunchImage;
5691+
CODE_SIGN_IDENTITY = "iPhone Developer";
56935692
FRAMEWORK_SEARCH_PATHS = ./Frameworks;
56945693
GCC_PRECOMPILE_PREFIX_HEADER = YES;
56955694
GCC_PREFIX_HEADER = "TangoHappsClient/TangoHappsClient-Prefix.pch";
56965695
INFOPLIST_FILE = "TangoHappsClient/TangoHappsClient-Info.plist";
56975696
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
56985697
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
56995698
ONLY_ACTIVE_ARCH = YES;
5700-
PRODUCT_BUNDLE_IDENTIFIER = de.tum.in.www1.InteractexClient;
5699+
PRODUCT_BUNDLE_IDENTIFIER = de.tum.in.www1.InteractexClientApp;
57015700
PRODUCT_NAME = "Interactex Client";
57025701
SKIP_INSTALL = NO;
57035702
SWIFT_OBJC_BRIDGING_HEADER = "TangoHapps/classes/utils/TangoHapps-Bridging-Header.h";

TangoHapps/THAppDelegate.m

-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ - (void)applicationWillResignActive:(UIApplication *)application
7676

7777
THDirector * director = [THDirector sharedDirector];
7878
[director.serverController stopServer];
79-
//[THDirector sharedDirector] upda
8079
}
8180

8281
- (void)applicationDidEnterBackground:(UIApplication *)application

TangoHapps/TangoHapps-Info.plist

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
<string>armv7</string>
4444
<string>gamekit</string>
4545
</array>
46+
<key>UIRequiresFullScreen</key>
47+
<true/>
4648
<key>UISupportedInterfaceOrientations</key>
4749
<array>
4850
<string>UIInterfaceOrientationLandscapeLeft</string>

TangoHapps/classes/Tango/Utils/TFConstants.h

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ extern float const kGridItemWidth;
5555
extern float const kGridItemHeight;
5656
extern float const kLineAcceptedTiltingTime;
5757

58+
extern float const kMenuBarHeight;
59+
extern float const kMenuBarButtonHeight;
60+
extern float const kMenuBarVPLabelHeight;//this label is bigger because of the little arrow (triangle pointing down)
61+
5862
extern NSString * const kNotificationObjectAdded;
5963
extern NSString * const kNotificationObjectRemoved;
6064
extern NSString * const kNotificationObjectSelected;

TangoHapps/classes/Tango/Utils/TFConstants.m

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
float const kGridItemHeight = 230;
5252

5353
float const kLineAcceptedTiltingTime = 0.35f;
54+
float const kMenuBarHeight = 64;
55+
float const kMenuBarButtonHeight = 64;
56+
float const kMenuBarVPLabelHeight = 73;
5457

5558
NSString * const kNotificationActionAdded = @"notificationActionAdded";
5659
NSString * const kNotificationActionRemoved = @"notificationActionRemoved";

TangoHapps/classes/communication/THServerController.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
{
2525
}
2626

27-
@property (readonly, nonatomic) MCPeerID * localPeerId;
28-
@property (readonly, nonatomic) MCSession * session;
2927
@property (weak, nonatomic) id<THServerControllerDelegate> delegate;
30-
@property (strong, nonatomic) NSMutableArray * invitationHandlers;
28+
@property (nonatomic) BOOL isConnected;
29+
30+
//@property (strong, nonatomic) NSMutableArray * invitationHandlers;
3131

3232
-(void) pushProjectToAllClients:(THProject*)project;
3333
-(void) startServer;

TangoHapps/classes/communication/THServerController.m

+26-8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
@interface THServerController()
1414

15+
@property (strong, nonatomic) MCPeerID * localPeerId;
16+
@property (nonatomic) MCSession * session;
1517
@property (retain, nonatomic) MCNearbyServiceAdvertiser * advertiser;
1618

1719
@end
@@ -27,7 +29,7 @@ - (id)init {
2729
_advertiser = [[MCNearbyServiceAdvertiser alloc] initWithPeer:self.localPeerId discoveryInfo:nil serviceType:kConnectionServiceType];
2830
_advertiser.delegate = self;
2931

30-
_invitationHandlers = [NSMutableArray array];
32+
self.isConnected = NO;
3133
}
3234
return self;
3335
}
@@ -36,6 +38,7 @@ - (void)dealloc {
3638
[_session disconnect];
3739
}
3840

41+
/*
3942
//delete this
4043
- (NSString *)stringForPeerConnectionState:(MCSessionState)state
4144
{
@@ -49,16 +52,26 @@ - (NSString *)stringForPeerConnectionState:(MCSessionState)state
4952
case MCSessionStateNotConnected:
5053
return @"Not Connected";
5154
}
52-
}
55+
}*/
5356

5457
- (void)advertiser:(MCNearbyServiceAdvertiser *)advertiser didReceiveInvitationFromPeer:(MCPeerID *)peerID withContext:(NSData *)context invitationHandler:(void(^)(BOOL accept, MCSession *session))invitationHandler{
5558

56-
NSLog(@"received invitation");
57-
58-
_session = [[MCSession alloc] initWithPeer:self.localPeerId];
59-
_session.delegate = self;
59+
[self createOrGetSession];
6060

6161
invitationHandler(YES,_session);
62+
63+
}
64+
65+
- (MCSession*) createOrGetSession {
66+
if(self.session == nil) {
67+
68+
self.session = [[MCSession alloc] initWithPeer:self.localPeerId
69+
securityIdentity:nil
70+
encryptionPreference:MCEncryptionNone];
71+
self.session.delegate = self;
72+
}
73+
74+
return self.session;
6275
}
6376

6477
#pragma mark - Public methods
@@ -122,12 +135,14 @@ - (void)sendMessage:(NSString *)message {
122135

123136
// Override this method to handle changes to peer session state
124137
- (void)session:(MCSession *)session peer:(MCPeerID *)peerID didChangeState:(MCSessionState)state {
125-
NSLog(@"Peer [%@] changed state to %@", peerID.displayName, [self stringForPeerConnectionState:state]);
138+
//NSLog(@"Peer [%@] changed state to %@", peerID.displayName, [self stringForPeerConnectionState:state]);
126139

127140
dispatch_async(dispatch_get_main_queue(), ^{
128141
if(state == MCSessionStateConnected){
142+
self.isConnected = YES;
129143
[self.delegate server:self peerConnected:peerID.displayName];
130144
} else if(state == MCSessionStateNotConnected){
145+
self.isConnected = NO;
131146
[self.delegate server:self peerDisconnected:peerID.displayName];
132147
}
133148
});
@@ -159,9 +174,12 @@ - (void)session:(MCSession *)session didReceiveStream:(NSInputStream *)stream wi
159174
//NSLog(@"Received data over stream with name %@ from peer %@", streamName, peerID.displayName);
160175
}
161176

177+
162178
- (void) session:(MCSession *)session didReceiveCertificate:(NSArray *)certificate fromPeer:(MCPeerID *)peerID certificateHandler:(void (^)(BOOL accept))certificateHandler
163179
{
164-
certificateHandler(YES);
180+
if(certificateHandler != nil){
181+
certificateHandler(YES);
182+
}
165183
}
166184

167185
@end

TangoHapps/classes/objects/hardware/boards/THBoardEditable.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,9 @@ -(void) addToLayer:(TFLayer *)layer{
279279

280280
THProject * project = (THProject*) [THDirector sharedDirector].currentProject;
281281
if(project.boards.count == 1){
282-
/*for (THHardwareComponentEditableObject * object in project.hardwareComponents) {
282+
for (THHardwareComponentEditableObject * object in project.hardwareComponents) {
283283
[object autoroute];
284-
}*/
284+
}
285285
}
286286
}
287287

TangoHapps/classes/objects/layers/THEditor.m

+2-20
Original file line numberDiff line numberDiff line change
@@ -869,26 +869,8 @@ -(THWireNode*) wireNodeAtLocation:(CGPoint) location wire:(THWire*) wire{
869869
return nil;
870870
}
871871

872-
-(void) handleExtra{//Juan remove!!
873-
874-
THProject * project = [THDirector sharedDirector].currentProject;
875-
THLabelEditableObject * label1 = [project.iPhoneObjects objectAtIndex:0];
876-
877-
NSLog(@"copyng label... %@",label1);
878-
879-
880-
THLabelEditableObject * label2 = [label1 copy];
881-
[label2 addToWorld];
882-
/*
883-
[self addEditableObject:label2];
884-
885-
THView * view = (THView*) label2.simulableObject;
886-
[view addToView:[CCDirector sharedDirector].view];*/
887-
}
888872

889873
-(void)tapped:(UITapGestureRecognizer*)sender {
890-
//[self handleExtra];
891-
//return;
892874

893875
CGPoint location = [sender locationInView:sender.view];
894876
location = [self toLayerCoords:location];
@@ -1480,7 +1462,7 @@ -(void) startLilypadMode{
14801462
_isLilypadMode = YES;
14811463

14821464
[self unselectCurrentObject];
1483-
[self deAttachClotheItems];
1465+
//[self deAttachClotheItems];
14841466

14851467
[self hideConnectionsForAllObjects];
14861468
[self hideNonLilypadObjects];
@@ -1493,7 +1475,7 @@ -(void) startLilypadMode{
14931475
-(void) stopLilypadMode{
14941476

14951477
_isLilypadMode = NO;
1496-
//[self hideBoards];
1478+
[self hideBoards];
14971479
[self hideOtherHardware];
14981480
[self showNonLilypadObjects];
14991481
[self unselectCurrentObject];

TangoHapps/classes/project selection/THProjectSelectionViewController.m

+4-2
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,17 @@ -(void) setActivityViewNewProjectText{
124124
- (CCGLView *)createDirectorGLView {
125125

126126
float navBarHeight = self.navigationController.navigationBar.frame.size.height;
127-
//float statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
127+
float statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
128128

129-
CCGLView *glView = [CCGLView viewWithFrame:CGRectMake(0, 0, 1024, 768 - navBarHeight)
129+
CCGLView *glView = [CCGLView viewWithFrame:CGRectMake(0, 0, 1024, 768 - navBarHeight - statusBarHeight)
130130
pixelFormat:kEAGLColorFormatRGB565
131131
depthFormat:0
132132
preserveBackbuffer:NO
133133
sharegroup:nil
134134
multiSampling:NO
135135
numberOfSamples:0];
136+
137+
136138
return glView;
137139
}
138140

TangoHapps/classes/project view/THProjectViewController.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ You should have received a copy of the GNU General Public License along with thi
5151

5252
@interface THProjectViewController : UIViewController<UIGestureRecognizerDelegate, UITextFieldDelegate, CCDirectorDelegate> {
5353

54+
UIView * _menuView;
55+
UIView * _menuButtonsView;
56+
5457
UIBarButtonItem * _playButton;
5558
UIBarButtonItem * _stopButton;
5659

@@ -65,8 +68,8 @@ You should have received a copy of the GNU General Public License along with thi
6568
@property (nonatomic, readonly) CCGLView * glview;
6669
@property (nonatomic, readonly) TFAppState state;
6770
@property (nonatomic, readonly) THTabbarViewController * tabController;
68-
@property (nonatomic, readonly) THMenubarViewController * menuController;
69-
//@property (nonatomic, readonly) THEditorToolsViewController * toolsController;
71+
//@property (nonatomic, readonly) THMenubarViewController * menuController;
72+
7073
@property (nonatomic, strong) UIPanGestureRecognizer * panRecognizer;
7174

7275
@property (nonatomic, readonly) BOOL editingSceneName;

0 commit comments

Comments
 (0)