objc/pascal finally working
hwengine becomes a library for the iphone
use custom sdl_image to fix bug
remove thread code and forward_argc/forward_argv
--- a/cocoaTouch/GameSetup.h Sat Jan 16 06:48:56 2010 +0000
+++ b/cocoaTouch/GameSetup.h Sat Jan 16 17:30:37 2010 +0000
@@ -23,11 +23,11 @@
@property (nonatomic, retain) NSString *localeString;
@property (retain) NSDictionary *systemSettings;
--(void) setArgsForLocalPlay;
-(void) engineProtocol;
-(void) startThread: (NSString *)selector;
-(void) loadSettingsFromFile:(NSString *)fileName forKey:(NSString *)objName;
--(int) sendToEngine: (NSString *)string;
+-(int) sendToEngine: (NSString *)string;
-(void) unloadSettings;
+
@end
--- a/cocoaTouch/GameSetup.m Sat Jan 16 06:48:56 2010 +0000
+++ b/cocoaTouch/GameSetup.m Sat Jan 16 17:30:37 2010 +0000
@@ -22,7 +22,7 @@
self.localeString = [[[NSLocale currentLocale] localeIdentifier] stringByAppendingString:@".txt"];
self.systemSettings = nil;
engineProtocolStarted = NO;
- ipcPort = 51342;
+ ipcPort = 51432;
return self;
}
@@ -100,8 +100,13 @@
NSLog(@"engineProtocol - sending game config");
// send config data data
-
- // local game
+ /*seed is arbitrary string
+ [16:12] unC0Rr:
+ addteam <color> <team name>
+ [16:13] unC0Rr:
+ addhh <level> <health> <hedgehog name>
+ [16:13] unC0Rr:
+ <level> is 0 for human, 1-5 for bots (5 is the most stupid)*/ // local game
[self sendToEngine:@"TL"];
// seed info
@@ -128,7 +133,7 @@
// various flags
[self sendToEngine:@"e$casefreq 5"];
- // various flags
+ // dimension of the map
[self sendToEngine:@"e$template_filter 1"];
// theme info
@@ -248,7 +253,7 @@
#pragma mark -
#pragma mark Settings setup methods
-(void) loadSettingsFromFile:(NSString *)fileName forKey:(NSString *)objName {
- NSString *filePath = [SDLUIKitDelegate dataFilePath:fileName];
+ NSString *filePath = [[SDLUIKitDelegate sharedAppDelegate] dataFilePath:fileName];
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:filePath];
@@ -262,46 +267,8 @@
}
-(void) unloadSettings {
- [systemSettings dealloc];
-}
-
--(void) setArgsForLocalPlay {
- NSString *portNumber = [[NSString alloc] initWithFormat:@"%d", ipcPort];
- //NSString *username = [[NSString alloc] initWithString:[systemSettings objectForKey:@"username"]];
- /*for (NSString *theString in [NSLocale ISOLanguageCodes]) {
- NSLog(theString);
- }*/
-
- memset(forward_argv, 0, forward_argc);
-
- forward_argc = 18;
- forward_argv = (char **)realloc(forward_argv, forward_argc * sizeof(char *));
- //forward_argv[i] = malloc( (strlen(argv[i])+1) * sizeof(char));
- forward_argv[ 1] = forward_argv[0]; // (UNUSED)
- forward_argv[ 2] = "320"; // cScreenWidth
- forward_argv[ 3] = "480"; // cScreenHeight
- forward_argv[ 4] = "16"; // cBitsStr
- forward_argv[ 5] = [portNumber UTF8String]; // ipcPort;
- forward_argv[ 6] = "1"; // cFullScreen (NO EFFECT)
- forward_argv[ 7] = [[systemSettings objectForKey:@"effects"] UTF8String]; // isSoundEnabled
- forward_argv[ 8] = "1"; // cVSyncInUse (UNUSED)
- forward_argv[ 9] = [localeString UTF8String]; // cLocaleFName
- forward_argv[10] = [[systemSettings objectForKey:@"volume"] UTF8String]; // cInitVolume
- forward_argv[11] = "8"; // cTimerInterval
- forward_argv[12] = "Data"; // PathPrefix
- forward_argv[13] = "1"; // cShowFPS (TOSET?)
- forward_argv[14] = [[systemSettings objectForKey:@"alternate"] UTF8String]; // cAltDamage (TOSET)
- forward_argv[15] = "Koda"; // UserNick (DecodeBase64(ParamStr(15)) FTW) <- TODO
- forward_argv[16] = [[systemSettings objectForKey:@"music"] UTF8String]; // isMusicEnabled
- forward_argv[17] = "0"; // cReducedQuality
-
- [portNumber release];
- return;
+ [systemSettings release];
}
-
-
-
-
@end
--- a/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.h Sat Jan 16 06:48:56 2010 +0000
+++ b/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.h Sat Jan 16 17:30:37 2010 +0000
@@ -39,10 +39,7 @@
@property (nonatomic, retain) GameSetup *setup;
+(SDLUIKitDelegate *)sharedAppDelegate;
+-(NSString *)dataFilePath:(NSString *)fileName;
-(void) startSDLgame;
-+(void) resetFrontend;
-+(NSString *)dataFilePath:(NSString *)fileName;
-int forward_argc;
-char **forward_argv;
@end
--- a/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m Sat Jan 16 06:48:56 2010 +0000
+++ b/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m Sat Jan 16 17:30:37 2010 +0000
@@ -27,6 +27,7 @@
#import "jumphack.h"
#import "SDL_video.h"
#import "GameSetup.h"
+#import "PascalImports.h"
//#import "SoundEffect.h"
// SoundEffect *erasingSound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"Erase" ofType:@"caf"]];
@@ -37,23 +38,11 @@
#undef main
#endif
-extern int SDL_main(int argc, char *argv[]);
-int main (int argc, char **argv) {
- int i;
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- /* store arguments */
- forward_argc = argc;
- forward_argv = (char **)malloc(argc * sizeof(char *));
- for (i = 0; i < argc; i++) {
- forward_argv[i] = malloc( (strlen(argv[i])+1) * sizeof(char));
- strcpy(forward_argv[i], argv[i]);
- }
-
- /* Give over control to run loop, SDLUIKitDelegate will handle most things from here */
- UIApplicationMain(argc, argv, NULL, @"SDLUIKitDelegate");
-
- [pool release];
+int main(int argc, char *argv[]) {
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+ int retVal = UIApplicationMain(argc, argv, nil, @"SDLUIKitDelegate");
+ [pool release];
+ return retVal;
}
@implementation SDLUIKitDelegate
@@ -73,34 +62,36 @@
[super dealloc];
}
--(void) launchSDL_main{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- // must setup arguments in the same thread
- [setup setArgsForLocalPlay];
-
- // run the user's application, passing argc and argv
- SDL_main(forward_argc, forward_argv);
-
- [pool release];
-}
-
-(IBAction) startSDLgame {
[setup startThread:@"engineProtocol"];
[setup loadSettingsFromFile:@"settings.plist" forKey:@"systemSettings"];
// remove the current view to free resources
-/* [UIView beginAnimations:nil context:NULL];
- [UIView setAnimationDuration:1.5];
- controller.view.alpha = 1;
+ [UIView beginAnimations:@"removing main controller" context:NULL];
+ [UIView setAnimationDuration:1];
+ controller.view.alpha = 0;
[UIView commitAnimations];
- [controller.view performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1.5];
-*/
+ [controller.view performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1];
+
NSLog(@"Game is launching...");
- [NSThread detachNewThreadSelector:@selector(launchSDL_main) toTarget:self withObject:nil];
+ // direct execution or thread? check the one that gives most fps
+ // library or call SDL_main? pascal quits at the end of the main
+ Game();
+ NSLog(@"Game is exting...");
+
+ [[window viewWithTag:54867] removeFromSuperview];
+ [setup unloadSettings];
+
+ [window addSubview:controller.view];
+ [window makeKeyAndVisible];
+
+ [UIView beginAnimations:@"inserting main controller" context:NULL];
+ [UIView setAnimationDuration:1];
+ controller.view.alpha = 1;
+ [UIView commitAnimations];
}
// override the direct execution of SDL_main to allow us to implement the frontend (even using a nib)
@@ -116,26 +107,18 @@
}
-(void) applicationWillTerminate:(UIApplication *)application {
- /* free the memory we used to hold copies of argc and argv */
- int i;
- for (i=0; i < forward_argc; i++) {
- free(forward_argv[i]);
- }
- free(forward_argv);
SDL_SendQuit();
/* hack to prevent automatic termination. See SDL_uikitevents.m for details */
// have to remove this otherwise game goes on when pushing the home button
//longjmp(*(jump_env()), 1);
}
--(void) applicationWillResignActive:(UIApplication*)application
-{
+-(void) applicationWillResignActive:(UIApplication*)application {
// NSLog(@"%@", NSStringFromSelector(_cmd));
SDL_SendWindowEvent(self.windowID, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
}
--(void) applicationDidBecomeActive:(UIApplication*)application
-{
+-(void) applicationDidBecomeActive:(UIApplication*)application {
// NSLog(@"%@", NSStringFromSelector(_cmd));
SDL_SendWindowEvent(self.windowID, SDL_WINDOWEVENT_RESTORED, 0, 0);
}
@@ -146,33 +129,8 @@
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
*/
-+(void) resetFrontend {
- [[[SDLUIKitDelegate sharedAppDelegate].window viewWithTag:54867] removeFromSuperview];
- [[SDLUIKitDelegate sharedAppDelegate].window addSubview:[SDLUIKitDelegate sharedAppDelegate].controller.view];
-
- [UIView beginAnimations:nil context:NULL];
- [UIView setAnimationDuration:1];
- [SDLUIKitDelegate sharedAppDelegate].controller.view.alpha = 1;
- [UIView commitAnimations];
-
- [[SDLUIKitDelegate sharedAppDelegate].setup unloadSettings];
- [[SDLUIKitDelegate sharedAppDelegate].window makeKeyAndVisible];
-}
-#pragma mark -
-#pragma mark Convenience methods
-void IPH_returnFrontend (void) {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- [SDLUIKitDelegate resetFrontend];
- NSLog(@"Game exited...");
-
- [pool release];
- [NSThread exit];
-}
-
-
-+(NSString *)dataFilePath: (NSString *)fileName {
+-(NSString *)dataFilePath: (NSString *)fileName {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
return [documentsDirectory stringByAppendingPathComponent:fileName];
--- a/cocoaTouch/SettingsViewController.m Sat Jan 16 06:48:56 2010 +0000
+++ b/cocoaTouch/SettingsViewController.m Sat Jan 16 17:30:37 2010 +0000
@@ -14,7 +14,7 @@
@synthesize username, password, musicOn, effectsOn, altDamageOn, volumeSlider, volumeLabel;
-(void) viewDidLoad {
- NSString *filePath = [SDLUIKitDelegate dataFilePath:@"settings.plist"];
+ NSString *filePath = [[SDLUIKitDelegate sharedAppDelegate] dataFilePath:@"settings.plist"];
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
NSUserDefaults *data = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath];
@@ -79,7 +79,7 @@
[saveArray setObject:tmpAlt forKey:@"alternate"];
[saveArray setObject:volumeLabel.text forKey:@"volume"];
- [saveArray writeToFile:[SDLUIKitDelegate dataFilePath:@"settings.plist"] atomically:YES];
+ [saveArray writeToFile:[[SDLUIKitDelegate sharedAppDelegate] dataFilePath:@"settings.plist"] atomically:YES];
[saveArray release];
[super viewWillDisappear:animated];
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cocoaTouch/otherSrc/IMG.c Sat Jan 16 17:30:37 2010 +0000
@@ -0,0 +1,152 @@
+/*
+ SDL_image: An example image loading library for use with SDL
+ Copyright (C) 1997-2009 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+/* A simple library to load images of various formats as SDL surfaces */
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "SDL_image.h"
+
+#define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0]))
+
+/* Table of image detection and loading functions */
+static struct {
+ char *type;
+ int (SDLCALL *is)(SDL_RWops *src);
+ SDL_Surface *(SDLCALL *load)(SDL_RWops *src);
+} supported[] = {
+ /* keep magicless formats first */
+ { "PNG", IMG_isPNG, IMG_LoadPNG_RW }
+};
+
+
+extern int IMG_InitPNG();
+extern void IMG_QuitPNG();
+
+static int initialized = 0;
+
+int IMG_Init(int flags)
+{
+ int result = 0;
+
+ if (flags & IMG_INIT_PNG) {
+ if ((initialized & IMG_INIT_PNG) || IMG_InitPNG() == 0) {
+ result |= IMG_INIT_PNG;
+ }
+ }
+ initialized |= result;
+
+ return (result);
+}
+
+void IMG_Quit()
+{
+ if (initialized & IMG_INIT_PNG) {
+ IMG_QuitPNG();
+ }
+ initialized = 0;
+}
+
+/* Load an image from a file */
+SDL_Surface *IMG_Load(const char *file)
+{
+ SDL_RWops *src = SDL_RWFromFile(file, "rb");
+ char *ext = strrchr(file, '.');
+ if(ext) {
+ ext++;
+ }
+ if(!src) {
+ /* The error message has been set in SDL_RWFromFile */
+ return NULL;
+ }
+ return IMG_LoadTyped_RW(src, 1, ext);
+}
+
+/* Load an image from an SDL datasource (for compatibility) */
+SDL_Surface *IMG_Load_RW(SDL_RWops *src, int freesrc)
+{
+ return IMG_LoadTyped_RW(src, freesrc, NULL);
+}
+
+/* Portable case-insensitive string compare function */
+static int IMG_string_equals(const char *str1, const char *str2)
+{
+ while ( *str1 && *str2 ) {
+ if ( toupper((unsigned char)*str1) !=
+ toupper((unsigned char)*str2) )
+ break;
+ ++str1;
+ ++str2;
+ }
+ return (!*str1 && !*str2);
+}
+
+/* Load an image from an SDL datasource, optionally specifying the type */
+SDL_Surface *IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, char *type)
+{
+ int i;
+ SDL_Surface *image;
+
+ /* Make sure there is something to do.. */
+ if ( src == NULL ) {
+ IMG_SetError("Passed a NULL data source");
+ return(NULL);
+ }
+
+ /* See whether or not this data source can handle seeking */
+ if ( SDL_RWseek(src, 0, RW_SEEK_CUR) < 0 ) {
+ IMG_SetError("Can't seek in this data source");
+ if(freesrc)
+ SDL_RWclose(src);
+ return(NULL);
+ }
+
+ /* Detect the type of image being loaded */
+ image = NULL;
+ for ( i=0; i < ARRAYSIZE(supported); ++i ) {
+ if(supported[i].is) {
+ if(!supported[i].is(src))
+ continue;
+ } else {
+ /* magicless format */
+ if(!type
+ || !IMG_string_equals(type, supported[i].type))
+ continue;
+ }
+#ifdef DEBUG_IMGLIB
+ fprintf(stderr, "IMGLIB: Loading image as %s\n", supported[i].type);
+#endif
+ image = supported[i].load(src);
+ if(freesrc)
+ SDL_RWclose(src);
+ return image;
+ }
+
+ if ( freesrc ) {
+ SDL_RWclose(src);
+ }
+ IMG_SetError("Unsupported image format");
+ return NULL;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cocoaTouch/otherSrc/IMG_png.c Sat Jan 16 17:30:37 2010 +0000
@@ -0,0 +1,502 @@
+/*
+ SDL_image: An example image loading library for use with SDL
+ Copyright (C) 1997-2009 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+/* This is a PNG image file loading framework */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "SDL_image.h"
+
+
+/*=============================================================================
+ File: SDL_png.c
+ Purpose: A PNG loader and saver for the SDL library
+ Revision:
+ Created by: Philippe Lavoie (2 November 1998)
+ lavoie@zeus.genie.uottawa.ca
+ Modified by:
+
+ Copyright notice:
+ Copyright (C) 1998 Philippe Lavoie
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ Comments: The load and save routine are basically the ones you can find
+ in the example.c file from the libpng distribution.
+
+ Changes:
+ 5/17/99 - Modified to use the new SDL data sources - Sam Lantinga
+
+=============================================================================*/
+
+#include "SDL_endian.h"
+
+#ifdef macintosh
+#define MACOS
+#endif
+#include "png.h"
+
+
+static struct {
+ int loaded;
+ void *handle;
+ png_infop (*png_create_info_struct) (png_structp png_ptr);
+ png_structp (*png_create_read_struct) (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn);
+ void (*png_destroy_read_struct) (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr);
+ png_uint_32 (*png_get_IHDR) (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, int *interlace_method, int *compression_method, int *filter_method);
+ png_voidp (*png_get_io_ptr) (png_structp png_ptr);
+ png_uint_32 (*png_get_tRNS) (png_structp png_ptr, png_infop info_ptr, png_bytep *trans, int *num_trans, png_color_16p *trans_values);
+ png_uint_32 (*png_get_valid) (png_structp png_ptr, png_infop info_ptr, png_uint_32 flag);
+ void (*png_read_image) (png_structp png_ptr, png_bytepp image);
+ void (*png_read_info) (png_structp png_ptr, png_infop info_ptr);
+ void (*png_read_update_info) (png_structp png_ptr, png_infop info_ptr);
+ void (*png_set_expand) (png_structp png_ptr);
+ void (*png_set_gray_to_rgb) (png_structp png_ptr);
+ void (*png_set_packing) (png_structp png_ptr);
+ void (*png_set_read_fn) (png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn);
+ void (*png_set_strip_16) (png_structp png_ptr);
+ int (*png_sig_cmp) (png_bytep sig, png_size_t start, png_size_t num_to_check);
+} lib;
+
+#ifdef LOAD_PNG_DYNAMIC
+int IMG_InitPNG()
+{
+ if ( lib.loaded == 0 ) {
+ lib.handle = SDL_LoadObject(LOAD_PNG_DYNAMIC);
+ if ( lib.handle == NULL ) {
+ return -1;
+ }
+ lib.png_create_info_struct =
+ (png_infop (*) (png_structp))
+ SDL_LoadFunction(lib.handle, "png_create_info_struct");
+ if ( lib.png_create_info_struct == NULL ) {
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
+ lib.png_create_read_struct =
+ (png_structp (*) (png_const_charp, png_voidp, png_error_ptr, png_error_ptr))
+ SDL_LoadFunction(lib.handle, "png_create_read_struct");
+ if ( lib.png_create_read_struct == NULL ) {
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
+ lib.png_destroy_read_struct =
+ (void (*) (png_structpp, png_infopp, png_infopp))
+ SDL_LoadFunction(lib.handle, "png_destroy_read_struct");
+ if ( lib.png_destroy_read_struct == NULL ) {
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
+ lib.png_get_IHDR =
+ (png_uint_32 (*) (png_structp, png_infop, png_uint_32 *, png_uint_32 *, int *, int *, int *, int *, int *))
+ SDL_LoadFunction(lib.handle, "png_get_IHDR");
+ if ( lib.png_get_IHDR == NULL ) {
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
+ lib.png_get_io_ptr =
+ (png_voidp (*) (png_structp))
+ SDL_LoadFunction(lib.handle, "png_get_io_ptr");
+ if ( lib.png_get_io_ptr == NULL ) {
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
+ lib.png_get_tRNS =
+ (png_uint_32 (*) (png_structp, png_infop, png_bytep *, int *, png_color_16p *))
+ SDL_LoadFunction(lib.handle, "png_get_tRNS");
+ if ( lib.png_get_tRNS == NULL ) {
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
+ lib.png_get_valid =
+ (png_uint_32 (*) (png_structp, png_infop, png_uint_32))
+ SDL_LoadFunction(lib.handle, "png_get_valid");
+ if ( lib.png_get_valid == NULL ) {
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
+ lib.png_read_image =
+ (void (*) (png_structp, png_bytepp))
+ SDL_LoadFunction(lib.handle, "png_read_image");
+ if ( lib.png_read_image == NULL ) {
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
+ lib.png_read_info =
+ (void (*) (png_structp, png_infop))
+ SDL_LoadFunction(lib.handle, "png_read_info");
+ if ( lib.png_read_info == NULL ) {
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
+ lib.png_read_update_info =
+ (void (*) (png_structp, png_infop))
+ SDL_LoadFunction(lib.handle, "png_read_update_info");
+ if ( lib.png_read_update_info == NULL ) {
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
+ lib.png_set_expand =
+ (void (*) (png_structp))
+ SDL_LoadFunction(lib.handle, "png_set_expand");
+ if ( lib.png_set_expand == NULL ) {
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
+ lib.png_set_gray_to_rgb =
+ (void (*) (png_structp))
+ SDL_LoadFunction(lib.handle, "png_set_gray_to_rgb");
+ if ( lib.png_set_gray_to_rgb == NULL ) {
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
+ lib.png_set_packing =
+ (void (*) (png_structp))
+ SDL_LoadFunction(lib.handle, "png_set_packing");
+ if ( lib.png_set_packing == NULL ) {
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
+ lib.png_set_read_fn =
+ (void (*) (png_structp, png_voidp, png_rw_ptr))
+ SDL_LoadFunction(lib.handle, "png_set_read_fn");
+ if ( lib.png_set_read_fn == NULL ) {
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
+ lib.png_set_strip_16 =
+ (void (*) (png_structp))
+ SDL_LoadFunction(lib.handle, "png_set_strip_16");
+ if ( lib.png_set_strip_16 == NULL ) {
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
+ lib.png_sig_cmp =
+ (int (*) (png_bytep, png_size_t, png_size_t))
+ SDL_LoadFunction(lib.handle, "png_sig_cmp");
+ if ( lib.png_sig_cmp == NULL ) {
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
+ }
+ ++lib.loaded;
+
+ return 0;
+}
+void IMG_QuitPNG()
+{
+ if ( lib.loaded == 0 ) {
+ return;
+ }
+ if ( lib.loaded == 1 ) {
+ SDL_UnloadObject(lib.handle);
+ }
+ --lib.loaded;
+}
+#else
+int IMG_InitPNG()
+{
+ if ( lib.loaded == 0 ) {
+ lib.png_create_info_struct = png_create_info_struct;
+ lib.png_create_read_struct = png_create_read_struct;
+ lib.png_destroy_read_struct = png_destroy_read_struct;
+ lib.png_get_IHDR = png_get_IHDR;
+ lib.png_get_io_ptr = png_get_io_ptr;
+ lib.png_get_tRNS = png_get_tRNS;
+ lib.png_get_valid = png_get_valid;
+ lib.png_read_image = png_read_image;
+ lib.png_read_info = png_read_info;
+ lib.png_read_update_info = png_read_update_info;
+ lib.png_set_expand = png_set_expand;
+ lib.png_set_gray_to_rgb = png_set_gray_to_rgb;
+ lib.png_set_packing = png_set_packing;
+ lib.png_set_read_fn = png_set_read_fn;
+ lib.png_set_strip_16 = png_set_strip_16;
+ lib.png_sig_cmp = png_sig_cmp;
+ }
+ ++lib.loaded;
+
+ return 0;
+}
+void IMG_QuitPNG()
+{
+ if ( lib.loaded == 0 ) {
+ return;
+ }
+ if ( lib.loaded == 1 ) {
+ }
+ --lib.loaded;
+}
+#endif /* LOAD_PNG_DYNAMIC */
+
+/* See if an image is contained in a data source */
+int IMG_isPNG(SDL_RWops *src)
+{
+ int start;
+ int is_PNG;
+ Uint8 magic[4];
+
+ if ( !src )
+ return 0;
+ start = SDL_RWtell(src);
+ is_PNG = 0;
+ if ( SDL_RWread(src, magic, 1, sizeof(magic)) == sizeof(magic) ) {
+ if ( magic[0] == 0x89 &&
+ magic[1] == 'P' &&
+ magic[2] == 'N' &&
+ magic[3] == 'G' ) {
+ is_PNG = 1;
+ }
+ }
+ SDL_RWseek(src, start, RW_SEEK_SET);
+ return(is_PNG);
+}
+
+/* Load a PNG type image from an SDL datasource */
+static void png_read_data(png_structp ctx, png_bytep area, png_size_t size)
+{
+ SDL_RWops *src;
+
+ src = (SDL_RWops *)lib.png_get_io_ptr(ctx);
+ SDL_RWread(src, area, size, 1);
+}
+SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
+{
+ int start;
+ const char *error;
+ SDL_Surface *volatile surface;
+ png_structp png_ptr;
+ png_infop info_ptr;
+ png_uint_32 width, height;
+ int bit_depth, color_type, interlace_type;
+ Uint32 Rmask;
+ Uint32 Gmask;
+ Uint32 Bmask;
+ Uint32 Amask;
+ SDL_Palette *palette;
+ png_bytep *volatile row_pointers;
+ int row, i;
+ volatile int ckey = -1;
+ png_color_16 *transv;
+
+ if ( !src ) {
+ /* The error message has been set in SDL_RWFromFile */
+ return NULL;
+ }
+ start = SDL_RWtell(src);
+
+ if ( !IMG_Init(IMG_INIT_PNG) ) {
+ return NULL;
+ }
+
+ /* Initialize the data we will clean up when we're done */
+ error = NULL;
+ png_ptr = NULL; info_ptr = NULL; row_pointers = NULL; surface = NULL;
+
+ /* Create the PNG loading context structure */
+ png_ptr = lib.png_create_read_struct(PNG_LIBPNG_VER_STRING,
+ NULL,NULL,NULL);
+ if (png_ptr == NULL){
+ error = "Couldn't allocate memory for PNG file or incompatible PNG dll";
+ goto done;
+ }
+
+ /* Allocate/initialize the memory for image information. REQUIRED. */
+ info_ptr = lib.png_create_info_struct(png_ptr);
+ if (info_ptr == NULL) {
+ error = "Couldn't create image information for PNG file";
+ goto done;
+ }
+
+ /* Set error handling if you are using setjmp/longjmp method (this is
+ * the normal method of doing things with libpng). REQUIRED unless you
+ * set up your own error handlers in png_create_read_struct() earlier.
+ */
+ if ( setjmp(png_ptr->jmpbuf) ) {
+ error = "Error reading the PNG file.";
+ goto done;
+ }
+
+ /* Set up the input control */
+ lib.png_set_read_fn(png_ptr, src, png_read_data);
+
+ /* Read PNG header info */
+ lib.png_read_info(png_ptr, info_ptr);
+ lib.png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth,
+ &color_type, &interlace_type, NULL, NULL);
+
+ /* tell libpng to strip 16 bit/color files down to 8 bits/color */
+ lib.png_set_strip_16(png_ptr) ;
+
+ /* Extract multiple pixels with bit depths of 1, 2, and 4 from a single
+ * byte into separate bytes (useful for paletted and grayscale images).
+ */
+ lib.png_set_packing(png_ptr);
+
+ /* scale greyscale values to the range 0..255 */
+ if(color_type == PNG_COLOR_TYPE_GRAY)
+ lib.png_set_expand(png_ptr);
+
+ /* For images with a single "transparent colour", set colour key;
+ if more than one index has transparency, or if partially transparent
+ entries exist, use full alpha channel */
+ if (lib.png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
+ int num_trans;
+ Uint8 *trans;
+ lib.png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans,
+ &transv);
+ if(color_type == PNG_COLOR_TYPE_PALETTE) {
+ /* Check if all tRNS entries are opaque except one */
+ int t = -1;
+ for(i = 0; i < num_trans; i++)
+ if(trans[i] == 0) {
+ if(t >= 0)
+ break;
+ t = i;
+ } else if(trans[i] != 255)
+ break;
+ if(i == num_trans) {
+ /* exactly one transparent index */
+ ckey = t;
+ } else {
+ /* more than one transparent index, or translucency */
+ lib.png_set_expand(png_ptr);
+ }
+ } else
+ ckey = 0; /* actual value will be set later */
+ }
+
+ if ( color_type == PNG_COLOR_TYPE_GRAY_ALPHA )
+ lib.png_set_gray_to_rgb(png_ptr);
+
+ lib.png_read_update_info(png_ptr, info_ptr);
+
+ lib.png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth,
+ &color_type, &interlace_type, NULL, NULL);
+
+ /* Allocate the SDL surface to hold the image */
+ Rmask = Gmask = Bmask = Amask = 0 ;
+ if ( color_type != PNG_COLOR_TYPE_PALETTE ) {
+ if ( SDL_BYTEORDER == SDL_LIL_ENDIAN ) {
+ Rmask = 0x000000FF;
+ Gmask = 0x0000FF00;
+ Bmask = 0x00FF0000;
+ Amask = (info_ptr->channels == 4) ? 0xFF000000 : 0;
+ } else {
+ int s = (info_ptr->channels == 4) ? 0 : 8;
+ Rmask = 0xFF000000 >> s;
+ Gmask = 0x00FF0000 >> s;
+ Bmask = 0x0000FF00 >> s;
+ Amask = 0x000000FF >> s;
+ }
+ }
+ surface = SDL_AllocSurface(SDL_SWSURFACE, width, height,
+ bit_depth*info_ptr->channels, Rmask,Gmask,Bmask,Amask);
+ if ( surface == NULL ) {
+ error = "Out of memory";
+ goto done;
+ }
+
+ if(ckey != -1) {
+ if(color_type != PNG_COLOR_TYPE_PALETTE)
+ /* FIXME: Should these be truncated or shifted down? */
+ ckey = SDL_MapRGB(surface->format,
+ (Uint8)transv->red,
+ (Uint8)transv->green,
+ (Uint8)transv->blue);
+ SDL_SetColorKey(surface, SDL_SRCCOLORKEY, ckey);
+ }
+
+ /* Create the array of pointers to image data */
+ row_pointers = (png_bytep*) malloc(sizeof(png_bytep)*height);
+ if ( (row_pointers == NULL) ) {
+ error = "Out of memory";
+ goto done;
+ }
+ for (row = 0; row < (int)height; row++) {
+ row_pointers[row] = (png_bytep)
+ (Uint8 *)surface->pixels + row*surface->pitch;
+ }
+
+ /* Read the entire image in one go */
+ lib.png_read_image(png_ptr, row_pointers);
+
+ /* and we're done! (png_read_end() can be omitted if no processing of
+ * post-IDAT text/time/etc. is desired)
+ * In some cases it can't read PNG's created by some popular programs (ACDSEE),
+ * we do not want to process comments, so we omit png_read_end
+
+ lib.png_read_end(png_ptr, info_ptr);
+ */
+
+ /* Load the palette, if any */
+ palette = surface->format->palette;
+ if ( palette ) {
+ if(color_type == PNG_COLOR_TYPE_GRAY) {
+ palette->ncolors = 256;
+ for(i = 0; i < 256; i++) {
+ palette->colors[i].r = i;
+ palette->colors[i].g = i;
+ palette->colors[i].b = i;
+ }
+ } else if (info_ptr->num_palette > 0 ) {
+ palette->ncolors = info_ptr->num_palette;
+ for( i=0; i<info_ptr->num_palette; ++i ) {
+ palette->colors[i].b = info_ptr->palette[i].blue;
+ palette->colors[i].g = info_ptr->palette[i].green;
+ palette->colors[i].r = info_ptr->palette[i].red;
+ }
+ }
+ }
+
+done: /* Clean up and return */
+ if ( png_ptr ) {
+ lib.png_destroy_read_struct(&png_ptr,
+ info_ptr ? &info_ptr : (png_infopp)0,
+ (png_infopp)0);
+ }
+ if ( row_pointers ) {
+ free(row_pointers);
+ }
+ if ( error ) {
+ SDL_RWseek(src, start, RW_SEEK_SET);
+ if ( surface ) {
+ SDL_FreeSurface(surface);
+ surface = NULL;
+ }
+ IMG_SetError(error);
+ }
+ return(surface);
+}
--- a/cocoaTouch/otherSrc/PascalImports.h Sat Jan 16 06:48:56 2010 +0000
+++ b/cocoaTouch/otherSrc/PascalImports.h Sat Jan 16 17:30:37 2010 +0000
@@ -17,11 +17,12 @@
/* add C declarations below for all exported Pascal functions/procedure
* that you want to use
*/
-
+
+ void Game(void);
+
+
int HW_protoVer(void);
-
- void Game(void);
-
+
void HW_click(void);
void HW_zoomIn(void);
void HW_zoomOut(void);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cocoaTouch/otherSrc/SDL_image.h Sat Jan 16 17:30:37 2010 +0000
@@ -0,0 +1,88 @@
+/*
+ SDL_image: An example image loading library for use with SDL
+ Copyright (C) 1997-2009 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Sam Lantinga
+ slouken@libsdl.org
+*/
+
+/* A simple library to load images of various formats as SDL surfaces */
+
+#ifndef _SDL_IMAGE_H
+#define _SDL_IMAGE_H
+
+#include "SDL.h"
+#include "SDL_version.h"
+#include "begin_code.h"
+
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
+*/
+#define SDL_IMAGE_MAJOR_VERSION 1
+#define SDL_IMAGE_MINOR_VERSION 2
+#define SDL_IMAGE_PATCHLEVEL 10
+
+typedef enum
+{
+ IMG_INIT_JPG = 0x00000001,
+ IMG_INIT_PNG = 0x00000002,
+ IMG_INIT_TIF = 0x00000004
+} IMG_InitFlags;
+
+/* Loads dynamic libraries and prepares them for use. Flags should be
+ one or more flags from IMG_InitFlags OR'd together.
+ It returns the flags successfully initialized, or 0 on failure.
+ */
+extern DECLSPEC int SDLCALL IMG_Init(int flags);
+
+/* Unloads libraries loaded with IMG_Init */
+extern DECLSPEC void SDLCALL IMG_Quit(void);
+
+/* Load an image from an SDL data source.
+ The 'type' may be one of: "BMP", "GIF", "PNG", etc.
+
+ If the image format supports a transparent pixel, SDL will set the
+ colorkey for the surface. You can enable RLE acceleration on the
+ surface afterwards by calling:
+ SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
+ */
+extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, char *type);
+/* Convenience functions */
+extern DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char *file);
+extern DECLSPEC SDL_Surface * SDLCALL IMG_Load_RW(SDL_RWops *src, int freesrc);
+
+/* Functions to detect a file type, given a seekable source */
+extern DECLSPEC int SDLCALL IMG_isPNG(SDL_RWops *src);
+
+/* Individual loading functions */
+extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNG_RW(SDL_RWops *src);
+
+/* We'll use SDL for reporting errors */
+#define IMG_SetError SDL_SetError
+#define IMG_GetError SDL_GetError
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+#include "close_code.h"
+
+#endif /* _SDL_IMAGE_H */
--- a/hedgewars/PascalExports.pas Sat Jan 16 06:48:56 2010 +0000
+++ b/hedgewars/PascalExports.pas Sat Jan 16 17:30:37 2010 +0000
@@ -21,7 +21,6 @@
// called by pascal code, they deal with the objc code
function IPH_getDocumentsPath: PChar; cdecl; external;
procedure IPH_showControls; cdecl; external;
-procedure IPH_returnFrontend; cdecl; external;
// retrieve protocol information
function HW_protoVer: LongInt; cdecl; export;
@@ -48,94 +47,71 @@
{$IFDEF IPHONEOS}
function HW_protoVer: LongInt; cdecl; export;
begin
- WriteLnToConsole('HW - protocol version');
HW_protoVer:= cNetProtoVersion;
end;
+
procedure HW_click; cdecl; export;
begin
- WriteLnToConsole('HW - left click');
leftClick:= true;
- exit
end;
procedure HW_zoomIn; cdecl; export;
begin
- WriteLnToConsole('HW - zooming in');
wheelUp:= true;
- exit
end;
procedure HW_zoomOut; cdecl; export;
begin
- WriteLnToConsole('HW - zooming out');
wheelDown:= true;
- exit
end;
procedure HW_zoomReset; cdecl; export;
begin
- WriteLnToConsole('HW - reset zoom');
middleClick:= true;
- exit
end;
procedure HW_ammoMenu; cdecl; export;
begin
- WriteLnToConsole('HW - right click');
rightClick:= true;
- exit
end;
procedure HW_allKeysUp; cdecl; export;
begin
- WriteLnToConsole('HW - resetting keyboard');
-
upKey:= false;
downKey:= false;
leftKey:= false;
rightKey:= false;
spaceKey:= false;
- exit
end;
procedure HW_walkLeft; cdecl; export;
begin
- WriteLnToConsole('HW - walking left');
leftKey:= true;
- exit
end;
procedure HW_walkRight; cdecl; export;
begin
- WriteLnToConsole('HW - walking right');
rightKey:= true;
- exit
end;
procedure HW_aimUp; cdecl; export;
begin
- WriteLnToConsole('HW - aiming upwards');
upKey:= true;
- exit
end;
procedure HW_aimDown; cdecl; export;
begin
- WriteLnToConsole('HW - aiming downwards');
downKey:= true;
- exit
end;
procedure HW_shoot; cdecl; export;
begin
- WriteLnToConsole('HW - shooting');
spaceKey:= true;
- exit
end;
procedure HW_whereIsHog; cdecl; export;
-var Xcoord, Ycoord: LongInt;
+//var Xcoord, Ycoord: LongInt;
begin
//Xcoord:= Gear^.dX + WorldDx;
WriteLnToConsole('HW - hog is at x: ' + ' y:');
--- a/hedgewars/SDLh.pas Sat Jan 16 06:48:56 2010 +0000
+++ b/hedgewars/SDLh.pas Sat Jan 16 17:30:37 2010 +0000
@@ -42,8 +42,8 @@
{$ENDIF}
{$IFDEF DARWIN}
- {$PASCALMAINNAME SDL_main}
{$IFNDEF IPHONEOS}
+ {$PASCALMAINNAME SDL_main}
{$linkframework Cocoa}
{$linkframework SDL}
{$linkframework SDL_net}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/hwLibrary.pas Sat Jan 16 17:30:37 2010 +0000
@@ -0,0 +1,18 @@
+// fptest
+//
+// Created by Vittorio on 08/01/10.
+// Copyright __MyCompanyName__ 2010. All rights reserved.
+
+Library hwLibrary;
+
+// Add all your Pascal units to the "uses" clause below to add them to the program.
+
+// Mark all Pascal procedures/functions that you wish to call from C/C++/Objective-C code using
+// "cdecl; export;" (see the fpclogo.pas unit for an example), and then add C-declarations for
+// these procedures/functions to the PascalImports.h file (also in the "Pascal Sources" group)
+// to make these functions available in the C/C++/Objective-C source files
+// (add "#include PascalImports.h" near the top of these files if it's not there yet)
+uses hwengine;
+
+end.
+
--- a/hedgewars/hwengine.pas Sat Jan 16 06:48:56 2010 +0000
+++ b/hedgewars/hwengine.pas Sat Jan 16 17:30:37 2010 +0000
@@ -18,13 +18,13 @@
{$INCLUDE "options.inc"}
+{$IFDEF IPHONEOS}
+unit hwengine;
+interface
+{$ELSE}
program hwengine;
+{$ENDIF}
uses SDLh in 'SDLh.pas',
-{$IFDEF GLES11}
- gles11,
-{$ELSE}
- GL,
-{$ENDIF}
uConsts in 'uConsts.pas',
uGame in 'uGame.pas',
uMisc in 'uMisc.pas',
@@ -65,9 +65,18 @@
// SinTable.inc
// proto.inc
-var recordFileName : shortstring = '';
+{$IFDEF IPHONEOS}
+procedure DoTimer(Lag: LongInt);
+procedure OnDestroy;
+procedure MainLoop;
+procedure ShowMainWindow;
+procedure Game; cdecl; export;
+implementation
+
+{$ELSE}
procedure OnDestroy; forward;
+{$ENDIF}
////////////////////////////////
procedure DoTimer(Lag: LongInt);
@@ -75,71 +84,60 @@
var s: string;
{$ENDIF}
begin
-inc(RealTicks, Lag);
+ inc(RealTicks, Lag);
-case GameState of
- gsLandGen: begin
- GenMap;
- GameState:= gsStart;
- end;
- gsStart: begin
- if HasBorder then DisableSomeWeapons;
- AddClouds;
- AssignHHCoords;
- AddMiscGears;
- StoreLoad;
- InitWorld;
- ResetKbd;
- SoundLoad;
- if GameType = gmtSave then
- begin
- isSEBackup:= isSoundEnabled;
- isSoundEnabled:= false
+ case GameState of
+ gsLandGen: begin
+ GenMap;
+ GameState:= gsStart;
+ end;
+ gsStart: begin
+ if HasBorder then DisableSomeWeapons;
+ AddClouds;
+ AssignHHCoords;
+ AddMiscGears;
+ StoreLoad;
+ InitWorld;
+ ResetKbd;
+ SoundLoad;
+ if GameType = gmtSave then
+ begin
+ isSEBackup:= isSoundEnabled;
+ isSoundEnabled:= false
+ end;
+ FinishProgress;
+ PlayMusic;
+ SetScale(zoom);
+ GameState:= gsGame;
end;
- FinishProgress;
- PlayMusic;
- SetScale(zoom);
- GameState:= gsGame;
- end;
- gsConfirm,
- gsGame: begin
- DrawWorld(Lag); // never place between ProcessKbd and DoGameTick - bugs due to /put cmd and isCursorVisible
- ProcessKbd;
- DoGameTick(Lag);
- ProcessVisualGears(Lag);
- end;
- gsChat: begin
- DrawWorld(Lag);
- DoGameTick(Lag);
- ProcessVisualGears(Lag);
- end;
- gsExit: begin
- OnDestroy;
- end;
- end;
+ gsConfirm,
+ gsGame: begin
+ DrawWorld(Lag); // never place between ProcessKbd and DoGameTick - bugs due to /put cmd and isCursorVisible
+ ProcessKbd;
+ DoGameTick(Lag);
+ ProcessVisualGears(Lag);
+ end;
+ gsChat: begin
+ DrawWorld(Lag);
+ DoGameTick(Lag);
+ ProcessVisualGears(Lag);
+ end;
+ gsExit: begin
+ isTerminated:= true;
+ end;
+ end;
-SDL_GL_SwapBuffers();
+ SDL_GL_SwapBuffers();
{$IFNDEF IPHONEOS}
-// not going to make captures on the iPhone (nor resizing)
-if flagMakeCapture then
+ // not going to make captures on the iPhone
+ if flagMakeCapture then
begin
- flagMakeCapture:= false;
- s:= 'hw_' + cSeed + '_' + inttostr(GameTicks) + '.tga';
- WriteLnToConsole('Saving ' + s);
- MakeScreenshot(s);
-// SDL_SaveBMP_RW(SDLPrimSurface, SDL_RWFromFile(Str2PChar(s), 'wb'), 1)
+ flagMakeCapture:= false;
+ s:= 'hw_' + cSeed + '_' + inttostr(GameTicks) + '.tga';
+ WriteLnToConsole('Saving ' + s);
+ MakeScreenshot(s);
+ //SDL_SaveBMP_RW(SDLPrimSurface, SDL_RWFromFile(Str2PChar(s), 'wb'), 1)
end;
-end;
-
-////////////////////////////////
-procedure Resize(w, h: LongInt);
-begin
-cScreenWidth:= w;
-cScreenHeight:= h;
-if cFullScreen then
- ParseCommand('/fullscr 1', true)
-else
- ParseCommand('/fullscr 0', true);
{$ENDIF}
end;
@@ -155,85 +153,170 @@
CloseIPC();
TTF_Quit();
SDL_Quit();
-{$IFDEF IPHONEOS}
- IPH_returnFrontend();
-{$ELSE}
- halt();
-{$ENDIF}
+ exit();
end;
///////////////////
-procedure MainLoop;
+procedure MainLoop;
var PrevTime,
CurrTime: Longword;
event: TSDL_Event;
-{$IFDEF TOUCHINPUT}
-//var tiltValue: LongInt;
+begin
+
+ PrevTime:= SDL_GetTicks;
+ repeat
+{$IFNDEF IPHONEOS}
+// have to remove this cycle because otherwise it segfaults at exit
+ while SDL_PollEvent(@event) <> 0 do
+ begin
+ case event.type_ of
+ SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode);
+{$IFDEF SDL13}
+ SDL_WINDOWEVENT:
+{$ELSE}
+ SDL_ACTIVEEVENT:
{$ENDIF}
-begin
-PrevTime:= SDL_GetTicks;
-repeat
-while SDL_PollEvent(@event) <> 0 do
- case event.type_ of
-{$IFDEF SDL13}
- SDL_WINDOWEVENT:
-{$ELSE}
- SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode);
- SDL_ACTIVEEVENT:
+ if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then
+ cHasFocus:= event.active.gain = 1;
+ //SDL_VIDEORESIZE: Resize(max(event.resize.w, 600), max(event.resize.h, 450));
+ SDL_MOUSEBUTTONDOWN: if event.button.button = SDL_BUTTON_WHEELDOWN then uKeys.wheelDown:= true;
+ SDL_MOUSEBUTTONUP: if event.button.button = SDL_BUTTON_WHEELUP then uKeys.wheelUp:= true;
+ SDL_JOYAXISMOTION: ControllerAxisEvent(event.jaxis.which, event.jaxis.axis, event.jaxis.value);
+ SDL_JOYHATMOTION: ControllerHatEvent(event.jhat.which, event.jhat.hat, event.jhat.value);
+ SDL_JOYBUTTONDOWN: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, true);
+ SDL_JOYBUTTONUP: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, false);
+ SDL_QUITEV: isTerminated:= true
+ end; // end case event.type_ of
+ end; // end while SDL_PollEvent(@event) <> 0 do
{$ENDIF}
- if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then
- cHasFocus:= event.active.gain = 1;
- //SDL_VIDEORESIZE: Resize(max(event.resize.w, 600), max(event.resize.h, 450));
-{$IFDEF IPHONEOS}
-(* SDL_JOYAXISMOTION: begin
- {* axis 0 = left and right;
- axis 1 = up and down;
- axis 2 = back and forth; *}
+ CurrTime:= SDL_GetTicks;
+ if PrevTime + cTimerInterval <= CurrTime then
+ begin
+ DoTimer(CurrTime - PrevTime);
+ PrevTime:= CurrTime
+ end else SDL_Delay(1);
+ if isTerminated = false then IPCCheckSock();
+ until isTerminated;
+
+ exit();
+end;
+
+/////////////////////////
+procedure ShowMainWindow;
+begin
+ if cFullScreen then ParseCommand('fullscr 1', true)
+ else ParseCommand('fullscr 0', true);
+ SDL_ShowCursor(0)
+end;
- WriteLnToConsole('********************************************* accelerometer');
-
- tiltValue:= SDL_JoystickGetAxis(uKeys.theJoystick, 0);
+///////////////
+procedure Game;{$IFDEF IPHONEOS}cdecl; export;{$ENDIF}
+var p: TPathType;
+ s: shortstring;
+begin
+{$IFDEF IPHONEOS}
+ Randomize;
- if (CurrentTeam <> nil) then
- begin
-{$IFDEF DEBUGFILE}
- AddFileLog('Joystick: 0; Axis: 0; Value: ' + inttostr(tiltValue));
+ val('320', cScreenWidth);
+ val('480', cScreenHeight);
+ cInitWidth:= cScreenWidth;
+ cInitHeight:= cScreenHeight;
+ cBitsStr:= '16';
+ val(cBitsStr, cBits);
+ val('51432', ipcPort);
+ cFullScreen:= true;
+ isSoundEnabled:= false;
+ cVSyncInUse:= true;
+ cLocaleFName:= 'en.txt';
+ val('100', cInitVolume);
+ val('8', cTimerInterval);
+ PathPrefix:= 'Data';
+ cShowFPS:= true;
+ cAltDamage:= false;
+ UserNick:= 'Koda'; //DecodeBase64(ParamStr(15));
+ isMusicEnabled:= false;
+ cReducedQuality:= false;
{$ENDIF}
- if tiltValue > 1500 then
- begin
- uKeys.rightKey:= true;
- uKeys.isWalking:= true;
- end
- else
- if tiltValue <= -1500 then
- begin
- uKeys.leftKey:= true;
- uKeys.isWalking:= true;
- end
- else
- if (tiltValue > -1500) and (tiltValue <= 1500) and (movedbybuttons = false) then uKeys.isWalking:= false;
- end;
- end;*)
-{$ELSE}
- SDL_MOUSEBUTTONDOWN: if event.button.button = SDL_BUTTON_WHEELDOWN then uKeys.wheelDown:= true;
- SDL_MOUSEBUTTONUP: if event.button.button = SDL_BUTTON_WHEELUP then uKeys.wheelUp:= true;
- SDL_JOYAXISMOTION: ControllerAxisEvent(event.jaxis.which, event.jaxis.axis, event.jaxis.value);
- SDL_JOYHATMOTION: ControllerHatEvent(event.jhat.which, event.jhat.hat, event.jhat.value);
- SDL_JOYBUTTONDOWN: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, true);
- SDL_JOYBUTTONUP: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, false);
-{$ENDIF}
- SDL_QUITEV: isTerminated:= true
- end;
+
+ for p:= Succ(Low(TPathType)) to High(TPathType) do
+ if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p];
+
+ WriteToConsole('Init SDL... ');
+ SDLTry(SDL_Init(SDL_INIT_VIDEO) >= 0, true);
+ WriteLnToConsole(msgOK);
+
+ SDL_EnableUNICODE(1);
+
+ WriteToConsole('Init SDL_ttf... ');
+ SDLTry(TTF_Init <> -1, true);
+ WriteLnToConsole(msgOK);
+
+ ShowMainWindow;
+
+ AddProgress;
+
+ ControllerInit; // has to happen before InitKbdKeyTable to map keys
+ InitKbdKeyTable;
+
+ if recordFileName = '' then
+ InitIPC;
+ WriteLnToConsole(msgGettingConfig);
+
+ if cLocaleFName <> 'en.txt' then
+ LoadLocale(Pathz[ptLocale] + '/en.txt');
+ LoadLocale(Pathz[ptLocale] + '/' + cLocaleFName);
+
+ if recordFileName = '' then
+ SendIPCAndWaitReply('C') // ask for game config
+ else
+ LoadRecordFromFile(recordFileName);
+
+ s:= 'eproto ' + inttostr(cNetProtoVersion);
+ SendIPCRaw(@s[0], Length(s) + 1); // send proto version
+
+ InitTeams;
+ AssignStores;
-CurrTime:= SDL_GetTicks;
-if PrevTime + cTimerInterval <= CurrTime then
- begin
- DoTimer(CurrTime - PrevTime);
- PrevTime:= CurrTime
- end else SDL_Delay(1);
-IPCCheckSock
-until isTerminated
+ if isSoundEnabled then
+ InitSound;
+
+ isDeveloperMode:= false;
+
+ TryDo(InitStepsFlags = cifAllInited, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true);
+
+ MainLoop();
+ OnDestroy();
+ exit();
+end;
+{$IFNDEF IPHONEOS}
+/////////////////////////
+procedure GenLandPreview;
+var Preview: TPreview;
+ h: byte;
+begin
+ InitIPC;
+ IPCWaitPongEvent;
+ TryDo(InitStepsFlags = cifRandomize, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true);
+
+ Preview:= GenPreview;
+ WriteLnToConsole('Sending preview...');
+ SendIPCRaw(@Preview, sizeof(Preview));
+ h:= MaxHedgehogs;
+ SendIPCRaw(@h, sizeof(h));
+ WriteLnToConsole('Preview sent, disconnect');
+ CloseIPC();
+end;
+
+////////////////////////////////
+procedure Resize(w, h: LongInt);
+begin
+ cScreenWidth:= w;
+ cScreenHeight:= h;
+ if cFullScreen then
+ ParseCommand('/fullscr 1', true)
+ else
+ ParseCommand('/fullscr 0', true);
end;
/////////////////////
@@ -253,7 +336,8 @@
WriteLn();
WriteLn('Read documentation online at http://www.hedgewars.org/node/1465 for more information');
Write('parsed command: ');
- for i:=0 to ParamCount do Write(ParamStr(i) + ' ');
+ for i:=0 to ParamCount do
+ Write(ParamStr(i) + ' ');
WriteLn();
halt(1);
end;
@@ -267,239 +351,126 @@
p: TPathType;
begin
-case ParamCount of
- 17: begin
- val(ParamStr(2), cScreenWidth);
- val(ParamStr(3), cScreenHeight);
- cInitWidth:= cScreenWidth;
- cInitHeight:= cScreenHeight;
- cBitsStr:= ParamStr(4);
- val(cBitsStr, cBits);
- val(ParamStr(5), ipcPort);
- cFullScreen:= ParamStr(6) = '1';
- isSoundEnabled:= ParamStr(7) = '1';
- cVSyncInUse:= ParamStr(8) = '1';
- cLocaleFName:= ParamStr(9);
- val(ParamStr(10), cInitVolume);
- val(ParamStr(11), cTimerInterval);
- PathPrefix:= ParamStr(12);
- cShowFPS:= ParamStr(13) = '1';
- cAltDamage:= ParamStr(14) = '1';
- UserNick:= DecodeBase64(ParamStr(15));
- isMusicEnabled:= ParamStr(16) = '1';
- cReducedQuality:= ParamStr(17) = '1';
- for p:= Succ(Low(TPathType)) to High(TPathType) do
- if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p]
- end;
-{$IFDEF IPHONEOS}
- 0: begin
- PathPrefix:= 'Data';
- recordFileName:= 'save.hws';
- val('320', cScreenWidth);
- val('480', cScreenHeight);
- cInitWidth:= cScreenWidth;
- cInitHeight:= cScreenHeight;
- cBitsStr:= '32';
- val(cBitsStr, cBits);
- val('100', cInitVolume);
- isMusicEnabled:= false;
- isSoundEnabled:= false;
- cLocaleFName:= 'en.txt';
- cFullScreen:= true; //T or F is is the same here
- cAltDamage:= false;
- cShowFPS:= true;
- val('8', cTimerInterval);
- cReducedQuality:= false;
-
- for p:= Succ(Low(TPathType)) to High(TPathType) do
- if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p]
- end;
-{$ENDIF}
- 3: begin
- val(ParamStr(2), ipcPort);
- GameType:= gmtLandPreview;
- if ParamStr(3) <> 'landpreview' then OutError(errmsgShouldntRun, true);
- end;
- 2: begin
- PathPrefix:= ParamStr(1);
- recordFileName:= ParamStr(2);
-
- for p:= Succ(Low(TPathType)) to High(TPathType) do
- if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p]
- end;
- 6: begin
- PathPrefix:= ParamStr(1);
- recordFileName:= ParamStr(2);
-
- if ParamStr(3) = '--set-video' then
- begin
- val(ParamStr(4), cScreenWidth);
- val(ParamStr(5), cScreenHeight);
+ case ParamCount of
+ 17: begin
+ val(ParamStr(2), cScreenWidth);
+ val(ParamStr(3), cScreenHeight);
cInitWidth:= cScreenWidth;
cInitHeight:= cScreenHeight;
- cBitsStr:= ParamStr(6);
+ cBitsStr:= ParamStr(4);
val(cBitsStr, cBits);
- end
- else
- begin
- if ParamStr(3) = '--set-audio' then
+ val(ParamStr(5), ipcPort);
+ cFullScreen:= ParamStr(6) = '1';
+ isSoundEnabled:= ParamStr(7) = '1';
+ cVSyncInUse:= ParamStr(8) = '1';
+ cLocaleFName:= ParamStr(9);
+ val(ParamStr(10), cInitVolume);
+ val(ParamStr(11), cTimerInterval);
+ PathPrefix:= ParamStr(12);
+ cShowFPS:= ParamStr(13) = '1';
+ cAltDamage:= ParamStr(14) = '1';
+ UserNick:= DecodeBase64(ParamStr(15));
+ isMusicEnabled:= ParamStr(16) = '1';
+ cReducedQuality:= ParamStr(17) = '1';
+ end;
+ 3: begin
+ val(ParamStr(2), ipcPort);
+ GameType:= gmtLandPreview;
+ if ParamStr(3) <> 'landpreview' then
+ OutError(errmsgShouldntRun, true);
+ end;
+ 2: begin
+ PathPrefix:= ParamStr(1);
+ recordFileName:= ParamStr(2);
+ end;
+ 6: begin
+ PathPrefix:= ParamStr(1);
+ recordFileName:= ParamStr(2);
+
+ if ParamStr(3) = '--set-video' then
begin
- val(ParamStr(4), cInitVolume);
- isMusicEnabled:= ParamStr(5) = '1';
- isSoundEnabled:= ParamStr(6) = '1';
+ val(ParamStr(4), cScreenWidth);
+ val(ParamStr(5), cScreenHeight);
+ cInitWidth:= cScreenWidth;
+ cInitHeight:= cScreenHeight;
+ cBitsStr:= ParamStr(6);
+ val(cBitsStr, cBits);
end
else
begin
- if ParamStr(3) = '--set-other' then
+ if ParamStr(3) = '--set-audio' then
+ begin
+ val(ParamStr(4), cInitVolume);
+ isMusicEnabled:= ParamStr(5) = '1';
+ isSoundEnabled:= ParamStr(6) = '1';
+ end
+ else
begin
- cLocaleFName:= ParamStr(4);
- cFullScreen:= ParamStr(5) = '1';
- cShowFPS:= ParamStr(6) = '1';
+ if ParamStr(3) = '--set-other' then
+ begin
+ cLocaleFName:= ParamStr(4);
+ cFullScreen:= ParamStr(5) = '1';
+ cShowFPS:= ParamStr(6) = '1';
+ end
+ else DisplayUsage;
end
- else DisplayUsage;
- end
+ end;
end;
+ 11: begin
+ PathPrefix:= ParamStr(1);
+ recordFileName:= ParamStr(2);
- for p:= Succ(Low(TPathType)) to High(TPathType) do
- if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p]
- end;
- 11: begin
- PathPrefix:= ParamStr(1);
- recordFileName:= ParamStr(2);
-
- if ParamStr(3) = '--set-multimedia' then
- begin
- val(ParamStr(4), cScreenWidth);
- val(ParamStr(5), cScreenHeight);
- cInitWidth:= cScreenWidth;
- cInitHeight:= cScreenHeight;
- cBitsStr:= ParamStr(6);
- val(cBitsStr, cBits);
- val(ParamStr(7), cInitVolume);
- isMusicEnabled:= ParamStr(8) = '1';
- isSoundEnabled:= ParamStr(9) = '1';
- cLocaleFName:= ParamStr(10);
- cFullScreen:= ParamStr(11) = '1';
- end
+ if ParamStr(3) = '--set-multimedia' then
+ begin
+ val(ParamStr(4), cScreenWidth);
+ val(ParamStr(5), cScreenHeight);
+ cInitWidth:= cScreenWidth;
+ cInitHeight:= cScreenHeight;
+ cBitsStr:= ParamStr(6);
+ val(cBitsStr, cBits);
+ val(ParamStr(7), cInitVolume);
+ isMusicEnabled:= ParamStr(8) = '1';
+ isSoundEnabled:= ParamStr(9) = '1';
+ cLocaleFName:= ParamStr(10);
+ cFullScreen:= ParamStr(11) = '1';
+ end
+ else DisplayUsage;
+ end;
+ 15: begin
+ PathPrefix:= ParamStr(1);
+ recordFileName:= ParamStr(2);
+ if ParamStr(3) = '--set-everything' then
+ begin
+ val(ParamStr(4), cScreenWidth);
+ val(ParamStr(5), cScreenHeight);
+ cInitWidth:= cScreenWidth;
+ cInitHeight:= cScreenHeight;
+ cBitsStr:= ParamStr(6);
+ val(cBitsStr, cBits);
+ val(ParamStr(7), cInitVolume);
+ isMusicEnabled:= ParamStr(8) = '1';
+ isSoundEnabled:= ParamStr(9) = '1';
+ cLocaleFName:= ParamStr(10);
+ cFullScreen:= ParamStr(11) = '1';
+ cAltDamage:= ParamStr(12) = '1';
+ cShowFPS:= ParamStr(13) = '1';
+ val(ParamStr(14), cTimerInterval);
+ cReducedQuality:= ParamStr(15) = '1';
+ end
+ else DisplayUsage;
+ end;
else DisplayUsage;
-
- for p:= Succ(Low(TPathType)) to High(TPathType) do
- if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p]
- end;
- 15: begin
- PathPrefix:= ParamStr(1);
- recordFileName:= ParamStr(2);
- if ParamStr(3) = '--set-everything' then
- begin
- val(ParamStr(4), cScreenWidth);
- val(ParamStr(5), cScreenHeight);
- cInitWidth:= cScreenWidth;
- cInitHeight:= cScreenHeight;
- cBitsStr:= ParamStr(6);
- val(cBitsStr, cBits);
- val(ParamStr(7), cInitVolume);
- isMusicEnabled:= ParamStr(8) = '1';
- isSoundEnabled:= ParamStr(9) = '1';
- cLocaleFName:= ParamStr(10);
- cFullScreen:= ParamStr(11) = '1';
- cAltDamage:= ParamStr(12) = '1';
- cShowFPS:= ParamStr(13) = '1';
- val(ParamStr(14), cTimerInterval);
- cReducedQuality:= ParamStr(15) = '1';
- end
- else DisplayUsage;
-
- for p:= Succ(Low(TPathType)) to High(TPathType) do
- if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p]
- end;
- else DisplayUsage;
end;
{$IFDEF DEBUGFILE}
-AddFileLog('Prefix: "' + PathPrefix +'"');
-for i:= 0 to ParamCount do
- AddFileLog(inttostr(i) + ': ' + ParamStr(i));
+ AddFileLog('Prefix: "' + PathPrefix +'"');
+ for i:= 0 to ParamCount do
+ AddFileLog(inttostr(i) + ': ' + ParamStr(i));
{$IFDEF IPHONEOS}
WriteLnToConsole('Saving debug file at: ' + IPH_getDocumentsPath());
{$ENDIF}
{$ENDIF}
end;
-
-/////////////////////////
-procedure ShowMainWindow;
-begin
- if cFullScreen then ParseCommand('fullscr 1', true)
- else ParseCommand('fullscr 0', true);
- SDL_ShowCursor(0)
-end;
-
-///////////////
-procedure Game;
-var s: shortstring;
-begin
-WriteToConsole('Init SDL... ');
-SDLTry(SDL_Init(SDL_INIT_VIDEO) >= 0, true);
-WriteLnToConsole(msgOK);
-
-SDL_EnableUNICODE(1);
-
-WriteToConsole('Init SDL_ttf... ');
-SDLTry(TTF_Init <> -1, true);
-WriteLnToConsole(msgOK);
-
-ShowMainWindow;
-
-AddProgress;
-
-ControllerInit; // has to happen before InitKbdKeyTable to map keys
-InitKbdKeyTable;
-
-if recordFileName = '' then InitIPC;
-WriteLnToConsole(msgGettingConfig);
-
-if cLocaleFName <> 'en.txt' then
- LoadLocale(Pathz[ptLocale] + '/en.txt');
-LoadLocale(Pathz[ptLocale] + '/' + cLocaleFName);
-
-if recordFileName = '' then
- SendIPCAndWaitReply('C') // ask for game config
-else
- LoadRecordFromFile(recordFileName);
-
-s:= 'eproto ' + inttostr(cNetProtoVersion);
-SendIPCRaw(@s[0], Length(s) + 1); // send proto version
-
-InitTeams;
-AssignStores;
-
-if isSoundEnabled then
- InitSound;
-
-isDeveloperMode:= false;
-
-TryDo(InitStepsFlags = cifAllInited, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true);
-
-MainLoop;
-end;
-
-/////////////////////////
-procedure GenLandPreview;
-var Preview: TPreview;
- h: byte;
-begin
-InitIPC;
-IPCWaitPongEvent;
-TryDo(InitStepsFlags = cifRandomize, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true);
-
-Preview:= GenPreview;
-WriteLnToConsole('Sending preview...');
-SendIPCRaw(@Preview, sizeof(Preview));
-h:= MaxHedgehogs;
-SendIPCRaw(@h, sizeof(h));
-WriteLnToConsole('Preview sent, disconnect');
-CloseIPC();
-end;
-
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// m a i n ////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
@@ -510,8 +481,10 @@
Randomize;
- if GameType = gmtLandPreview then GenLandPreview
- else Game;
+ if GameType = gmtLandPreview then GenLandPreview
+ else Game;
// ExitCode := 100;
+{$ENDIF}
+
end.
--- a/hedgewars/uMisc.pas Sat Jan 16 06:48:56 2010 +0000
+++ b/hedgewars/uMisc.pas Sat Jan 16 17:30:37 2010 +0000
@@ -98,6 +98,7 @@
cYellowColor : Longword = $FFFFFF00;
cExplosionBorderColor : LongWord = $FF808080;
+var recordFileName : shortstring = '';
cShowFPS : boolean = false;
cCaseFactor : Longword = 5; {0..9}
cLandAdditions: Longword = 4;
--- a/hedgewars/uStore.pas Sat Jan 16 06:48:56 2010 +0000
+++ b/hedgewars/uStore.pas Sat Jan 16 17:30:37 2010 +0000
@@ -1074,9 +1074,7 @@
end;
procedure SetupOpenGL;
-{$IFDEF DEBUGFILE}
var vendor: shortstring;
-{$ENDIF}
begin
{$IFDEF IPHONEOS}
//these are good performance savers, perhaps we could enable them by default
@@ -1103,9 +1101,8 @@
glGetIntegerv(GL_MAX_TEXTURE_SIZE, @MaxTextureSize);
+ vendor:= LowerCase(string(pchar(glGetString(GL_VENDOR))));
{$IFDEF DEBUGFILE}
- vendor:= LowerCase(string(pchar(glGetString(GL_VENDOR))));
-
AddFileLog('OpenGL - Renderer: ' + string(pchar(glGetString(GL_RENDERER))));
AddFileLog(' |----- Vendor: ' + vendor);
AddFileLog(' |----- Version: ' + string(pchar(glGetString(GL_VERSION))));
@@ -1168,7 +1165,7 @@
end;
////////////////////////////////////////////////////////////////////////////////
-var Step: LongInt = 0;
+var Step: LongInt = 0;
squaresize : LongInt;
numsquares : LongInt;
{$IFDEF SDL13notworking}