hedgewars/hwengine.pas
changeset 2702 48fc46a922fd
parent 2699 249adefa9c1c
child 2705 2b5625c4ec16
equal deleted inserted replaced
2701:3a8560c00f78 2702:48fc46a922fd
    65 //       HHHandlers.inc
    65 //       HHHandlers.inc
    66 //       SinTable.inc
    66 //       SinTable.inc
    67 //       proto.inc
    67 //       proto.inc
    68 
    68 
    69 {$IFDEF IPHONEOS}
    69 {$IFDEF IPHONEOS}
       
    70 type arrayofpchar = array[0..6] of PChar;
    70 procedure DoTimer(Lag: LongInt);
    71 procedure DoTimer(Lag: LongInt);
    71 procedure OnDestroy;
    72 procedure OnDestroy;
    72 procedure MainLoop;
    73 procedure MainLoop;
    73 procedure ShowMainWindow;
    74 procedure ShowMainWindow;
    74 procedure Game; cdecl; export;
    75 procedure Game(gameArgs: arrayofpchar); cdecl; export;
    75 procedure initEverything;
    76 procedure initEverything;
    76 procedure freeEverything;
    77 procedure freeEverything;
    77 
    78 
    78 implementation
    79 implementation
    79 
    80 
   131 				end;
   132 				end;
   132 		end;
   133 		end;
   133 
   134 
   134 	SDL_GL_SwapBuffers();
   135 	SDL_GL_SwapBuffers();
   135 {$IFNDEF IPHONEOS}
   136 {$IFNDEF IPHONEOS}
   136 		// not going to make captures on the iPhone
   137 	// not going to make captures on the iPhone
   137 	if flagMakeCapture then
   138 	if flagMakeCapture then
   138 	begin
   139 	begin
   139 		flagMakeCapture:= false;
   140 		flagMakeCapture:= false;
   140 		s:= 'hw_' + cSeed + '_' + inttostr(GameTicks) + '.tga';
   141 		s:= 'hw_' + cSeed + '_' + inttostr(GameTicks) + '.tga';
   141 		WriteLnToConsole('Saving ' + s);
   142 		WriteLnToConsole('Saving ' + s);
   164 
   165 
   165 ///////////////////
   166 ///////////////////
   166 procedure MainLoop; 
   167 procedure MainLoop; 
   167 var PrevTime,
   168 var PrevTime,
   168     CurrTime: Longword;
   169     CurrTime: Longword;
   169     event: TSDL_Event;
   170     {$IFNDEF IPHONEOS}event: TSDL_Event;{$ENDIF}
   170 begin
   171 begin
   171 
   172 
   172 	PrevTime:= SDL_GetTicks;
   173 	PrevTime:= SDL_GetTicks;
   173 	repeat
   174 	repeat
   174 {$IFNDEF IPHONEOS}
   175 {$IFNDEF IPHONEOS}
   214 	else ParseCommand('fullscr 0', true);
   215 	else ParseCommand('fullscr 0', true);
   215 	SDL_ShowCursor(0)
   216 	SDL_ShowCursor(0)
   216 end;
   217 end;
   217 
   218 
   218 ///////////////
   219 ///////////////
   219 procedure Game;{$IFDEF IPHONEOS}cdecl; export;{$ENDIF}
   220 {$IFDEF IPHONEOS}
       
   221 procedure Game(gameArgs: arrayofpchar); cdecl; export;
       
   222 {$ELSE}
       
   223 procedure Game;cdecl; export;
       
   224 {$ENDIF}
   220 var	p: TPathType;
   225 var	p: TPathType;
   221 	s: shortstring;
   226 	s: shortstring;
   222 begin
   227 begin
   223 {$IFDEF IPHONEOS}
   228 {$IFDEF IPHONEOS}
   224 	initEverything();
   229 	initEverything();
   226 
   231 
   227 	val('320', cScreenWidth);
   232 	val('320', cScreenWidth);
   228 	val('480', cScreenHeight);
   233 	val('480', cScreenHeight);
   229 	cInitWidth:= cScreenWidth;
   234 	cInitWidth:= cScreenWidth;
   230 	cInitHeight:= cScreenHeight;
   235 	cInitHeight:= cScreenHeight;
   231 	cBitsStr:= '16';
   236 	cBitsStr:= '32';
   232 	val(cBitsStr, cBits);
   237 	val(cBitsStr, cBits);
   233 	val('51432', ipcPort);
       
   234 	cFullScreen:= true;
   238 	cFullScreen:= true;
   235 	isSoundEnabled:= false;
       
   236 	cVSyncInUse:= true;
   239 	cVSyncInUse:= true;
   237 	cLocaleFName:= 'en.txt';
       
   238 	val('100', cInitVolume);
       
   239 	val('8', cTimerInterval);
   240 	val('8', cTimerInterval);
   240 	PathPrefix:= 'Data';
   241 	PathPrefix:= 'Data';
       
   242 	cReducedQuality:= false;
   241 	cShowFPS:= true;
   243 	cShowFPS:= true;
   242 	cAltDamage:= false;
   244 
   243 	UserNick:= 'Koda'; //DecodeBase64(ParamStr(15));
   245 	UserNick:= gameArgs[0];
   244 	isMusicEnabled:= false;
   246 	val(gameArgs[1], ipcPort);
   245 	cReducedQuality:= false;
   247 	isSoundEnabled:= gameArgs[2] = '1';
       
   248 	isMusicEnabled:= gameArgs[3] = '1';
       
   249 	cLocaleFName:= gameArgs[4];
       
   250 	val(gameArgs[5], cInitVolume);
       
   251 	cAltDamage:= gameArgs[6] = '1';
   246 {$ENDIF}
   252 {$ENDIF}
   247 
   253 
   248 	for p:= Succ(Low(TPathType)) to High(TPathType) do
   254 	for p:= Succ(Low(TPathType)) to High(TPathType) do
   249 		if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p];
   255 		if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p];
   250 		
   256