12 * GNU General Public License for more details. |
12 * GNU General Public License for more details. |
13 * |
13 * |
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 * |
|
18 * File created on 25/04/2010. |
17 */ |
19 */ |
18 |
20 |
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 |
21 |
23 #ifdef __OBJC__ |
22 #ifdef __OBJC__ |
24 #import <Foundation/Foundation.h> |
23 #import <Foundation/Foundation.h> |
25 #import <CoreGraphics/CoreGraphics.h> |
24 #import <CoreGraphics/CoreGraphics.h> |
26 #import <UIKit/UIKit.h> |
25 #import <UIKit/UIKit.h> |
27 #import "PascalImports.h" |
26 #import "PascalImports.h" |
28 #import "UIImageExtra.h" |
27 #import "UIImageExtra.h" |
29 #import "CommodityFunctions.h" |
28 #import "DefinesAndMacros.h" |
30 #import "HedgewarsAppDelegate.h" |
29 #import "HedgewarsAppDelegate.h" |
31 #import "AudioManagerController.h" |
30 #import "AudioManagerController.h" |
|
31 #import "HWUtils.h" |
32 #endif |
32 #endif |
33 |
33 |
34 |
|
35 #ifdef DEBUG |
|
36 #define DLog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) |
|
37 #define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__] |
|
38 #define releaseAndNil(x) [x release] |
|
39 #else |
|
40 #define DLog(...) do { } while (0) |
|
41 #ifndef NS_BLOCK_ASSERTIONS |
|
42 #define NS_BLOCK_ASSERTIONS |
|
43 #endif |
|
44 #define ALog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) |
|
45 #define releaseAndNil(x) [x release], x = nil |
|
46 #endif |
|
47 |
|
48 |
|
49 #define ZAssert(condition, ...) do { if (!(condition)) { ALog(__VA_ARGS__); }} while(0) |
|
50 #define rotationManager(x) (x == UIInterfaceOrientationLandscapeRight) || (x == UIInterfaceOrientationLandscapeLeft) |
|
51 |
|
52 #define START_TIMER NSTimeInterval start = [NSDate timeIntervalSinceReferenceDate]; |
|
53 #define END_TIMER(msg) NSTimeInterval stop = [NSDate timeIntervalSinceReferenceDate]; CMLog([NSString stringWithFormat:@"%@ Time = %f", msg, stop-start]); |
|
54 |
|
55 |
|
56 #if !__IPHONE_3_2 |
|
57 typedef enum { |
|
58 UIUserInterfaceIdiomPhone, // iPhone and iPod touch style UI |
|
59 UIUserInterfaceIdiomPad, // iPad style UI |
|
60 } UIUserInterfaceIdiom; |
|
61 #define UI_USER_INTERFACE_IDIOM() UIUserInterfaceIdiomPhone |
|
62 #define UIPopoverController id |
|
63 #endif // ifndef __IPHONE_3_2 |
|