compilation bugfix and scaling down textures when bigger than screen
authorkoda
Wed, 22 Sep 2010 23:46:38 +0200
changeset 3895 e7c202c08ac1
parent 3893 568bfd083465
child 3897 27e115fa1143
compilation bugfix and scaling down textures when bigger than screen
hedgewars/uStore.pas
project_files/HedgewarsMobile/Classes/GameSetup.m
project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m
project_files/HedgewarsMobile/Classes/SavedGamesViewController.h
--- a/hedgewars/uStore.pas	Wed Sep 22 02:22:15 2010 +0200
+++ b/hedgewars/uStore.pas	Wed Sep 22 23:46:38 2010 +0200
@@ -732,8 +732,13 @@
 end;
 
 procedure DrawCentered(X, Top: LongInt; Source: PTexture);
+var scale: GLfloat;
 begin
-DrawTexture(X - Source^.w shr 1, Top, Source)
+    if (Source^.w + 20) > cScreenWidth then
+        scale:= cScreenWidth / (Source^.w + 20)
+    else
+        scale:= 1.0;
+    DrawTexture(X - round((Source^.w * scale) div 2, Top, Source, scale)
 end;
 
 procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
--- a/project_files/HedgewarsMobile/Classes/GameSetup.m	Wed Sep 22 02:22:15 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameSetup.m	Wed Sep 22 23:46:38 2010 +0200
@@ -26,7 +26,7 @@
 #import "CommodityFunctions.h"
 #import "NSStringExtra.h"
 
-#define BUFFER_SIZE 128
+#define BUFFER_SIZE 64
 
 @implementation GameSetup
 @synthesize systemSettings, gameConfig, savePath;
--- a/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m	Wed Sep 22 02:22:15 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m	Wed Sep 22 23:46:38 2010 +0200
@@ -79,10 +79,12 @@
 
 // main routine for calling the actual game engine
 -(void) startSDLgame:(NSDictionary *)gameDictionary {
-    UIView *blackView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.height, self.view.frame.size.width)];
+    UIWindow *aWin = [[[UIApplication sharedApplication] windows] objectAtIndex:0];
+
+    UIView *blackView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, aWin.frame.size.height, aWin.frame.size.width)];
     blackView.opaque = YES;
     blackView.backgroundColor = [UIColor blackColor];
-    [self.view addSubview:blackView];
+    [aWin addSubview:blackView];
 
     // pull out useful configuration info from various files
     GameSetup *setup = [[GameSetup alloc] initWithDictionary:gameDictionary];
@@ -102,7 +104,7 @@
     isInGame = NO;
     free(gameArgs);
 
-    UIWindow *aWin = [[[UIApplication sharedApplication] windows] objectAtIndex:0]; [aWin makeKeyAndVisible];
+    [aWin makeKeyAndVisible];
     [UIView beginAnimations:@"fading in from ingame" context:NULL];
     [UIView setAnimationDuration:1];
     blackView.alpha = 0;
--- a/project_files/HedgewarsMobile/Classes/SavedGamesViewController.h	Wed Sep 22 02:22:15 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.h	Wed Sep 22 23:46:38 2010 +0200
@@ -22,7 +22,7 @@
 #import <UIKit/UIKit.h>
 
 
-@interface SavedGamesViewController : UIViewController {
+@interface SavedGamesViewController : UITableViewController {
 
 }