Example #1
0
// "main" is the S3E entry point
int main()
{
	Iw2DInit();
    IwUtilInit();
	
	
    // create game object
    pGame = new CGame;

    int currentUpdate = GetUpdateFrame();
    int nextUpdate = currentUpdate;
	s3ePointerUpdate();
    // to exit correctly, applications should poll for quit requests
    while(!s3eDeviceCheckQuitRequest())
    {
        // run logic at a fixed frame rate (defined by UPS)

        // block until the next frame (don't render unless at
        // least one update has occurred)
        while(!s3eDeviceCheckQuitRequest())
        {
            nextUpdate = GetUpdateFrame();
            if( nextUpdate != currentUpdate )
                break;
            s3eDeviceYield(1);
        }

        // execute update steps
        int frames = nextUpdate - currentUpdate;
        frames = MIN(MAX_UPDATES, frames);
        while(frames--)
        {
            pGame->Update(nextUpdate - currentUpdate);
        }
        currentUpdate = nextUpdate;

        // render the results
        pGame->Render();

        // if an application uses polling input the application
        // must call update once per frame
        s3ePointerUpdate();
        s3eKeyboardUpdate();

        // S3E applications should yield frequently
        s3eDeviceYield();
    }

    // clear up game object
    delete pGame;
	Ground::DestroyGround();
	IwUtilTerminate();
	Iw2DTerminate();
	
    return 0;
}
Example #2
0
S3E_MAIN_DECL int main()
{
    s3eBool available = FortumoAvailable();
    
	Fortumo_SetLoggingEnabled(true);
	
    while(!s3eDeviceCheckQuitRequest()) {
        s3eDeviceYield(0);
        s3ePointerUpdate();
        s3eDebugPrint(0, 30, (available) ? "Fortumo (OK)" : "Fortumo (ERR)", 0);
        s3eSurfaceShow();
        
        if(available && (s3ePointerGetState(S3E_POINTER_BUTTON_SELECT) & S3E_POINTER_STATE_PRESSED)) {
            Fortumo_PaymentRequest *request = Fortumo_PaymentRequest_Create();
            
            Fortumo_PaymentRequest_SetDisplayString(request, "display_string_here");
            Fortumo_PaymentRequest_SetService(request, "service_id_here", "app_secret_here");
            Fortumo_PaymentRequest_SetProductName(request, "product_name_here");
            Fortumo_PaymentRequest_SetConsumable(request, true);
            Fortumo_MakePayment(request, &Fortumo_OnPaymentComplete, NULL);
            Fortumo_PaymentRequest_Delete(request);
        }
    }
    
    return 0;
}
Example #3
0
//--------------------------------------------------------------------------
// Main global function
//--------------------------------------------------------------------------
S3E_MAIN_DECL void IwMain()
{
#ifdef EXAMPLE_DEBUG_ONLY
    // Test for Debug only examples
#endif

    // Example main loop
    ExampleInit();
    uint64 timeOld = s3eTimerGetMs();
    while (1)
    {
        s3eDeviceYield(0);
        s3eKeyboardUpdate();
        s3ePointerUpdate();

        uint64 timeNew = s3eTimerGetMs();
        float dt = (timeNew - timeOld) * 0.001f;
        timeOld = timeNew;

        bool result = ExampleUpdate(dt);
        if (
            (result == false) ||
            (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN)||
            (s3eKeyboardGetState(s3eKeyLSK) & S3E_KEY_STATE_DOWN)||
            (s3eDeviceCheckQuitRequest())
        )
            break;
        ExampleRender();
        //s3eSurfaceShow();
    }
    ExampleShutDown();
}
Example #4
0
int CCApplication::Run()
{
	IW_CALLSTACK("CCApplication::Run");
	
	if ( ! initInstance() || !applicationDidFinishLaunching() )
	{
		return 0;
	}
	
	int64 updateTime = s3eTimerGetMs();
	
	while (!s3eDeviceCheckQuitRequest()) 
	{ 
		int64 currentTime = s3eTimerGetMs();
		if (currentTime - updateTime > m_nAnimationInterval)
		{
			updateTime = currentTime;
			
			s3eDeviceYield(0);
			s3eKeyboardUpdate();
			s3ePointerUpdate();
			
			ccAccelerationUpdate();
			CCDirector::sharedDirector()->mainLoop();
		}
		else 
		{
			s3eDeviceYield(0);
		}
		
	}
	return -1;
}
Example #5
0
//-----------------------------------------------------------------------------
// Main global function
//-----------------------------------------------------------------------------
int main()
{
#ifdef EXAMPLE_DEBUG_ONLY
    // Test for Debug only examples
#ifndef IW_DEBUG
    DisplayMessage("This example is designed to run from a Debug build. Please build the example in Debug mode and run it again.");
    return 0;
#endif
#endif

    //IwGx can be initialised in a number of different configurations to help the linker eliminate unused code.
    //Normally, using IwGxInit() is sufficient.
    //To only include some configurations, see the documentation for IwGxInit_Base(), IwGxInit_GLRender() etc.
    IwGxInit();

    // Example main loop
    ExampleInit();

    // Set screen clear colour
    IwGxSetColClear(0xff, 0xff, 0xff, 0xff);
    IwGxPrintSetColour(128, 128, 128);
    
    while (1)
    {
        s3eDeviceYield(0);
        s3eKeyboardUpdate();
        s3ePointerUpdate();

        int64 start = s3eTimerGetMs();

        bool result = ExampleUpdate();
        if  (
            (result == false) ||
            (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN) ||
            (s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN) ||
            (s3eDeviceCheckQuitRequest())
            )
            break;

        // Clear the screen
        IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F);
        RenderButtons();
        RenderSoftkeys();
        ExampleRender();

        // Attempt frame rate
        while ((s3eTimerGetMs() - start) < MS_PER_FRAME)
        {
            int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start));
            if (yield<0)
                break;
            s3eDeviceYield(yield);
        }
    }
    ExampleShutDown();
    DeleteButtons();
    IwGxTerminate();
    return 0;
}
Example #6
0
	//! runs the device. Returns false if device wants to be deleted
	bool CIrrDeviceMarmalade::run()
	{
		s3eDeviceYield();
		s3ePointerUpdate();
		s3eKeyboardUpdate();
		os::Timer::tick();
		return !Close;
	}
Example #7
0
int main()
{
	IwGxInit();
	Iw2DInit();

	AppWarp::Client* WarpClientRef;
	AppWarp::Client::initialize("b29f4030aba3b2bc7002c4eae6815a4130c862c386e43ae2a0a092b27de1c5af","bf45f27e826039754f8dda659166d59ffb7b9dce830ac51d6e6b576ae4b26f7e");
	WarpClientRef = AppWarp::Client::getInstance();

	MenuScreen *menu = new MenuScreen;
	GameScreen *game = new GameScreen(WarpClientRef);

	Game *gm = new Game;
	gm->AddScene("game",game);
	gm->AddScene("menu",menu);

	menu->game = game;
	menu->app = gm;

	Listener listener(WarpClientRef,game);
	WarpClientRef->setConnectionRequestListener(&listener);
	WarpClientRef->setRoomRequestListener(&listener);
	WarpClientRef->setNotificationListener(&listener);

	s3ePointerRegister(S3E_POINTER_BUTTON_EVENT,(s3eCallback)HandleSingleTouchButtonCB,gm);

	while(!s3eDeviceCheckQuitRequest())
	{
		s3eKeyboardUpdate();
		if(s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN)
			break;

		WarpClientRef->update();
		s3ePointerUpdate();
		IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F);

		IwGxPrintSetScale(2);
		IwGxPrintString(0,0,game->msg.c_str());

		gm->Move();
		gm->Render();

		Iw2DSurfaceShow();
		s3eDeviceYield();
	}

	s3ePointerUnRegister(S3E_POINTER_BUTTON_EVENT,(s3eCallback)HandleSingleTouchButtonCB);

	gm->CleanUp();
	delete menu;
	delete game;
	delete gm;

	WarpClientRef->terminate();

	Iw2DTerminate();
	IwGxTerminate();
}
Example #8
0
File: input.cpp Project: dblo/XTD
void CInput::Update()
{
	// Update the pointer if it is available
	if (PointerAvailable)
		s3ePointerUpdate();

	// Update key system if it is available
	if (KeysAvailable)
		s3eKeyboardUpdate();
}
Example #9
0
int CCApplication::Run()
{
	IW_CALLSTACK("CCApplication::Run");
	
	s3eBool quitRequested = 0;
    bool bNeedQuit = false;

	if (!applicationDidFinishLaunching() )
	{
		return 0;
	}
	
	uint64 updateTime = 0 ;
	
	while (true) 
	{ 
		updateTime = s3eTimerGetMs();
			
		s3eDeviceYield(0);
		s3eKeyboardUpdate();
		s3ePointerUpdate();
			
		ccAccelerationUpdate();

		quitRequested = s3eDeviceCheckQuitRequest();
		if( quitRequested) {
            CCDirector* pDirector = CCDirector::sharedDirector();
            // if opengl view has been released, delete the director.
            if (pDirector->getOpenGLView() == NULL)
            {
                CC_SAFE_DELETE(pDirector);
                bNeedQuit = true;
            }
            else
            {
                pDirector->end();
            }
		}

		if( bNeedQuit ) {
			break;
		}

        CCDirector::sharedDirector()->mainLoop();

		while ((s3eTimerGetMs() - updateTime) < m_nAnimationInterval) {
			int32 yield = (int32) (m_nAnimationInterval - (s3eTimerGetMs() - updateTime));
			if (yield<0)
				break;
			s3eDeviceYield(yield);
		}
		
	}
	return -1;
}
int main()
{
	Initialize();

	// --HowTo: Load the tmx map from the json file
	tmxparser::Map_t *map = new tmxparser::Map_t;
	tmxparser::parseTmxFromJSON_file("testLevel.json", map);
	// --HowTo: Create a renderer
	tmxparser::TmxRenderer *renderer = new tmxparser::TmxRenderer(map);
	// an offset to use for scrolling the map
	CIwFVec2 offset(0,0);
	
	IwGxSetColClear(0x2f, 0x3f, 0x3f, 0xff);
    
    // Loop forever, until the user or the OS performs some action to quit the app
    while (!s3eDeviceCheckQuitRequest())
    {
        //Update the input systems
        s3eKeyboardUpdate();
        s3ePointerUpdate();

        // Clear the surface
        IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F);

		// --HowTo: render all layers, at original pixel size:
		//renderer->Render(offset); 

		// --HowTo: render all layers at reduced/scaled tile size
		renderer->Render(offset, CIwFVec2(64.0f, 64.0f)); 
		
		// --HowTo: render only one layer at original pixel size
		//renderer->RenderLayer(0, offset, CIwFVec2(0.0f, 0.0f));

		// --HowTo: render only one layer at scaled pixel size
		//renderer->RenderLayer(0, offset, CIwFVec2(64.0f, 64.0f));

		// advance offset
		offset.x += 3;
		if (offset.x>1900)
			offset.x =0;

        // Standard EGL-style flush of drawing to the surface
        IwGxFlush();
        IwGxSwapBuffers();
        s3eDeviceYield(0);
    }

	delete renderer;
	delete map;

	Terminate();    
    // Return
    return 0;
}
Example #11
0
//-----------------------------------------------------------------------------
// Main global function
//-----------------------------------------------------------------------------
int main()
{
#ifdef EXAMPLE_DEBUG_ONLY
    // Test for Debug only examples
#ifndef IW_DEBUG
    DisplayMessage("This example is designed to run from a Debug build. Please build the example in Debug mode and run it again.");
    return 0;
#endif
#endif

    Iw2DInit();

    // Example main loop
    ExampleInit();
    // Set screen clear colour

    while (1)
    {
        s3eDeviceYield(0);
        s3eKeyboardUpdate();
        s3ePointerUpdate();

        int64 start = s3eTimerGetMs();

        bool result = ExampleUpdate();
        if  (
            (result == false) ||
            (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN) ||
            (s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN) ||
            (s3eDeviceCheckQuitRequest())
            )
            break;

        // Clear the screen
        Iw2DSurfaceClear(0xffffffff);
        RenderSoftkeys();
        ExampleRender();

        // Attempt frame rate
        while ((s3eTimerGetMs() - start) < MS_PER_FRAME)
        {
            int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start));
            if (yield<0)
                break;
            s3eDeviceYield(yield);
        }
    }
    ExampleShutDown();
    Iw2DTerminate();
    return 0;
}
int HelloWorldMain() 
{
	HelloWorldInit();
	while (!s3eDeviceCheckQuitRequest())
	{
		s3eDeviceYield(0);
        s3eKeyboardUpdate();
        s3ePointerUpdate();
		HelloWorldRender();
		if(!HelloWorldUpdate())
			break;
	}
	HelloWorldShutDown();
    return 0;
}
int CCApplication::Run()
{
	IW_CALLSTACK("CCApplication::Run");
	
	s3eBool quitRequested = 0;

	if ( ! initInstance() || !applicationDidFinishLaunching() )
	{
		return 0;
	}
	
	int64 updateTime = s3eTimerGetMs();
	
	while (true) 
	{ 
		int64 currentTime = s3eTimerGetMs();
		if (currentTime - updateTime > m_nAnimationInterval)
		{
			updateTime = currentTime;
			
			s3eDeviceYield(0);
			s3eKeyboardUpdate();
			s3ePointerUpdate();
			
			ccAccelerationUpdate();

			quitRequested = s3eDeviceCheckQuitRequest() ;
			if( quitRequested && CCDirector::sharedDirector()->getOpenGLView() != NULL ) {
				CCDirector::sharedDirector()->end() ;
				// end status will be processed in CCDirector::sharedDirector()->mainLoop();
			}

			CCDirector::sharedDirector()->mainLoop();

			if( quitRequested ) {
				break ;
			}
		}
		else 
		{
			s3eDeviceYield(0);
		}
		
	}
	return -1;
}
static int32 TouchMotionEventHandler(void* systemData, void* userData)
{
	//sprintf(g_StatusString, "TouchMotionEventHandler");

	// Wake up and take control from the OS
    s3eDeviceUnYield();

    s3ePointerUpdate();

    // Read in the type of key that has been pressed
    s3eKeyboardEvent* pkeyPressed = (s3eKeyboardEvent*)systemData;
    s3eKey keyPressed = (*pkeyPressed).m_Key;

	sprintf(g_debugTouchMotionEvent, "TouchMotionEventHandler: Key event detected. key=%d", keyPressed);

	render();

    return 0;
}
Example #15
0
int main()
{

    Iw2DInit();
    game = new Game();
	game->Initialize();
	game->NewGame();
	int currentUpdate = GetUpdateFrame();
    int nextUpdate = currentUpdate;
	s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback) MouseEventCallback, NULL);
    while(!s3eDeviceCheckQuitRequest())
    {
		 while(!s3eDeviceCheckQuitRequest())
        {
            nextUpdate = GetUpdateFrame();
            if( nextUpdate != currentUpdate )
                break;
            s3eDeviceYield(1);
        }

		// execute update steps
        int frames = nextUpdate - currentUpdate;
        frames = MIN(MAX_UPDATES, frames);
        while(frames--)
        {
            game->Update();
        }

		Iw2DSurfaceClear(0xffffffff);
		game->Render();
		Iw2DSurfaceShow();
        s3ePointerUpdate();
        s3eKeyboardUpdate();
        s3eDeviceYield();
    }

    delete game;

    Iw2DTerminate();

    return 0;
}
Example #16
0
		bool update()
		{
			ThreadMessages::message msg;
			while (_threadMessages.peek(msg, true))	{}

#ifdef __S3E__

			s3eDeviceYield(0);
			s3eKeyboardUpdate();
			s3ePointerUpdate();

			bool done = false;

			if (s3eDeviceCheckQuitRequest())
				done = true;

			if (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_PRESSED)
				done = true;

			return done;
#endif


#if OXYGINE_SDL || EMSCRIPTEN

			//log::messageln("update");

			bool done = false;
			SDL_Event event;
			while (SDL_PollEvent(&event))
			{
#if !EMSCRIPTEN //emscripten handled events from callback
				SDL_handleEvent(event, done);
#endif
			}

			return done;
#endif

			log::warning("update not implemented");
			return true;
		}
bool ExamplesMainUpdate()
{
    s3eDeviceYield(0);
    s3eKeyboardUpdate();
    s3ePointerUpdate();

    int64 start = s3eTimerGetMs();

    if (!ExampleUpdate() || ExampleCheckQuit())
    {
        s3eDebugTracePrintf("ExampleUpdate returned false, exiting..");
        return false;
    }

    // Clear the screen
    if (g_ClearScreen)
        IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F);

    ButtonsRender();

    if (g_DrawCursor)
        CursorRender();

    SoftkeysRender();

    // User code render
    ExampleRender();

    // Attempt frame rate
    while ((s3eTimerGetMs() - start) < MS_PER_FRAME)
    {
        int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start));
        if (yield<0)
            break;
        s3eDeviceYield(yield);
    }

    IwGxFlush();
    IwGxSwapBuffers();

    return true;
}
Example #18
0
int main()
{
	GameInit();
	DrawMap();
	
//	DrawMap();
    while(!s3eDeviceCheckQuitRequest())
    {
		s3ePointerUpdate();
		s3eKeyboardUpdate();
		if(s3ePointerGetState(S3E_POINTER_BUTTON_SELECT))
		{
			Go(s3ePointerGetX(),s3ePointerGetY());
		}
        // S3E applications should yield frequently
        s3eDeviceYield();
    }


    return 0;
}
int main()
{
    // create game object
	engine.Init("Game");
	engine.ChangeState(IntroState::Instance());
    
	while(engine.Running())
	{
		engine.HandleEvent();
		engine.Update();
		engine.Draw();
		s3ePointerUpdate();
		s3eKeyboardUpdate();

		// S3E applications should yield frequently
		s3eDeviceYield();
	}
    // clear up game object
    engine.Destroy();
    return 0;
}
Example #20
0
S3E_MAIN_DECL void IwMain()
{
    Init();

    // Set screen clear colour
    IwGxSetColClear(0, 0, 0, 0xff);
    IwGxPrintSetColour(128, 128, 128);

    while (1)
    {
        s3eDeviceYield(0);
        s3eKeyboardUpdate();
        s3ePointerUpdate();

        int64 start = s3eTimerGetMs();

        bool result = Update();
        if  (
            ((result == false) ||
            (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN) ||
            (s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN) ||
            (s3eDeviceCheckQuitRequest()))
            )
            break;

        Render();

        // Attempt frame rate
        while ((s3eTimerGetMs() - start) < MS_PER_FRAME)
        {
            int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start));
            if (yield<0)
                break;
            s3eDeviceYield(yield);
        }
    }

    ShutDown();
}
Example #21
0
void ExampleRender()
{
    // Get pointer to the screen surface
    // (pixel depth is 2 bytes by default)
    uint16* screen = (uint16*)s3eSurfacePtr();
    int height = s3eSurfaceGetInt(S3E_SURFACE_HEIGHT);
    int width = s3eSurfaceGetInt(S3E_SURFACE_WIDTH);
    int pitch = s3eSurfaceGetInt(S3E_SURFACE_PITCH);
    
    // Clear screen to white
    for (int i=0; i < height; i++)
    {
        memset((char*)screen + pitch * i, 255, (width * 2));
    }
    
    // This was causing an error to pop up.
    s3ePointerUpdate();
    
    ButtonsRender();
    
    s3eDebugPrint(20, 365, g_TouchEventMsg, 1);
}
bool ExamplesMainUpdate() {
    s3eKeyboardUpdate();
    s3ePointerUpdate();

    if (!ExampleUpdate())
    {
        s3eDebugTracePrintf("ExampleUpdate returned false, exiting..");
        return false;
    }

    if (g_ClearScreen)
        s3eSurfaceClear(0xff,0xff,0xff);

    ExampleRender();
    ButtonsRender();
    SoftkeysRender();

    if (g_DrawCursor)
        CursorRender();

    s3eSurfaceShow();
    s3eDeviceYield(FRAMETIME);
    return true;
}
Example #23
0
PointerEventType UpdatePointer()
{
	PointerEventType res = petNone;
	s3ePointerUpdate();
	if (g_pointerdown)
	{
		if (s3ePointerGetState(S3E_POINTER_BUTTON_SELECT) & S3E_POINTER_STATE_DOWN)
		{
			int32 x = s3ePointerGetX();
			int32 y = s3ePointerGetY();
			if (x != g_pointerx || y != g_pointery)
			{
				res = petMove;
				g_pointerx = x;
				g_pointery = y;
			}
		}
		else
		{
			g_pointerdown = false;
			res = petUp;
		}
	}
	else
	{
		if (s3ePointerGetState(S3E_POINTER_BUTTON_SELECT) & S3E_POINTER_STATE_DOWN)
		{
			g_pointerx = s3ePointerGetX();
			g_pointery = s3ePointerGetY();
			g_pointerdown = true;
			res = petDown;
		}
	}

	return res;
}
Example #24
0
        void init(init_desc* desc_ptr)
        {
            std::string t;

#ifdef OX_DEBUG
            t += "OX_DEBUG ";
#endif

#ifdef NDEBUG
            t += "NDEBUG ";
#endif

#ifdef _DEBUG
            t += "_DEBUG ";
#endif

#ifdef DEBUG
            t += "DEBUG ";
#endif

            log::messageln("build settings %s", t.c_str());

            init0();


            log::messageln("initialize oxygine");
            if (desc_ptr)
                desc = *desc_ptr;

#ifdef __S3E__
            log::messageln("S3E build");
            if (!IwGLInit())
            {
                s3eDebugErrorShow(S3E_MESSAGE_CONTINUE, "IwGLInit failed");
                return;
            }
            //init_ext();

            int width = IwGLGetInt(IW_GL_WIDTH);
            int height = IwGLGetInt(IW_GL_HEIGHT);

            log::messageln("Screen BPP  : %d", s3eSurfaceGetInt(S3E_SURFACE_PIXEL_TYPE) & S3E_SURFACE_PIXEL_SIZE_MASK);
            log::messageln("Screen Size : %dx%d", width, height);
            log::messageln("Vendor      : %s", (const char*)glGetString(GL_VENDOR));
            log::messageln("Renderer    : %s", (const char*)glGetString(GL_RENDERER));

            const char* version = (const char*)glGetString(GL_VERSION);
            log::messageln("Version    : %s", version);

            s3ePointerUpdate();
            if (s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE))
            {
                s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, &pointerTouchEvent, 0);
                s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, &pointerTouchMotionEvent, 0);
            }
            else
            {
                s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, &pointerEvent, 0);
                s3ePointerRegister(S3E_POINTER_MOTION_EVENT, &pointerMotionEvent, 0);
            }

            s3eDeviceRegister(S3E_DEVICE_UNPAUSE, applicationUnPause, 0);
            s3eDeviceRegister(S3E_DEVICE_PAUSE, applicationPause, 0);

#elif OXYGINE_SDL

            log::messageln("SDL build");


            SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1");

            SDL_Init(SDL_INIT_VIDEO);


            if (desc.mode24bpp)
            {
                SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
                SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
                SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
            }
            else
            {
                SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
                SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
                SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
            }

            SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0);
            //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
            //SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
            SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
            SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);

            if (desc.force_gles)
            {
                SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
                SDL_GL_SetAttribute(SDL_GL_CONTEXT_EGL, 1);
            }

            SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);

            int flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;

#if TARGET_OS_IPHONE
            flags |= SDL_WINDOW_BORDERLESS;
            flags |= SDL_WINDOW_ALLOW_HIGHDPI;
            flags |= SDL_WINDOW_FULLSCREEN;
#endif

            //SDL_DisplayMode mode;
            //SDL_GetCurrentDisplayMode(0, &mode);
            //log::messageln("display mode: %d %d", mode.w, mode.h);

            if (desc.w == -1 && desc.h == -1)
            {
                desc.w = 960;
                desc.h = 640;
            }

            if (desc.fullscreen)
                flags |= SDL_WINDOW_FULLSCREEN;

            {
                Event ev(EVENT_PRECREATEWINDOW);
                _dispatcher->dispatchEvent(&ev);
            }

            log::messageln("creating window %d %d", desc.w, desc.h);

            _window = SDL_CreateWindow(desc.title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, desc.w, desc.h, flags);

            if (!_window)
            {
                log::error("can't create window: %s", SDL_GetError());
                return;
            }
            _context = SDL_GL_CreateContext(_window);
            if (!_context)
            {
                log::error("can't create gl context: %s", SDL_GetError());
                return;
            }

            SDL_GL_SetSwapInterval(desc.vsync ? 1 : 0);

#ifdef EMSCRIPTEN
            SDL_SetEventFilter(SDL_eventsHandler, 0);

            int v = EM_ASM_INT(
            {
                var p = navigator.platform;
                if (p == 'iPad' || p == 'iPhone' || p == 'iPod')
                    return 1;
                return 0;
            }, 0);
void Update()
{
	// Allow device OS time to do its processing
	s3eDeviceYield(0);

	// Update pointer (actually touch screen!) inputs
	s3ePointerUpdate();

	// Read current touch screen inputs and use them to update Button states
	uint32 lTouchState = s3ePointerGetState(S3E_POINTER_BUTTON_SELECT);
	int32 x = s3ePointerGetX();
	int32 y = s3ePointerGetY();
	for (uint32 i = 0; i < BUTTON_COUNT; i++)
	{
		gButton[i]->Update(lTouchState, x, y);
	}

	// Check for button presses
	if (gButton[BUTTON_AUDIO_MUSIC]->IsReleased())
	{
		s3eAudioPlay("black-hole.mp3");
	}
	else if (gButton[BUTTON_AUDIO_SFX]->IsReleased())
	{
		if (gpGunBattleSound)
			gpGunBattleSound->Play();
	}
	else if (gButton[BUTTON_AUDIO_SPEECH]->IsReleased())
	{
		if (gpFemaleCountingSound)
			gpFemaleCountingSound->Play();
	}
	else if (gButton[BUTTON_AUDIO_OFF]->IsReleased())
	{
		s3eAudioStop();
		s3eSoundStopAllChannels();
	}

	if (gButton[BUTTON_FILTER_OFF]->IsReleased())
	{
		if (gDolbyInitialised)
		{
			s3eDolbyAudioSetEnabled(S3E_FALSE);
		}
	}
	else if (gButton[BUTTON_FILTER_MUSIC]->IsReleased())
	{
		if (gDolbyInitialised)
		{
			s3eDolbyAudioSetEnabled(S3E_TRUE);
			s3eDolbyAudioSetProfile(MUSIC);
		}
	}
	else if (gButton[BUTTON_FILTER_MOVIE]->IsReleased())
	{
		if (gDolbyInitialised)
		{
			s3eDolbyAudioSetEnabled(S3E_TRUE);
			s3eDolbyAudioSetProfile(MOVIE);
		}
	}
	else if (gButton[BUTTON_FILTER_GAME]->IsReleased())
	{
		if (gDolbyInitialised)
		{
			s3eDolbyAudioSetEnabled(S3E_TRUE);
			s3eDolbyAudioSetProfile(GAME);
		}
	}
	else if (gButton[BUTTON_FILTER_VOICE]->IsReleased())
	{
		if (gDolbyInitialised)
		{
			s3eDolbyAudioSetEnabled(S3E_TRUE);
			s3eDolbyAudioSetProfile(VOICE);
		}
	}
}
Example #26
0
		bool update()
		{
			ThreadMessages::message msg;
			while (_threadMessages.peek(msg, true))
			{

			}
#ifdef __S3E__

			s3eDeviceYield(0);
			s3eKeyboardUpdate();
			s3ePointerUpdate();

			bool done = false;

			if (s3eDeviceCheckQuitRequest())
				done = true;

			if (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_PRESSED)
				done = true;

			return done;
#endif


	#if OXYGINE_SDL || EMSCRIPTEN

			//log::messageln("update");
			Input *input = &Input::instance;
			bool done = false;
			SDL_Event event;
			while (SDL_PollEvent(&event)) 
			{
				Event ev(Input::event_platform);
				ev.userData = &event;
				Input::instance.dispatchEvent(&ev);
				
				ObjectScript::processKeyboardEvent(&ev, getStage().get());

				switch(event.type)
				{
				case SDL_QUIT:
					done = true;
					break;
				case SDL_WINDOWEVENT:
					{					
						/*
						if (event.window.event == SDL_WINDOWEVENT_ENTER)
							active = false;
						if (event.window.event == SDL_WINDOWEVENT_LEAVE)
							active = true;
							*/

						if (event.window.event == SDL_WINDOWEVENT_MINIMIZED)
							active = false;
						if (event.window.event == SDL_WINDOWEVENT_RESTORED)
							active = true;

						bool newFocus = focus;
						if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST)
							newFocus = false;
						if (event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED)
							newFocus = true;
						if (focus != newFocus)
						{
							focus = newFocus;
#if HANDLE_FOCUS_LOST

							if (focus)							
								focusAcquired();

							log::messageln("focus: %d", (int)focus);
							Event ev(focus ? Stage::ACTIVATE : Stage::DEACTIVATE);
							if (getStage())
								getStage()->dispatchEvent(&ev);

							if (!focus)
								focusLost();							
#endif							
						}
						//log::messageln("SDL_SYSWMEVENT %d", (int)event.window.event);
						break;
					}
				case SDL_MOUSEWHEEL:
					input->sendPointerWheelEvent(event.wheel.y, &input->_pointerMouse);
					break;
				case SDL_KEYDOWN:
				{
					KeyEvent ev(KeyEvent::KEY_DOWN, &event.key);
					getStage()->dispatchEvent(&ev);
				} break;
				case SDL_KEYUP:
				{
					KeyEvent ev(KeyEvent::KEY_UP, &event.key);
					getStage()->dispatchEvent(&ev);
				} break;
#if SDL_VIDEO_OPENGL
				case SDL_MOUSEMOTION:
					input->sendPointerMotionEvent((float)event.motion.x, (float)event.motion.y, 1.0f, &input->_pointerMouse);
					break;
				case SDL_MOUSEBUTTONDOWN:
				case SDL_MOUSEBUTTONUP:
					{
						MouseButton b = MouseButton_Left;
						switch(event.button.button)
						{
							case 1: b = MouseButton_Left; break;
							case 2: b = MouseButton_Middle; break;
							case 3: b = MouseButton_Right; break;
						}

						input->sendPointerButtonEvent(b, (float)event.button.x, (float)event.button.y, 1.0f, 
							event.type == SDL_MOUSEBUTTONDOWN ? TouchEvent::TOUCH_DOWN : TouchEvent::TOUCH_UP, &input->_pointerMouse);
					}					
					break;
#else

				case SDL_FINGERMOTION:
					{
						//log::messageln("SDL_FINGERMOTION");
						Vector2 pos = convertTouch(event);
						input->sendPointerMotionEvent(
							pos.x, pos.y, event.tfinger.pressure,
							input->getTouchByID((int)event.tfinger.fingerId));
					}
				
					break;
				case SDL_FINGERDOWN:
				case SDL_FINGERUP:
					{				
						//log::messageln("SDL_FINGER");
						Vector2 pos = convertTouch(event);
						input->sendPointerButtonEvent(
							MouseButton_Touch,
							pos.x, pos.y, event.tfinger.pressure,
							event.type == SDL_FINGERDOWN ? TouchEvent::TOUCH_DOWN : TouchEvent::TOUCH_UP,
							input->getTouchByID((int)event.tfinger.fingerId));
					}				
					break;
#endif
				}
			}


			return done;
	#elif EMSCRIPTEN
			return false;
	#endif


			log::warning("update not implemented");
			return true;
		}
Example #27
0
int main(int, char**)
{
    IwGxInit();

    // Setup Dear ImGui binding
    IMGUI_CHECKVERSION();
    ImGui::CreateContext();
    ImGuiIO& io = ImGui::GetIO(); (void)io;
    //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;  // Enable Keyboard Controls
    ImGui_Marmalade_Init(true);

    // Setup style
    ImGui::StyleColorsDark();
    //ImGui::StyleColorsClassic();

    // Load Fonts
    // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. 
    // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 
    // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
    // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
    // - Read 'misc/fonts/README.txt' for more instructions and details.
    // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
    //io.Fonts->AddFontDefault();
    //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
    //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
    //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
    //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
    //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
    //IM_ASSERT(font != NULL);

    bool show_demo_window = true;
    bool show_another_window = false;
    ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);

    // Main loop
    while (true)
    {
        if (s3eDeviceCheckQuitRequest())
            break;

        // Poll and handle inputs
        // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
        // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.
        // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
        // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
        s3eKeyboardUpdate();
        s3ePointerUpdate();

        // Start the Dear ImGui frame
        ImGui_Marmalade_NewFrame();
        ImGui::NewFrame();

        // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
        if (show_demo_window)
            ImGui::ShowDemoWindow(&show_demo_window);

        // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
        {
            static float f = 0.0f;
            static int counter = 0;

            ImGui::Begin("Hello, world!");                          // Create a window called "Hello, world!" and append into it.

            ImGui::Text("This is some useful text.");               // Display some text (you can use a format strings too)
            ImGui::Checkbox("Demo Window", &show_demo_window);      // Edit bools storing our window open/close state
            ImGui::Checkbox("Another Window", &show_another_window);

            ImGui::SliderFloat("float", &f, 0.0f, 1.0f);            // Edit 1 float using a slider from 0.0f to 1.0f    
            ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color

            if (ImGui::Button("Button"))                            // Buttons return true when clicked (most widgets return true when edited/activated)
                counter++;
            ImGui::SameLine();
            ImGui::Text("counter = %d", counter);

            ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
            ImGui::End();
        }

        // 3. Show another simple window.
        if (show_another_window)
        {
            ImGui::Begin("Another Window", &show_another_window);   // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
            ImGui::Text("Hello from another window!");
            if (ImGui::Button("Close Me"))
                show_another_window = false;
            ImGui::End();
        }

        // Rendering
        ImGui::Render();
        IwGxSetColClear(clear_color.x * 255, clear_color.y * 255, clear_color.z * 255, clear_color.w * 255);
        IwGxClear();
        ImGui_Marmalade_RenderDrawData(ImGui::GetDrawData());
        IwGxSwapBuffers();

        s3eDeviceYield(0);
    }

    // Cleanup
    ImGui_Marmalade_Shutdown();
    ImGui::DestroyContext();
    IwGxTerminate();

    return 0;
}
static int32 KeyEventHandler(void* systemData, void* userData)
{
	//sprintf(g_StatusString, "KeyEventHandler");

    // Wake up and take control from the OS
    s3eDeviceUnYield();

    s3ePointerUpdate();

    // Read in the type of key that has been pressed
    s3eKeyboardEvent* pkeyPressed = (s3eKeyboardEvent*)systemData;
    s3eKey keyPressed = (*pkeyPressed).m_Key;

	sprintf(g_debugKeyEvent, "KeyEventHandler: Key event detected. key=%d pressed=%s", keyPressed, (*pkeyPressed).m_Pressed ? "true" : "false");

	if (keyPressed == 210)
	{
		m_controllers[0].PressedButtonA = (*pkeyPressed).m_Pressed;
	}

	else if (keyPressed == 208)
	{
		m_controllers[0].PressedButtonO = (*pkeyPressed).m_Pressed;
	}

	else if (keyPressed == 203)
	{
		m_controllers[0].PressedButtonU = (*pkeyPressed).m_Pressed;
	}

	else if (keyPressed == 202)
	{
		m_controllers[0].PressedButtonY = (*pkeyPressed).m_Pressed;
	}

	else if (keyPressed == 205)
	{
		m_controllers[0].PressedDpadDown = (*pkeyPressed).m_Pressed;
	}

	else if (keyPressed == 206)
	{
		m_controllers[0].PressedDpadLeft = (*pkeyPressed).m_Pressed;
	}

	else if (keyPressed == 207)
	{
		m_controllers[0].PressedDpadRight = (*pkeyPressed).m_Pressed;
	}

	else if (keyPressed == 204)
	{
		m_controllers[0].PressedDpadUp = (*pkeyPressed).m_Pressed;
	}

	else if (keyPressed == 74)
	{
		m_controllers[0].PressedLeftBumper = (*pkeyPressed).m_Pressed;
	}

	//m_controllers[0].PressedLeftTrigger;
	//m_controllers[0].PressedLeftStick;

	else if (keyPressed == 75)
	{
		m_controllers[0].PressedRightBumper = (*pkeyPressed).m_Pressed;
	}

	//m_controllers[0].PressedRightTrigger;
	//m_controllers[0].PressedRightStick;

	else if (keyPressed == 127)
	{
		// system buton
	}

	render();

    return 0;
}
        void init(init_desc* desc_ptr)
        {
            Input::instance.__removeFromDebugList();

            log::messageln("initialize oxygine");
            if (desc_ptr)
                desc = *desc_ptr;

#ifdef __S3E__
            log::messageln("S3E build");
            if (!IwGLInit())
            {
                s3eDebugErrorShow(S3E_MESSAGE_CONTINUE, "IwGLInit failed");
                return;
            }
            //init_ext();

            int width = IwGLGetInt(IW_GL_WIDTH);
            int height = IwGLGetInt(IW_GL_HEIGHT);

            log::messageln("Screen BPP  : %d", s3eSurfaceGetInt(S3E_SURFACE_PIXEL_TYPE) & S3E_SURFACE_PIXEL_SIZE_MASK);
            log::messageln("Screen Size : %dx%d", width, height);
            log::messageln("Vendor      : %s", (const char*)glGetString(GL_VENDOR));
            log::messageln("Renderer    : %s", (const char*)glGetString(GL_RENDERER));

            const char* version = (const char*)glGetString(GL_VERSION);
            log::messageln("Version    : %s", version);

            s3ePointerUpdate();
            if (s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE))
            {
                s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, &pointerTouchEvent, 0);
                s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, &pointerTouchMotionEvent, 0);
            }
            else
            {
                s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, &pointerEvent, 0);
                s3ePointerRegister(S3E_POINTER_MOTION_EVENT, &pointerMotionEvent, 0);
            }

            s3eDeviceRegister(S3E_DEVICE_UNPAUSE, applicationUnPause, 0);
            s3eDeviceRegister(S3E_DEVICE_PAUSE, applicationPause, 0);

#elif EMSCRIPTEN
            log::messageln("EMSCRIPTEN build");

            if (desc.w == -1 && desc.h == -1)
            {
                int fs = 0;
                emscripten_get_canvas_size(&desc.w, &desc.h, &fs);
            }

            if (SDL_Init(SDL_INIT_VIDEO) != 0)
            {
                log::error("Unable to initialize SDL: %s\n", SDL_GetError());
            }

            SDL_Surface* screen;
            screen = SDL_SetVideoMode(desc.w, desc.h, 32, SDL_OPENGL);
            _displaySize = Point(desc.w, desc.h);

            emscripten_SDL_SetEventHandler(SDL_eventsHandler, 0);

            int v = EM_ASM_INT(
            {
                var p = navigator.platform;
                if (p == 'iPad' || p == 'iPhone' || p == 'iPod')
                    return 1;
                return 0;
            }, 0);
Example #30
0
		void init(init_desc *desc_ptr)
		{
			Input::instance.__removeFromDebugList();

			log::messageln("initialize oxygine");
			if (desc_ptr)
				desc = *desc_ptr;

#ifdef __S3E__
			log::messageln("S3E build");
			if (!IwGLInit())
			{
				s3eDebugErrorShow(S3E_MESSAGE_CONTINUE, "IwGLInit failed");
				return;
			}
			//init_ext();

			int width = IwGLGetInt(IW_GL_WIDTH);
			int height = IwGLGetInt(IW_GL_HEIGHT);

			log::messageln("Screen BPP  : %d", s3eSurfaceGetInt(S3E_SURFACE_PIXEL_TYPE) & S3E_SURFACE_PIXEL_SIZE_MASK);
			log::messageln("Screen Size : %dx%d", width, height);
			log::messageln("Vendor      : %s", (const char*)glGetString( GL_VENDOR ) );
			log::messageln("Renderer    : %s", (const char*)glGetString( GL_RENDERER ));

			const char *version = (const char*)glGetString( GL_VERSION );
			log::messageln( "Version    : %s", version);

			s3ePointerUpdate();
			if (s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE))
			{
				s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, &pointerTouchEvent, 0);
				s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, &pointerTouchMotionEvent, 0);
			}
			else
			{
				s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, &pointerEvent, 0);
				s3ePointerRegister(S3E_POINTER_MOTION_EVENT, &pointerMotionEvent, 0);
			}	

			s3eDeviceRegister(S3E_DEVICE_UNPAUSE, applicationUnPause, 0);
			s3eDeviceRegister(S3E_DEVICE_PAUSE, applicationPause, 0);
#elif EMSCRIPTEN
			log::messageln("EMSCRIPTEN build");

			if (desc.w == -1 && desc.h == -1)
			{
				int fs = 0;
				emscripten_get_canvas_size(&desc.w, &desc.h, &fs);
			}

			if ( SDL_Init(SDL_INIT_VIDEO) != 0 ) 
			{
				log::error("Unable to initialize SDL: %s\n", SDL_GetError());				
			}

			SDL_Surface *screen;
			screen = SDL_SetVideoMode(desc.w, desc.h, 32, SDL_OPENGL); 
			_displaySize = Point(desc.w, desc.h);

			emscripten_SDL_SetEventHandler(SDL_eventsHandler, 0);
#elif OXYGINE_SDL

			log::messageln("SDL build");
			

			SDL_Init(SDL_INIT_VIDEO);


			SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
			SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
			SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
			SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0);
			SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
			SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 0);
			//SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
			SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
			SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
			SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);

			int flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;

#if TARGET_OS_IPHONE
			flags |= SDL_WINDOW_BORDERLESS;
#endif                

			SDL_DisplayMode mode;
			SDL_GetCurrentDisplayMode(0, &mode);
			log::messageln("display mode: %d %d", mode.w, mode.h);

			if (desc.w == -1 && desc.h == -1)
			{
				desc.w = 960;
				desc.h = 640;
			}

			if (desc.fullscreen)
				flags |= SDL_WINDOW_FULLSCREEN;

			log::messageln("creating window %d %d", desc.w, desc.h);

			_window = SDL_CreateWindow(desc.title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, desc.w, desc.h, flags);

			if (!_window)
			{
				log::error("can't create window: %s", SDL_GetError());
				return;
			}
			_context = SDL_GL_CreateContext(_window);
			if (!_context)
			{
				log::error("can't create gl context: %s", SDL_GetError());
				return;
			}

			SDL_GL_SetSwapInterval(desc.vsync ? 1 : 0);
			

			//SDL_SetEventFilter(eventsFilter, 0);

#endif
			file::init(desc.companyName, desc.appName);
			init2();
		}