# HG changeset patch
# User koda
# Date 1266077044 0
# Node ID 36a8cebb91e8f54b7430ff63b80b26862101097d
# Parent 31c6c36c5d34bd19665839827ce642c04684aec8
new menupage ingame for common actions
new style for moving the main menu
diff -r 31c6c36c5d34 -r 36a8cebb91e8 cocoaTouch/MainMenuViewController.m
--- a/cocoaTouch/MainMenuViewController.m Sat Feb 13 12:40:40 2010 +0000
+++ b/cocoaTouch/MainMenuViewController.m Sat Feb 13 16:04:04 2010 +0000
@@ -138,17 +138,17 @@
self.settingsViewController = controller;
[controller release];
}
- self.settingsViewController.view.frame = CGRectMake(0, -320, 480, 320);
+ self.settingsViewController.view.frame = CGRectMake(0, -257, 480, 278);
self.settingsViewController.parentView = self.mainView;
- [UIView beginAnimations:@"View Switch" context:NULL];
+ [UIView beginAnimations:@"Settings SwitchView" context:NULL];
[UIView setAnimationDuration:1];
- self.settingsViewController.view.frame = CGRectMake(0, 0, 480, 320);
- self.mainView.frame = CGRectMake(0, 320, 480, 320);
+ self.settingsViewController.view.frame = CGRectMake(0, 21, 480, 278);
+ self.mainView.frame = CGRectMake(0, 299, 480, 278);
[UIView commitAnimations];
- [self.view addSubview:settingsViewController.view];
+ [self.view insertSubview:settingsViewController.view atIndex:0];
}
}
diff -r 31c6c36c5d34 -r 36a8cebb91e8 cocoaTouch/MainMenuViewController.xib
--- a/cocoaTouch/MainMenuViewController.xib Sat Feb 13 12:40:40 2010 +0000
+++ b/cocoaTouch/MainMenuViewController.xib Sat Feb 13 16:04:04 2010 +0000
@@ -12,7 +12,7 @@
- 34
+ 36
diff -r 31c6c36c5d34 -r 36a8cebb91e8 cocoaTouch/SDLOverrides/SDL_uikitappdelegate.h
--- a/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.h Sat Feb 13 12:40:40 2010 +0000
+++ b/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.h Sat Feb 13 16:04:04 2010 +0000
@@ -31,7 +31,6 @@
MainMenuViewController *viewController;
}
-// the outlets are set in MainWindow.xib
@property (readwrite, assign) SDL_Window *window;
@property (readwrite, retain) UIWindow *uiwindow;
@property (nonatomic, retain) MainMenuViewController *viewController;
diff -r 31c6c36c5d34 -r 36a8cebb91e8 cocoaTouch/SDLOverrides/SDL_uikitview.h
--- a/cocoaTouch/SDLOverrides/SDL_uikitview.h Sat Feb 13 12:40:40 2010 +0000
+++ b/cocoaTouch/SDLOverrides/SDL_uikitview.h Sat Feb 13 16:04:04 2010 +0000
@@ -48,6 +48,7 @@
#endif
}
+
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
diff -r 31c6c36c5d34 -r 36a8cebb91e8 cocoaTouch/SDLOverrides/SDL_uikitview.m
--- a/cocoaTouch/SDLOverrides/SDL_uikitview.m Sat Feb 13 12:40:40 2010 +0000
+++ b/cocoaTouch/SDLOverrides/SDL_uikitview.m Sat Feb 13 16:04:04 2010 +0000
@@ -34,15 +34,16 @@
@implementation SDL_uikitview
// they have to be global variables to allow showControls() to use them
-UIButton *attackButton, *menuButton;
-
+//UIButton *attackButton, *menuButton;
+UIView *menuView;
-(void) dealloc {
#if SDL_IPHONE_KEYBOARD
SDL_DelKeyboard(0);
[textField release];
#endif
- [menuButton release];
- [attackButton release];
+ if (menuView) [menuView release];
+ //[menuButton release];
+ //[attackButton release];
[super dealloc];
}
@@ -66,7 +67,9 @@
self.multipleTouchEnabled = YES;
self.exclusiveTouch = YES;
-/*
+
+
+ /*
// custom code
// the coordinate system is still like in Portrait even though everything is rotated
attackButton = [[UIButton alloc] initWithFrame:CGRectMake(30, 480, 260, 50)];
@@ -112,9 +115,47 @@
[self insertSubview:chatButton atIndex:0];
[chatButton release];
*/
+
+//(0,0) is the lower left corner
+//x:[0-320]
+//y:[0-480]
+ UIButton *menuButton = [[UIButton alloc] initWithFrame:CGRectMake(256, 416, 64, 64)];
+ [menuButton addTarget:[self superclass] action:@selector(showMenu) forControlEvents:UIControlEventTouchDown];
+ [menuButton setBackgroundImage:[UIImage imageNamed:@"Default.png"] forState:UIControlStateNormal];
+ [self insertSubview:menuButton atIndex:0];
+ [menuButton release];
+
+ menuView = [[UIView alloc] initWithFrame:CGRectMake(320, 480, 150, 100)];
+ menuView.backgroundColor = [UIColor lightGrayColor];
+ [self insertSubview:menuView atIndex:1];
+
return self;
}
++(void) showMenu {
+ HW_pause();
+
+ [UIView beginAnimations:@"show menu" context:NULL];
+ [UIView setAnimationDuration:1];
+
+ menuView.frame = CGRectMake(170, 380, 150, 100);
+
+ [UIView commitAnimations];
+}
+
++(void) hideMenu {
+ [UIView beginAnimations:@"hide menu" context:NULL];
+ [UIView setAnimationDuration:1];
+
+ menuView.frame = CGRectMake(480, -70, 150, 100);
+
+ [UIView commitAnimations];
+
+ HW_pause();
+}
+
+
+
#pragma mark -
#pragma mark Exported functions for FreePascal
const char* IPH_getDocumentsPath() {
@@ -164,6 +205,10 @@
//TODO: implement a UITextScroll and put received chat lines in there
}
++(void) pauseGame {
+ HW_pause();
+}
+
#pragma mark -
#pragma mark Custom SDL_UIView input handling
#define kMinimumPinchDelta 50
diff -r 31c6c36c5d34 -r 36a8cebb91e8 cocoaTouch/SettingsViewController.m
--- a/cocoaTouch/SettingsViewController.m Sat Feb 13 12:40:40 2010 +0000
+++ b/cocoaTouch/SettingsViewController.m Sat Feb 13 16:04:04 2010 +0000
@@ -142,8 +142,8 @@
[UIView beginAnimations:@"Get Back" context:NULL];
[UIView setAnimationDuration:1];
- self.view.frame = CGRectMake(0, -320, 480, 320);
- self.parentView.frame = CGRectMake(0, 0, 480, 320);
+ self.view.frame = CGRectMake(0, -257, 480, 278);
+ self.parentView.frame = CGRectMake(0, 21, 480, 278);
[UIView commitAnimations];
[self.view performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1];
diff -r 31c6c36c5d34 -r 36a8cebb91e8 cocoaTouch/SettingsViewController.xib
--- a/cocoaTouch/SettingsViewController.xib Sat Feb 13 12:40:40 2010 +0000
+++ b/cocoaTouch/SettingsViewController.xib Sat Feb 13 16:04:04 2010 +0000
@@ -97,20 +97,20 @@
274
- {480, 320}
+ {480, 278}
NO
4
NO
NSImage
- background.png
+ backgroundTop.png
274
- {{0, 20}, {480, 280}}
+ {480, 278}
NO
YES
@@ -126,12 +126,13 @@
10
- {480, 320}
+ {480, 278}
1
MCAwIDAAA
+ 4
@@ -318,11 +319,6 @@
- 30
-
-
-
-
6
@@ -341,6 +337,11 @@
+
+ 30
+
+
+
@@ -366,7 +367,7 @@
SettingsViewController
UIResponder
UIControl
- {{476, 492}, {480, 320}}
+ {{476, 534}, {480, 278}}
com.apple.InterfaceBuilder.IBCocoaTouchPlugin
com.apple.InterfaceBuilder.IBCocoaTouchPlugin
com.apple.InterfaceBuilder.IBCocoaTouchPlugin
@@ -408,7 +409,6 @@
YES
backgroundTap:
deleteData:
- sliderChanged:
textFieldDoneEditing:
@@ -416,7 +416,6 @@
id
id
id
- id
diff -r 31c6c36c5d34 -r 36a8cebb91e8 cocoaTouch/otherSrc/PascalImports.h
--- a/cocoaTouch/otherSrc/PascalImports.h Sat Feb 13 12:40:40 2010 +0000
+++ b/cocoaTouch/otherSrc/PascalImports.h Sat Feb 13 16:04:04 2010 +0000
@@ -39,6 +39,7 @@
void HW_chat(void);
void HW_tab(void);
+ void HW_pause(void);
#ifdef __cplusplus
}
diff -r 31c6c36c5d34 -r 36a8cebb91e8 cocoaTouch/resources/background.png
Binary file cocoaTouch/resources/background.png has changed
diff -r 31c6c36c5d34 -r 36a8cebb91e8 cocoaTouch/resources/backgroundBottom.png
Binary file cocoaTouch/resources/backgroundBottom.png has changed
diff -r 31c6c36c5d34 -r 36a8cebb91e8 cocoaTouch/resources/backgroundCenter.png
Binary file cocoaTouch/resources/backgroundCenter.png has changed
diff -r 31c6c36c5d34 -r 36a8cebb91e8 cocoaTouch/resources/backgroundTop.png
Binary file cocoaTouch/resources/backgroundTop.png has changed
diff -r 31c6c36c5d34 -r 36a8cebb91e8 cocoaTouch/resources/borderBottom.png
Binary file cocoaTouch/resources/borderBottom.png has changed
diff -r 31c6c36c5d34 -r 36a8cebb91e8 cocoaTouch/resources/borderTop.png
Binary file cocoaTouch/resources/borderTop.png has changed
diff -r 31c6c36c5d34 -r 36a8cebb91e8 hedgewars/PascalExports.pas
--- a/hedgewars/PascalExports.pas Sat Feb 13 12:40:40 2010 +0000
+++ b/hedgewars/PascalExports.pas Sat Feb 13 16:04:04 2010 +0000
@@ -42,6 +42,7 @@
procedure HW_shoot; cdecl; export;
procedure HW_whereIsHog; cdecl; export;
procedure HW_chat; cdecl; export;
+procedure HW_pause; cdecl; export;
procedure HW_tab; cdecl; export;
{$ENDIF}
@@ -120,6 +121,11 @@
switchAction:= true;
end;
+procedure HW_pause; cdecl; export;
+begin
+ pauseAction:= true;
+end;
+
procedure HW_whereIsHog; cdecl; export;
//var Xcoord, Ycoord: LongInt;
begin
diff -r 31c6c36c5d34 -r 36a8cebb91e8 hedgewars/uKeys.pas
--- a/hedgewars/uKeys.pas Sat Feb 13 12:40:40 2010 +0000
+++ b/hedgewars/uKeys.pas Sat Feb 13 16:04:04 2010 +0000
@@ -76,6 +76,7 @@
tabKey: boolean;
chatAction: boolean;
+ pauseAction: boolean;
switchAction: boolean;
theJoystick: PSDL_Joystick;
@@ -336,6 +337,7 @@
DefaultBinds[25]:= '+left';
DefaultBinds[26]:= '+right';
DefaultBinds[44]:= 'chat';
+DefaultBinds[55]:= 'pause';
{$ELSE}
DefaultBinds[KeyNameToCode('up')]:= '+up';
DefaultBinds[KeyNameToCode('down')]:= '+down';
@@ -376,6 +378,7 @@
tkbdn[32]:= ord(spaceKey);
tkbdn[44]:= ord(chatAction);
+ tkbdn[55]:= ord(pauseAction);
//tkbdn[100]:= ord(switchAction);
leftClick:= false;
@@ -387,6 +390,7 @@
backspaceKey:= false;
chatAction:= false;
+ pauseAction:= false;
//switchAction:= false;
end;
{$ENDIF}
@@ -505,6 +509,7 @@
tabKey:= false;
chatAction:= false;
+ pauseAction:= false;
switchAction:= false;
{$ENDIF}
end;