~ogre-team/testogre/soc09-samples

« back to all changes in this revision

Viewing changes to Samples/ParticleGS/src/ParticleGS.cpp

  • Committer: sinbad
  • Date: 2009-09-27 16:01:36 UTC
  • Revision ID: svn-v4:8631bf8a-c64b-0410-883c-f3eb003322f7:branches/soc09-samples:9123
Merged trunk changes to r9109 into soc09-samples so that we can perform platform tests & refine
Once again a staged commit because of crappy server performance

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
    (Object-oriented Graphics Rendering Engine)
5
5
For the latest info, see http://www.ogre3d.org/
6
6
 
7
 
Copyright (c) 2000-2006 Torus Knot Software Ltd
 
7
Copyright (c) 2000-2009 Torus Knot Software Ltd
8
8
Also see acknowledgements in Readme.html
9
9
 
10
10
You may use this sample code for anything you like, it is not covered by the
11
 
LGPL like the rest of the engine.
 
11
same license as the rest of the engine.
12
12
-----------------------------------------------------------------------------
13
13
*/
14
14
/*
219
219
int main(int argc, char **argv)
220
220
#endif
221
221
{
 
222
#if OGRE_PLATFORM == OGRE_PLATFORM_IPHONE
 
223
        NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
 
224
        int retVal = UIApplicationMain(argc, argv, @"UIApplication", @"AppDelegate");
 
225
        [pool release];
 
226
        return retVal;
 
227
#else
222
228
    // Create application object
223
229
    ParticleGSApplication app;
224
230
 
232
238
#endif
233
239
    }
234
240
 
235
 
 
236
241
    return 0;
 
242
#endif
237
243
}
238
244
 
239
245
#ifdef __cplusplus
240
246
}
241
247
#endif
 
248
 
 
249
#if OGRE_PLATFORM == OGRE_PLATFORM_IPHONE
 
250
#   ifdef __OBJC__
 
251
@interface AppDelegate : NSObject <UIApplicationDelegate>
 
252
{
 
253
}
 
254
 
 
255
- (void)go;
 
256
 
 
257
@end
 
258
 
 
259
@implementation AppDelegate
 
260
 
 
261
- (void)go {
 
262
    // Create application object
 
263
    ParticleGSApplication app;
 
264
    try {
 
265
        app.go();
 
266
    } catch( Ogre::Exception& e ) {
 
267
        std::cerr << "An exception has occured: " <<
 
268
        e.getFullDescription().c_str() << std::endl;
 
269
    }
 
270
}
 
271
 
 
272
- (void)applicationDidFinishLaunching:(UIApplication *)application {
 
273
    // Hide the status bar
 
274
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
 
275
 
 
276
    // Create a window
 
277
    UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
 
278
 
 
279
    // Create an image view
 
280
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Default.png"]];
 
281
    [window addSubview:imageView];
 
282
    
 
283
    // Create an indeterminate status indicator
 
284
    UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
 
285
    [indicator setFrame:CGRectMake(150, 280, 20, 20)];
 
286
    [indicator startAnimating];
 
287
    [window addSubview:indicator];
 
288
    
 
289
    // Display our window
 
290
    [window makeKeyAndVisible];
 
291
    
 
292
    // Clean up
 
293
    [imageView release];
 
294
    [indicator release];
 
295
 
 
296
    [NSThread detachNewThreadSelector:@selector(go) toTarget:self withObject:nil];
 
297
}
 
298
 
 
299
- (void)applicationWillTerminate:(UIApplication *)application {
 
300
    Root::getSingleton().queueEndRendering();
 
301
}
 
302
 
 
303
//- (void)applicationWillResignActive:(UIApplication *)application
 
304
//{
 
305
//    // Pause FrameListeners and rendering
 
306
//}
 
307
//
 
308
//- (void)applicationDidBecomeActive:(UIApplication *)application
 
309
//{
 
310
//    // Resume FrameListeners and rendering
 
311
//}
 
312
 
 
313
- (void)dealloc {
 
314
    [super dealloc];
 
315
}
 
316
 
 
317
@end
 
318
#   endif
 
319
 
 
320
#endif