mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
still playing
This commit is contained in:
parent
54c9b01920
commit
799389a96c
@ -25,6 +25,7 @@ if __name__ == '__main__':
|
|||||||
freezer = FreezeTool.Freezer()
|
freezer = FreezeTool.Freezer()
|
||||||
|
|
||||||
basename = 'iphone_runappmf'
|
basename = 'iphone_runappmf'
|
||||||
|
link_all_static = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(sys.argv[1:], 'h')
|
opts, args = getopt.getopt(sys.argv[1:], 'h')
|
||||||
@ -52,6 +53,8 @@ if __name__ == '__main__':
|
|||||||
cc = '%s %s/usr/bin/g++-4.0' % (env, dev)
|
cc = '%s %s/usr/bin/g++-4.0' % (env, dev)
|
||||||
sysroot = '-isysroot %s/SDKs/%s%s.sdk' % (dev, platform, version)
|
sysroot = '-isysroot %s/SDKs/%s%s.sdk' % (dev, platform, version)
|
||||||
cflags = '-D__IPHONE_OS_VERSION_MIN_REQUIRED=20000 %s' % (sysroot)
|
cflags = '-D__IPHONE_OS_VERSION_MIN_REQUIRED=20000 %s' % (sysroot)
|
||||||
|
if link_all_static:
|
||||||
|
cflags += ' -DLINK_ALL_STATIC'
|
||||||
arch = ''
|
arch = ''
|
||||||
if target == 'phone':
|
if target == 'phone':
|
||||||
arch = ' -arch armv6 -mcpu=arm1176jzf-s -miphoneos-version-min=2.0'
|
arch = ' -arch armv6 -mcpu=arm1176jzf-s -miphoneos-version-min=2.0'
|
||||||
@ -59,12 +62,18 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
ipath = '-I/Users/drose/Python-2.5.4.%s/Include -I/Users/drose/Python-2.5.4.%s -I/usr/local/panda/%s/include' % (target, target, target)
|
ipath = '-I/Users/drose/Python-2.5.4.%s/Include -I/Users/drose/Python-2.5.4.%s -I/usr/local/panda/%s/include' % (target, target, target)
|
||||||
lpath = '-L/Users/drose/Python-2.5.4.%s -L/usr/local/panda/%s/lib' % (target, target)
|
lpath = '-L/Users/drose/Python-2.5.4.%s -L/usr/local/panda/%s/lib' % (target, target)
|
||||||
libs = '-lframework -lputil -lcollide -lpgraph -lchan -ltext -lpnmimage -lpnmimagetypes -levent -leffects -lgobj -ldisplay -lmathutil -lexpress -ldgraph -ldevice -ltform -llinmath -lpstatclient -lpanda -lglstuff -lrecorder -lpgui -lchar -lpipeline -lpandabase -llerp -lgsgbase -ldownloader -lparametrics -lpgraphnodes -lcull -lgrutil -lnet -lmovies -lnativenet -laudio -linterrogatedb -ldconfig -ldtoolutil -ldtoolbase -lprc -liphonedisplay -lpandaexpress -lpanda'
|
libs = ''
|
||||||
libs += ' -lphysics -lparticlesystem -lpandaphysics'
|
libs += ' -framework Foundation -framework UIKit'
|
||||||
libs += ' -ldistort -leffects -lpandafx'
|
if link_all_static:
|
||||||
libs += ' -ldirectbase -ldcparser -ldeadrec -ldistributed -lhttp -lshowbase -linterval -lmotiontrail -ldirect'
|
libs += ' -lframework -lputil -lcollide -lpgraph -lchan -ltext -lpnmimage -lpnmimagetypes -levent -leffects -lgobj -ldisplay -lmathutil -lexpress -ldgraph -ldevice -ltform -llinmath -lpstatclient -lpanda -lglstuff -lrecorder -lpgui -lchar -lpipeline -lpandabase -llerp -lgsgbase -ldownloader -lparametrics -lpgraphnodes -lcull -lgrutil -lnet -lmovies -lnativenet -laudio -linterrogatedb -ldconfig -ldtoolutil -ldtoolbase -lprc -liphonedisplay -lpandaexpress -lpanda'
|
||||||
|
libs += ' -lphysics -lparticlesystem -lpandaphysics'
|
||||||
|
libs += ' -ldistort -leffects -lpandafx'
|
||||||
|
libs += ' -ldirectbase -ldcparser -ldeadrec -ldistributed -lhttp -lshowbase -linterval -lmotiontrail -ldirect'
|
||||||
|
libs += ' -framework QuartzCore -framework OpenGLES'
|
||||||
libs += ' -lpython2.5'
|
libs += ' -lpython2.5'
|
||||||
libs += ' -framework Foundation -framework QuartzCore -framework UIKit -framework OpenGLES'
|
|
||||||
|
lpath += ' -L/Users/drose/iphone_thirdparty/lib'
|
||||||
|
libs += ' -ljpeg -lrfftw -lfftw'
|
||||||
|
|
||||||
freezer.sourceExtension = '.mm'
|
freezer.sourceExtension = '.mm'
|
||||||
freezer.compileObj = '%s -c %s %s -o %%(basename)s.o %s %%(filename)s' % (cc, arch, cflags, ipath)
|
freezer.compileObj = '%s -c %s %s -o %%(basename)s.o %s %%(filename)s' % (cc, arch, cflags, ipath)
|
||||||
|
@ -12,14 +12,13 @@
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "pandabase.h"
|
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#import "viewController.h"
|
#include <iostream>
|
||||||
#include "dcast.h"
|
using namespace std;
|
||||||
#include "config_iphonedisplay.h"
|
|
||||||
|
|
||||||
|
#include "pnotify.h"
|
||||||
|
|
||||||
#ifdef LINK_ALL_STATIC
|
#ifdef LINK_ALL_STATIC
|
||||||
extern "C" void initlibpandaexpress();
|
extern "C" void initlibpandaexpress();
|
||||||
extern "C" void initlibpanda();
|
extern "C" void initlibpanda();
|
||||||
@ -28,11 +27,13 @@ extern "C" void initlibpandafx();
|
|||||||
extern "C" void initlibdirect();
|
extern "C" void initlibdirect();
|
||||||
#endif // LINK_ALL_STATIC
|
#endif // LINK_ALL_STATIC
|
||||||
|
|
||||||
@class AppMFViewController;
|
//@class AppMFViewController;
|
||||||
@interface AppMFAppDelegate : NSObject <UIApplicationDelegate> {
|
@interface AppMFAppDelegate : NSObject <UIApplicationDelegate> {
|
||||||
|
NSString *app_directory;
|
||||||
NSTimer *animationTimer;
|
NSTimer *animationTimer;
|
||||||
NSTimeInterval animationInterval;
|
NSTimeInterval animationInterval;
|
||||||
}
|
}
|
||||||
|
@property (nonatomic, assign) NSString *app_directory;
|
||||||
@property (nonatomic, assign) NSTimer *animationTimer;
|
@property (nonatomic, assign) NSTimer *animationTimer;
|
||||||
@property NSTimeInterval animationInterval;
|
@property NSTimeInterval animationInterval;
|
||||||
|
|
||||||
@ -44,22 +45,34 @@ extern "C" void initlibdirect();
|
|||||||
|
|
||||||
@implementation AppMFAppDelegate
|
@implementation AppMFAppDelegate
|
||||||
|
|
||||||
|
@synthesize app_directory;
|
||||||
@synthesize animationTimer;
|
@synthesize animationTimer;
|
||||||
@synthesize animationInterval;
|
@synthesize animationInterval;
|
||||||
|
|
||||||
int startup = 0;
|
int startup = 0;
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching: (UIApplication *)application {
|
- (void)applicationDidFinishLaunching: (UIApplication *)application {
|
||||||
// Ensure the IPhoneDisplay is available.
|
#ifdef LINK_ALL_STATIC
|
||||||
init_libiphonedisplay();
|
// Ensure that all the relevant Panda modules are initialized.
|
||||||
|
extern void init_libpanda();
|
||||||
|
init_libpanda();
|
||||||
|
|
||||||
ConfigVariableDouble timer_fps("timer-fps", 60.0);
|
// Ensure the IPhoneDisplay is available.
|
||||||
animationInterval = 1.0 / timer_fps;
|
extern void init_libiphonedisplay();
|
||||||
|
init_libiphonedisplay();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
NSBundle *bundle = [NSBundle mainBundle];
|
||||||
|
if (bundle != nil) {
|
||||||
|
app_directory = [bundle bundlePath];
|
||||||
|
}
|
||||||
|
|
||||||
|
animationInterval = 1.0 / 60.0;
|
||||||
[self startAnimation];
|
[self startAnimation];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidReceiveMemoryWarning: (UIApplication *)application {
|
- (void)applicationDidReceiveMemoryWarning: (UIApplication *)application {
|
||||||
nout << "applicationDidReceiveMemoryWarning\n";
|
cerr << "applicationDidReceiveMemoryWarning\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)startAnimation {
|
- (void)startAnimation {
|
||||||
@ -95,15 +108,19 @@ int startup = 0;
|
|||||||
// if we take a while starting up.
|
// if we take a while starting up.
|
||||||
|
|
||||||
Py_FrozenFlag = 1; /* Suppress errors from getpath.c */
|
Py_FrozenFlag = 1; /* Suppress errors from getpath.c */
|
||||||
Filename app_pathname(Filename::get_app_directory(), "iphone_runmf");
|
NSString *app_pathname = [app_directory stringByAppendingString: @"/iphone_runappmf" ];
|
||||||
Py_SetProgramName((char *)app_pathname.c_str());
|
const char *app_pathname_cstr = [app_pathname cStringUsingEncoding: NSASCIIStringEncoding];
|
||||||
|
Py_SetProgramName((char *)app_pathname_cstr);
|
||||||
Py_Initialize();
|
Py_Initialize();
|
||||||
|
|
||||||
int argv = 1;
|
int argv = 1;
|
||||||
Filename script_pathname(Filename::get_app_directory(), "iphone.mf");
|
NSString *script_pathname = [app_directory stringByAppendingString: @"/iphone.mf" ];
|
||||||
char *argc[] = { (char *)script_pathname.c_str(), NULL };
|
const char *script_pathname_cstr = [script_pathname cStringUsingEncoding: NSASCIIStringEncoding];
|
||||||
|
char *argc[] = { (char *)script_pathname_cstr, NULL };
|
||||||
PySys_SetArgv(argv, argc);
|
PySys_SetArgv(argv, argc);
|
||||||
Py_SetPythonHome((char *)Filename::get_app_directory().c_str());
|
|
||||||
|
const char *app_directory_cstr = [app_directory cStringUsingEncoding: NSASCIIStringEncoding];
|
||||||
|
Py_SetPythonHome((char *)app_directory_cstr);
|
||||||
|
|
||||||
#ifdef LINK_ALL_STATIC
|
#ifdef LINK_ALL_STATIC
|
||||||
// Construct the Python modules for the interrogate-generated data
|
// Construct the Python modules for the interrogate-generated data
|
||||||
@ -115,7 +132,7 @@ int startup = 0;
|
|||||||
initlibdirect();
|
initlibdirect();
|
||||||
#endif // LINK_ALL_STATIC
|
#endif // LINK_ALL_STATIC
|
||||||
|
|
||||||
/*
|
#if 0
|
||||||
PyImport_ImportFrozenModule("direct");
|
PyImport_ImportFrozenModule("direct");
|
||||||
PyImport_ImportFrozenModule("direct.showbase");
|
PyImport_ImportFrozenModule("direct.showbase");
|
||||||
int n = PyImport_ImportFrozenModule("direct.showbase.RunAppMF");
|
int n = PyImport_ImportFrozenModule("direct.showbase.RunAppMF");
|
||||||
@ -128,7 +145,7 @@ int startup = 0;
|
|||||||
Py_Finalize();
|
Py_Finalize();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
*/
|
#endif
|
||||||
|
|
||||||
PyObject *module = PyImport_ImportModule("direct");
|
PyObject *module = PyImport_ImportModule("direct");
|
||||||
if (module == (PyObject *)NULL) {
|
if (module == (PyObject *)NULL) {
|
||||||
@ -162,8 +179,9 @@ int startup = 0;
|
|||||||
if (module != (PyObject *)NULL) {
|
if (module != (PyObject *)NULL) {
|
||||||
PyObject *func = PyObject_GetAttrString(module, "runPackedApp");
|
PyObject *func = PyObject_GetAttrString(module, "runPackedApp");
|
||||||
if (func != (PyObject *)NULL) {
|
if (func != (PyObject *)NULL) {
|
||||||
Filename script_pathname(Filename::get_app_directory(), "iphone.mf");
|
NSString *script_pathname = [app_directory stringByAppendingString: @"/iphone.mf" ];
|
||||||
PyObject *result = PyObject_CallFunction(func, "([s])", script_pathname.c_str());
|
const char *script_pathname_cstr = [script_pathname cStringUsingEncoding: NSASCIIStringEncoding];
|
||||||
|
PyObject *result = PyObject_CallFunction(func, "([s])", script_pathname_cstr);
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
Py_DECREF(func);
|
Py_DECREF(func);
|
||||||
}
|
}
|
||||||
@ -217,6 +235,15 @@ extern "C" int main(int argc, char *argv[]);
|
|||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[]) {
|
main(int argc, char *argv[]) {
|
||||||
|
/*
|
||||||
|
int logfile_fd = open("/tmp/foo.txt", O_WRONLY | O_CREAT | O_TRUNC, 0666);
|
||||||
|
if (logfile_fd >= 0) {
|
||||||
|
dup2(logfile_fd, STDOUT_FILENO);
|
||||||
|
dup2(logfile_fd, STDERR_FILENO);
|
||||||
|
close(logfile_fd);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
PyImport_FrozenModules = _PyImport_FrozenModules;
|
PyImport_FrozenModules = _PyImport_FrozenModules;
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user