//----------------------------------------------------------------// void _AKUOpenWindowFunc ( const char* title, int width, int height ) { sWinX = 180; sWinY = 100; sWinWidth = width; sWinHeight = height; sWinWidth = width; sWinHeight = height; if ( !sHasWindow ) { glutInitDisplayMode ( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH ); glutInitWindowSize ( sWinWidth, sWinHeight ); glutInitWindowPosition ( sWinX, sWinY ); glutCreateWindow ( title ); sHasWindow = true; } glutIgnoreKeyRepeat ( 1 ); glutKeyboardFunc ( _onKeyDown ); glutKeyboardUpFunc ( _onKeyUp ); glutSpecialFunc ( _onSpecialFunc ); glutMouseFunc ( _onMouseButton ); glutMotionFunc ( _onMouseDrag ); glutPassiveMotionFunc ( _onMouseMove ); glutDisplayFunc ( _onPaint ); glutReshapeFunc ( _onReshape ); AKUDetectGfxContext (); AKUSetScreenSize ( width, height ); }
//----------------------------------------------------------------// void _AKUOpenWindowFunc ( const char* title, int width, int height ) { sWinX = 180; sWinY = 100; sWinWidth = width; sWinHeight = height; sWinWidth = width; sWinHeight = height; if ( !sHasWindow ) { glutInitDisplayMode ( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH ); glutInitWindowSize ( sWinWidth, sWinHeight ); glutInitWindowPosition ( sWinX, sWinY ); glutCreateWindow ( title ); sHasWindow = true; } glutIgnoreKeyRepeat ( 1 ); glutDisplayFunc ( _onPaint ); glutReshapeFunc ( _onReshape ); AKUDetectGfxContext (); AKUSetScreenSize ( width, height ); }
//----------------------------------------------------------------// void _AKUOpenWindowFunc ( const char* title, int width, int height ) { sWinX = 180; sWinY = 100; sWinWidth = width; sWinHeight = height; sWinWidth = width; sWinHeight = height; if ( !sHasWindow ) { glutInitDisplayMode ( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH ); glutInitWindowSize ( sWinWidth, sWinHeight ); glutInitWindowPosition ( sWinX, sWinY ); if (!glutGet(GLUT_DISPLAY_MODE_POSSIBLE)) { exit(1); } glutCreateWindow ( title ); sHasWindow = true; } #if !AKU_WITH_TEST glutIgnoreKeyRepeat ( 1 ); glutKeyboardFunc ( _onKeyDown ); glutKeyboardUpFunc ( _onKeyUp ); glutSpecialFunc ( _onSpecialFunc ); glutMouseFunc ( _onMouseButton ); glutMotionFunc ( _onMouseDrag ); #ifdef FREEGLUT_STATIC glutMultiButtonFunc ( _onMultiButton ); glutMultiMotionFunc ( _onMultiMotion ); #endif glutPassiveMotionFunc ( _onMouseMove ); #endif glutDisplayFunc ( _onPaint ); glutReshapeFunc ( _onReshape ); AKUDetectGfxContext (); AKUSetScreenSize ( width, height ); #ifdef __APPLE__ GLint sync = 1; CGLContextObj ctx = CGLGetCurrentContext(); CGLSetParameter (ctx, kCGLCPSwapInterval, &sync); #endif }
//----------------------------------------------------------------// static void _onReshape( int w, int h ) { if ( sExitFullscreen ) { w = sWinWidth; h = sWinHeight; sExitFullscreen = false; } glutReshapeWindow ( w, h ); AKUSetScreenSize ( w, h ); }
void MoaiWidget::refreshContext(){ printf("Starting load\n"); AKUContextID context = AKUGetContext (); if ( context ) { AKUDeleteContext ( context ); } AKUCreateContext (); AKUExtLoadLuacrypto (); AKUExtLoadLuacurl (); AKUExtLoadLuafilesystem (); AKUExtLoadLuasocket (); AKUExtLoadLuasql (); AKUSetInputConfigurationName ( "AKUQT" ); AKUReserveInputDevices ( QTInputDeviceID::TOTAL ); AKUSetInputDevice ( QTInputDeviceID::DEVICE, "device" ); AKUReserveInputDeviceSensors ( QTInputDeviceID::DEVICE, QTInputDeviceSensorID::TOTAL ); AKUSetInputDeviceKeyboard ( QTInputDeviceID::DEVICE, QTInputDeviceSensorID::KEYBOARD, "keyboard" ); AKUSetInputDevicePointer ( QTInputDeviceID::DEVICE, QTInputDeviceSensorID::POINTER, "pointer" ); AKUSetInputDeviceButton ( QTInputDeviceID::DEVICE, QTInputDeviceSensorID::MOUSE_LEFT, "mouseLeft" ); AKUSetInputDeviceButton ( QTInputDeviceID::DEVICE, QTInputDeviceSensorID::MOUSE_MIDDLE, "mouseMiddle" ); AKUSetInputDeviceButton ( QTInputDeviceID::DEVICE, QTInputDeviceSensorID::MOUSE_RIGHT, "mouseRight" ); AKUDetectGfxContext (); if(mWidth > 0 ) { AKUSetScreenSize ( mWidth, mHeight); AKUSetViewSize(mWidth,mHeight); } AKURunBytecode ( moai_lua, moai_lua_SIZE ); mTimer = new QTimer(this); mTimer->setInterval( 30 ); connect(mTimer, SIGNAL(timeout()), this, SLOT(onUpdate()) ); mTimer->start(); mInitialized = true; printf("Initialized\n"); }
void MoaiWidget::resizeGL(int w, int h) { if(mInitialized) { AKUSetScreenSize ( w, h); AKUSetViewSize(w,h); if(mDocuments) { setActiveDirectory(mActiveDirectory); mDocuments = false; } if(mScripts) { runScript(mActiveFile); mScripts = false; } } mWidth = w; mHeight = h; }
//----------------------------------------------------------------// extern "C" void Java_com_ziplinegames_moai_Moai_AKUSetScreenSize ( JNIEnv* env, jclass obj, jint width, jint height ) { AKUSetScreenSize ( width, height ); }
//----------------------------------------------------------------// static void _onReshape( int w, int h ) { glutReshapeWindow ( w, h ); AKUSetScreenSize ( w, h ); }