void CSdlAppUi::ConstructL() { BaseConstructL(ENoScreenFurniture | EAppOrientationLandscape); iSDLWin = new (ELeave) CSDLWin; iSDLWin->ConstructL(ApplicationRect()); iSdl = CSDL::NewL(CSDL::EEnableFocusStop); iSdlObserver = new (ELeave) CSDLObserver(iSdl); iSdl->SetContainerWindowL( iSDLWin->GetWindow(), iEikonEnv->WsSession(), *iEikonEnv->ScreenDevice()); iSdl->SetObserver(iSdlObserver); iSdl->DisableKeyBlocking(*this); iWait = new (ELeave) CExitWait(*this); CDesC8ArrayFlat* args = new (ELeave)CDesC8ArrayFlat(10); AddCmdLineParamsL(*args); iSdl->CallMainL(iWait->iStatus, *args, CSDL::ENoFlags, 81920); delete args; iWait->Start(); }
void CSdlAppUi::HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination) { if (iSdl != NULL) iSdl->AppendWsEvent(aEvent); CAknAppUi::HandleWsEventL(aEvent, aDestination); }
int main() { CGL *gl = new CGL(SCREEN_WIDTH, SCREEN_HEIGHT); gl->initGL(); int flags= SDL_OPENGL|SDL_RESIZABLE; CSDL *sdl = new CSDL(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP,flags, gl); sdl->setCaption("Basic Shading"); while(true) { sdl->handleEvent(gl); gl->renderGL(); } return 0; }
void CSdlAppUi::StartTestL(TInt aCmd) { //TInt flags = CSDL::EDrawModeGdi | CSDL::EEnableFocusStop // | CSDL::EMainThread;// | CSDL::EAutoOrientation; TInt flags = 0; //flags |= CSDL::EDrawModeDSB | CSDL::EDrawModeDSBDoubleBuffer; flags |= CSDL::EDrawModeGdi; // Don't draw when in background. //flags |= CSDL::EEnableFocusStop; flags |= CSDL::EAutoOrientation; // This should be on by default anyway flags |= CSDL::EMainThread; //Create CommandLine Arguments and read it. CDesC8ArrayFlat *arr = new (ELeave) CDesC8ArrayFlat(1); CleanupStack::PushL(arr); CCommandLineArguments* args = CCommandLineArguments::NewLC(); // The real args we are interested in start at the 2nd arg for (TInt i = 1; i < args->Count(); i++) { TBuf8<256> arg; arg.Copy(args->Arg(i)); arr->AppendL(arg); //TPtrC argumentPrt(args->Arg(i)); //console->Printf(_L("Arg %d == %S\n"), i, &argumentPrt); } iSdl = CSDL::NewL(flags); iSdl->SetContainerWindowL(iSDLWin->GetWindow(), iEikonEnv->WsSession(), *iEikonEnv->ScreenDevice()); iSdl->CallMainL(iWait->iStatus, *arr, flags, 0x14000); iWait->Start(); arr->Reset(); CleanupStack::PopAndDestroy(2); // command line and arr }
int main() { CGL *gl = new CGL(SCREEN_WIDTH, SCREEN_HEIGHT); gl->initGL(); int flags= SDL_OPENGL|SDL_RESIZABLE; CSDL *sdl = new CSDL(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP,flags, gl); sdl->setCaption("GLSL-Texturing"); //if(glewInit() != GLEW_OK) exit(EXIT_FAILURE); gl->compileShader(); gl->loadTexture(); gl->setUniform(); while(true) { sdl->handleEvent(gl); gl->renderGL(); } gl->clean(); //cout << "Hello world!" << endl; return 0; }
void CSdlAppUi::HandleResourceChangeL(TInt aType) { CAknAppUi::HandleResourceChangeL(aType); if(aType == KEikDynamicLayoutVariantSwitch) { iSDLWin->SetRect(ApplicationRect()); if (iSdl) { iSdl->SetContainerWindowL( iSDLWin->GetWindow(), iEikonEnv->WsSession(), *iEikonEnv->ScreenDevice()); } } }
TInt CSDLObserver::SdlEvent(TInt aEvent, TInt aParam) { if (aEvent == EEventKeyMapInit) { // starmap zoom iSdl->SetSDLCode('3', SDLK_KP_PLUS); iSdl->SetSDLCode('2', SDLK_KP_MINUS); iSdl->SetSDLCode('A', SDLK_KP_PLUS); iSdl->SetSDLCode('Z', SDLK_KP_MINUS); iSdl->SetSDLCode('a', SDLK_KP_PLUS); iSdl->SetSDLCode('z', SDLK_KP_MINUS); } return 0; }