diff options
-rwxr-xr-x | Cartographic.xcodeproj/project.pbxproj | 2 | ||||
-rwxr-xr-x | Classes/CocosOverlayScrollView.h | 3 | ||||
-rwxr-xr-x | Classes/CocosOverlayScrollView.m | 9 | ||||
-rw-r--r-- | Classes/GameModeSelectionLayer.h | 1 | ||||
-rw-r--r-- | Classes/GameModeSelectionLayer.m | 9 |
5 files changed, 21 insertions, 3 deletions
diff --git a/Cartographic.xcodeproj/project.pbxproj b/Cartographic.xcodeproj/project.pbxproj index 59cf7cd..4a478c9 100755 --- a/Cartographic.xcodeproj/project.pbxproj +++ b/Cartographic.xcodeproj/project.pbxproj | |||
@@ -1601,6 +1601,7 @@ | |||
1601 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | 1601 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; |
1602 | COPY_PHASE_STRIP = NO; | 1602 | COPY_PHASE_STRIP = NO; |
1603 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | 1603 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; |
1604 | GCC_C_LANGUAGE_STANDARD = c99; | ||
1604 | GCC_DYNAMIC_NO_PIC = NO; | 1605 | GCC_DYNAMIC_NO_PIC = NO; |
1605 | GCC_OPTIMIZATION_LEVEL = 0; | 1606 | GCC_OPTIMIZATION_LEVEL = 0; |
1606 | GCC_PRECOMPILE_PREFIX_HEADER = YES; | 1607 | GCC_PRECOMPILE_PREFIX_HEADER = YES; |
@@ -1629,6 +1630,7 @@ | |||
1629 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | 1630 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; |
1630 | COPY_PHASE_STRIP = YES; | 1631 | COPY_PHASE_STRIP = YES; |
1631 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | 1632 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; |
1633 | GCC_C_LANGUAGE_STANDARD = c99; | ||
1632 | GCC_PRECOMPILE_PREFIX_HEADER = YES; | 1634 | GCC_PRECOMPILE_PREFIX_HEADER = YES; |
1633 | GCC_PREFIX_HEADER = Cart_Collect_Prefix.pch; | 1635 | GCC_PREFIX_HEADER = Cart_Collect_Prefix.pch; |
1634 | GCC_TREAT_WARNINGS_AS_ERRORS = NO; | 1636 | GCC_TREAT_WARNINGS_AS_ERRORS = NO; |
diff --git a/Classes/CocosOverlayScrollView.h b/Classes/CocosOverlayScrollView.h index 29de1c7..ad8e83f 100755 --- a/Classes/CocosOverlayScrollView.h +++ b/Classes/CocosOverlayScrollView.h | |||
@@ -12,7 +12,8 @@ | |||
12 | @interface CocosOverlayScrollView : UIScrollView <UIScrollViewDelegate> | 12 | @interface CocosOverlayScrollView : UIScrollView <UIScrollViewDelegate> |
13 | { | 13 | { |
14 | CCNode* targetLayer; | 14 | CCNode* targetLayer; |
15 | UIPageControl* pageControl; | ||
15 | } | 16 | } |
16 | @property(nonatomic, retain) CCNode* targetLayer; | 17 | @property(nonatomic, retain) CCNode* targetLayer; |
17 | -(id) initWithFrame: (CGRect) frameRect numPages: (int) numPages width: (float) width layer: (CCNode*) layer; | 18 | -(id) initWithFrame: (CGRect) frameRect numPages: (int) numPages width: (float) width layer: (CCNode*) layer pageControl:(UIPageControl*)pageControl; |
18 | @end | 19 | @end |
diff --git a/Classes/CocosOverlayScrollView.m b/Classes/CocosOverlayScrollView.m index dcf5571..dee9dfe 100755 --- a/Classes/CocosOverlayScrollView.m +++ b/Classes/CocosOverlayScrollView.m | |||
@@ -12,7 +12,7 @@ | |||
12 | @synthesize targetLayer; | 12 | @synthesize targetLayer; |
13 | 13 | ||
14 | // Configure your favorite UIScrollView options here | 14 | // Configure your favorite UIScrollView options here |
15 | -(id) initWithFrame: (CGRect) frameRect numPages: (int) numPages width: (float) width layer: (CCNode*) layer { | 15 | -(id) initWithFrame: (CGRect) frameRect numPages: (int) numPages width: (float) width layer: (CCNode*) layer pageControl:(UIPageControl *)m_pageControl{ |
16 | if ((self = [super initWithFrame: frameRect])){ | 16 | if ((self = [super initWithFrame: frameRect])){ |
17 | self.contentSize = CGSizeMake(width*numPages, 320); | 17 | self.contentSize = CGSizeMake(width*numPages, 320); |
18 | self.bounces = YES; | 18 | self.bounces = YES; |
@@ -26,6 +26,7 @@ | |||
26 | [self setScrollEnabled:TRUE]; | 26 | [self setScrollEnabled:TRUE]; |
27 | self.targetLayer = layer; | 27 | self.targetLayer = layer; |
28 | // self.canCancelContentTouches = YES; | 28 | // self.canCancelContentTouches = YES; |
29 | pageControl = m_pageControl; | ||
29 | } | 30 | } |
30 | return self; | 31 | return self; |
31 | } | 32 | } |
@@ -96,4 +97,10 @@ | |||
96 | self.targetLayer = nil; | 97 | self.targetLayer = nil; |
97 | [super dealloc]; | 98 | [super dealloc]; |
98 | } | 99 | } |
100 | |||
101 | - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView | ||
102 | { | ||
103 | [pageControl setCurrentPage:(NSUInteger)([scrollView contentOffset].x / [scrollView frame].size.width)]; | ||
104 | } | ||
105 | |||
99 | @end \ No newline at end of file | 106 | @end \ No newline at end of file |
diff --git a/Classes/GameModeSelectionLayer.h b/Classes/GameModeSelectionLayer.h index 451a5f8..478a173 100644 --- a/Classes/GameModeSelectionLayer.h +++ b/Classes/GameModeSelectionLayer.h | |||
@@ -15,6 +15,7 @@ | |||
15 | NSMutableArray* gameModes; | 15 | NSMutableArray* gameModes; |
16 | TouchDelegatingView* touchDelegatingView; | 16 | TouchDelegatingView* touchDelegatingView; |
17 | CocosOverlayScrollView* scrollView; | 17 | CocosOverlayScrollView* scrollView; |
18 | UIPageControl* pageControl; | ||
18 | } | 19 | } |
19 | 20 | ||
20 | + (CCScene*)scene; | 21 | + (CCScene*)scene; |
diff --git a/Classes/GameModeSelectionLayer.m b/Classes/GameModeSelectionLayer.m index 9875d41..ad6a455 100644 --- a/Classes/GameModeSelectionLayer.m +++ b/Classes/GameModeSelectionLayer.m | |||
@@ -86,9 +86,15 @@ | |||
86 | [panels addChild:menu]; | 86 | [panels addChild:menu]; |
87 | [self addChild:panels]; | 87 | [self addChild:panels]; |
88 | 88 | ||
89 | pageControl = [[UIPageControl alloc] init]; | ||
90 | pageControl.numberOfPages = numberOfPanels; | ||
91 | pageControl.currentPage = currentWorldOffset; | ||
92 | pageControl.frame = CGRectMake(0, 250, 480, 20); | ||
93 | [[[CCDirector sharedDirector] openGLView] addSubview:pageControl]; | ||
94 | |||
89 | menu.position = ccpAdd(menu.position, ccp(totalWidth/2 - totalPanelWidth/2, 320)); | 95 | menu.position = ccpAdd(menu.position, ccp(totalWidth/2 - totalPanelWidth/2, 320)); |
90 | touchDelegatingView = [[TouchDelegatingView alloc] initWithFrame:CGRectMake(0, 0, 480, 320)]; | 96 | touchDelegatingView = [[TouchDelegatingView alloc] initWithFrame:CGRectMake(0, 0, 480, 320)]; |
91 | scrollView = [[CocosOverlayScrollView alloc] initWithFrame:CGRectMake(0, 0, totalPanelWidth, 320) numPages:numberOfPanels width:totalPanelWidth layer:panels]; | 97 | scrollView = [[CocosOverlayScrollView alloc] initWithFrame:CGRectMake(0, 0, totalPanelWidth, 320) numPages:numberOfPanels width:totalPanelWidth layer:panels pageControl:pageControl]; |
92 | touchDelegatingView.scrollView = scrollView; | 98 | touchDelegatingView.scrollView = scrollView; |
93 | [scrollView setContentOffset:CGPointMake(currentWorldOffset*totalPanelWidth+1,0) animated:NO]; | 99 | [scrollView setContentOffset:CGPointMake(currentWorldOffset*totalPanelWidth+1,0) animated:NO]; |
94 | [[[CCDirector sharedDirector] openGLView] addSubview:touchDelegatingView]; | 100 | [[[CCDirector sharedDirector] openGLView] addSubview:touchDelegatingView]; |
@@ -107,6 +113,7 @@ | |||
107 | { | 113 | { |
108 | [touchDelegatingView removeFromSuperview]; | 114 | [touchDelegatingView removeFromSuperview]; |
109 | [scrollView removeFromSuperview]; | 115 | [scrollView removeFromSuperview]; |
116 | [pageControl removeFromSuperview]; | ||
110 | } | 117 | } |
111 | 118 | ||
112 | - (void)mainmenu | 119 | - (void)mainmenu |