14 * You should have received a copy of the GNU General Public License |
14 * You should have received a copy of the GNU General Public License |
15 * along with this program; if not, write to the Free Software |
15 * along with this program; if not, write to the Free Software |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
17 */ |
17 */ |
18 |
18 |
|
19 |
|
20 // some macros by http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/ |
|
21 // and http://blog.coriolis.ch/2009/01/05/macros-for-xcode/ |
|
22 |
19 #ifdef __OBJC__ |
23 #ifdef __OBJC__ |
20 #import <Foundation/Foundation.h> |
24 #import <Foundation/Foundation.h> |
21 #import <CoreGraphics/CoreGraphics.h> |
25 #import <CoreGraphics/CoreGraphics.h> |
22 #import <UIKit/UIKit.h> |
26 #import <UIKit/UIKit.h> |
23 #import "PascalImports.h" |
27 #import "PascalImports.h" |
28 #import "SDL_video.h" |
32 #import "SDL_video.h" |
29 #import "SDL_net.h" |
33 #import "SDL_net.h" |
30 #import "SDL_mixer.h" |
34 #import "SDL_mixer.h" |
31 #endif |
35 #endif |
32 |
36 |
33 // by http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/ |
37 |
34 #ifdef DEBUG |
38 #ifdef DEBUG |
35 #define DLog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) |
39 #define DLog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) |
36 #define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__] |
40 #define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__] |
|
41 #define releaseAndNil(x) [x release] |
37 #else |
42 #else |
38 #define DLog(...) do { } while (0) |
43 #define DLog(...) do { } while (0) |
39 #ifndef NS_BLOCK_ASSERTIONS |
44 #ifndef NS_BLOCK_ASSERTIONS |
40 #define NS_BLOCK_ASSERTIONS |
45 #define NS_BLOCK_ASSERTIONS |
41 #endif |
46 #endif |
42 #define ALog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) |
47 #define ALog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) |
|
48 #define releaseAndNil(x) [x release], x = nil |
43 #endif |
49 #endif |
44 |
50 |
|
51 |
45 #define ZAssert(condition, ...) do { if (!(condition)) { ALog(__VA_ARGS__); }} while(0) |
52 #define ZAssert(condition, ...) do { if (!(condition)) { ALog(__VA_ARGS__); }} while(0) |
|
53 #define rotationManager(x) (x == UIInterfaceOrientationLandscapeRight) || (x == UIInterfaceOrientationLandscapeLeft) |
46 |
54 |
47 // by http://blog.coriolis.ch/2009/01/05/macros-for-xcode/ |
|
48 #define START_TIMER NSTimeInterval start = [NSDate timeIntervalSinceReferenceDate]; |
55 #define START_TIMER NSTimeInterval start = [NSDate timeIntervalSinceReferenceDate]; |
49 #define END_TIMER(msg) NSTimeInterval stop = [NSDate timeIntervalSinceReferenceDate]; CMLog([NSString stringWithFormat:@"%@ Time = %f", msg, stop-start]); |
56 #define END_TIMER(msg) NSTimeInterval stop = [NSDate timeIntervalSinceReferenceDate]; CMLog([NSString stringWithFormat:@"%@ Time = %f", msg, stop-start]); |
50 |
|
51 #define releaseAndNil(x) [x release], x = nil; |
|
52 |
57 |
53 |
58 |
54 #if !__IPHONE_3_2 |
59 #if !__IPHONE_3_2 |
55 typedef enum { |
60 typedef enum { |
56 UIUserInterfaceIdiomPhone, // iPhone and iPod touch style UI |
61 UIUserInterfaceIdiomPhone, // iPhone and iPod touch style UI |