コード例 #1
0
/**
   Auxiliary function for all Test Cases
  
   This method creates the user interface control on which tests are carried
   out.
   
 */
void CSimpleParentControl::ConstructL(CCoeControl& aContainer)
    {
    CreateWindowL();
    SetExtentToWholeScreen();
    SetContainerWindowL(aContainer);
    ActivateL();
	}
コード例 #2
0
// -----------------------------------------------------------------------------
// CWazeCameraView::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CWazeCameraView::ConstructL( const TRect& aRect )
{
	// Create a window for this application view
	CreateWindowL();

#ifdef TOUCH_SCREEN
    EnableDragEvents();

//    iTouchFeedBack = MTouchFeedback::Instance();
//    iTouchFeedBack->SetFeedbackEnabledForThisApp(ETrue);
#endif

	// Set the windows size
	SetRect( aRect );
   
	// Fullscreen mode
	SetExtentToWholeScreen();

	// Activate the window, which makes it ready to be drawn	
	ActivateL();

	// Register to capture the camera keys
	CaptureCameraKeys();
	
	iCameraEngine = CWazeCameraEngine::NewL( this );
		
	CreateCacheScreenBufferL();
}
コード例 #3
0
void CSpaceInvadersAppView::ConstructL( const TRect& aRect,
                                        CSpaceInvadersAppUi* aAppUi,
                                        CShipEngine* aShip,
                                        THighscoreHolder* aHolder)
{
    // Create a window for this application view
    CreateWindowL();

    // Set the windows size
    SetRect( aRect );
    // Sets the extent of the screen so it draws on the places of status pane
    // and options pane
    SetExtentToWholeScreen();

    iShip               = aShip;
    iAppUi              = aAppUi;
    iTickCounter        = 0;
    iShotCounter        = 0;
    iMaxHorizontalMoves = Rect().Width() / (6 * ship_width) + 2;
    iHorizontalMoves    = 2;
    iHolder 		    = aHolder;

    // Creates the alien CShipEngine -objects and places them to start positions
    InitAliens();

    TInt error;
    TRAP(error, LoadBitmapsL());
    if ( error )
    {
        iAppUi->Exit();
    }

    // Activate the window, which makes it ready to be drawn
    ActivateL();
}
コード例 #4
0
void TGLControl::HandleResourceChange(TInt aType)
{
	switch( aType )
	{
	case KEikDynamicLayoutVariantSwitch:
		SetExtentToWholeScreen();
		break;
	}
}
コード例 #5
0
void CEmTubeSplashViewContainer::HandleResourceChange(TInt aType)
	{
	CCoeControl::HandleResourceChange(aType);
	SetRect( iView.ClientRect() );
	iClientRect = iView.ClientRect();
	SetExtentToWholeScreen();
	iAppUi->StopDisplayingPopupToolbar();
	DrawNow();
	}
コード例 #6
0
ファイル: tbrdrcol.CPP プロジェクト: cdaffara/symbiandump-mw1
/**
   Auxiliary function for all Test Cases
  
   This method creates the user interface control on which tests are carried
   out.
   
 */
void CSimpleControl::ConstructL()
    {
	iNeutralColor=iEikonEnv->ControlColor(EColorWindowBackground,*this);
	iColCubeIndex=0;
    CreateWindowL();
    Window().SetShadowDisabled(ETrue);
    SetExtentToWholeScreen();
    ActivateL();
	}
コード例 #7
0
// ---------------------------------------------------------
// CAafCameraContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CAafCameraContainer::ConstructL(const TRect& aRect)
    {
    CreateWindowL();
    SetExtentToWholeScreen();
    SetRect(aRect);
    ActivateL();
    
    iEngine = CAafCameraEngine::NewL(*this, aRect);
    iEngine->InitCameraL();
    }
コード例 #8
0
ファイル: windowmover.cpp プロジェクト: kolayuk/SwipeUnlock
void CWindowMover::ConstructL(MWindowMover* m,QmlApplicationViewer* v,RWsSession* aWs)
    {

    iWinGroup=new (ELeave) RWindowGroup(*aWs);
    iWinGroup->Construct((TUint32)&iWinGroup, EFalse);
    iWinGroup->EnableReceiptOfFocus(EFalse); // Don't capture any key events.
    iWinGroup->SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront+KAddPriority+1);

    CApaWindowGroupName* wn=CApaWindowGroupName::NewL(*aWs);
    wn->SetHidden(ETrue);
    wn->SetSystem(ETrue);
    wn->SetWindowGroupName(*iWinGroup);
    delete wn;

    iCallBack=m;
    viewer=v;
    iDragged=EFalse;
    CreateWindowL(iWinGroup);
    SetPointerCapture(ETrue);
    EnableDragEvents();
    // for transparency
    TRgb backgroundColour = KRgbWhite; // for example
//#ifndef _DEBUG
    if(KErrNone == Window().SetTransparencyAlphaChannel())
        {backgroundColour.SetAlpha(0);}
//#endif
    Window().SetBackgroundColor(backgroundColour);
    //SetSize(TSize(1,1));
    MakeVisible(EFalse);
    SetExtentToWholeScreen();

    settings=new QSettings(KConfigFile,QSettings::IniFormat);

    xAnim=new MyAnimation();
    yAnim=new MyAnimation();
    //QEasingCurve curve=new QEasingCurve(QEasingCurve::OutQuad);
    xAnim->setEasingCurve(QEasingCurve::OutQuad);
    yAnim->setEasingCurve(QEasingCurve::OutQuad);
    xAnim->setDuration(200);
    yAnim->setDuration(200);
    connect(xAnim,SIGNAL(valueChanged(QVariant)),this,SLOT(xAnimChanged(QVariant)));
    connect(yAnim,SIGNAL(valueChanged(QVariant)),this,SLOT(yAnimChanged(QVariant)));
    connect(yAnim,SIGNAL(finished()),this,SLOT(finished()));
    connect(xAnim,SIGNAL(finished()),this,SLOT(finished()));
    iTimer=new QTimer();
    iTimer->setInterval(400);
    iTimer->setSingleShot(false);
    connect(iTimer,SIGNAL(timeout()),this,SLOT(checkLaunchArea()));
    ActivateL();
    int gest=settings->value("settings/gesture").toInt();
    if (gest==0) axisSet=false;
    else if (gest==1) {axisX=1;axisY=0; axisSet=true;}
    else if (gest==2) {axisX=0;axisY=1; axisSet=true;}
    }
コード例 #9
0
void CCustomWrapAppControl::ConstructL()
	{
	CreateWindowL();
    Window().SetShadowDisabled(ETrue);
	CreateEdwinL();
	iStandardCustomWrap = iEdwin->TextLayout()->CustomWrap();
	iFocusControl=iEdwin;
	SetExtentToWholeScreen();
	ActivateL();
	iFocusControl->SetFocus(ETrue);
	}
コード例 #10
0
void CBatmonContainer::ConstructL(void)
{
  CreateWindowL();
  SetExtentToWholeScreen();
  CEikStatusPane* statusP=iEikonEnv->AppUiFactory()->StatusPane();
  if(statusP) statusP->MakeVisible(EFalse);
  DrawNow();
  ActivateL();
  iRefresh=CPeriodic::NewL(CActive::EPriorityStandard);
  InitRefresh();
  CCoeEnv::Static()->AddForegroundObserverL(*this);
}
コード例 #11
0
void CSupSplashScreenView::HandleResourceChange(TInt aType)
{
	CCoeControl::HandleResourceChange(aType);

	if ( aType == KEikDynamicLayoutVariantSwitch )
	{
		SetExtentToWholeScreen();
		//CWsScreenDevice& iScreen = *(iCoeEnv->ScreenDevice());
		//TSize originalRes = iScreen.SizeInPixels();
		//SetRect(TRect(TPoint(0, 0), originalRes));
	}	
}
コード例 #12
0
void CEmTubeSplashViewContainer::ConstructL(const TRect& aRect)
	{
	iAlpha = KAlphaMax;

	iAppUi = STATIC_CAST(CEmTubeAppUi*, CEikonEnv::Static()->EikAppUi());

	CreateWindowL();

	TSize size( KBitmapSize, KBitmapSize );
	CFbsBitmap *bmp = AknIconUtils::CreateIconL( KBitmapFileName, EMbmOpenvideohubLogo_white );
	CleanupStack::PushL( bmp );
	AknIconUtils::SetSize( bmp, size );

    iBitmap = new (ELeave) CFbsBitmap();
    iBitmap->Create( size, EColor16MU );
    CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( iBitmap );
    CleanupStack::PushL( bitmapDevice );
    CFbsBitGc* bitmapGc = CFbsBitGc::NewL();
    CleanupStack::PushL( bitmapGc );
    bitmapGc->Activate( bitmapDevice );
    bitmapGc->DrawBitmap( size, bmp );

	CleanupStack::PopAndDestroy( bitmapGc );
	CleanupStack::PopAndDestroy( bitmapDevice );
	CleanupStack::PopAndDestroy( bmp );

	iTmpBitmap = new (ELeave) CFbsBitmap;
	iTmpBitmap->Create( TSize(KBitmapSize, KBitmapSize), EColor16MU );

	SetRect(aRect);
	iClientRect = aRect;
	ActivateL();

	SetExtentToWholeScreen();
	iAppUi->StopDisplayingPopupToolbar();

	iFadeTimer = CEmTubeTimeOutTimer::NewL( *this );
	iFadeTimer->After( KFadePeriod, ECommandFadeIn );

	iTimer = CEmTubeTimeOutTimer::NewL( *this );
	iTimer->After( KSplashTime, ECommandFinish );

#ifdef __S60_50__
	MTouchFeedback* feedback = MTouchFeedback::Instance();
	if ( feedback )
		{
		feedback->EnableFeedbackForControl( this, ETrue );
		}
#endif
	}
コード例 #13
0
// -----------------------------------------------------------------------------
// CFreeMapAppView::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CFreeMapAppView::ConstructL( const TRect& aRect )
	{
	// Create a window for this application view
	CreateWindowL();

	// Set the windows size
	SetRect( aRect );

	// Fullscreen mode
	SetExtentToWholeScreen();
	
	// Activate the window, which makes it ready to be drawn
	ActivateL();
	
	iOffScreenBitmap = new CWsBitmap(iEikonEnv->WsSession());
	if (!iOffScreenBitmap) return;

	TInt error = iOffScreenBitmap->Create(Rect().Size(), iEikonEnv->ScreenDevice()->DisplayMode());
	if (error != KErrNone)
	{
		delete iOffScreenBitmap;
		iOffScreenBitmap = NULL;
		return;
	}		

	TRAP(error,iOffScreenDevice = CFbsBitmapDevice::NewL(iOffScreenBitmap));
	if (error != KErrNone)
	{
		delete iOffScreenDevice;
		iOffScreenDevice = NULL;
		delete iOffScreenBitmap;
		iOffScreenBitmap = NULL;
		return;
	}

	error = iOffScreenDevice->CreateBitmapContext(iOffScreenGc);
	if (error != KErrNone)
	{
		delete iOffScreenGc;
		iOffScreenGc = NULL;
		delete iOffScreenDevice;
		iOffScreenDevice = NULL;
		delete iOffScreenBitmap;
		iOffScreenBitmap = NULL;
		return;
	}

	roadmap_main_configure(iOffScreenGc, this);
	}
コード例 #14
0
ファイル: cdmasmsui.cpp プロジェクト: huellif/symbian-example
// Set up console control
void CConsoleControl::ConstructL()
	{
    CreateWindowL();
    Window().SetShadowDisabled(ETrue);
    Window().SetBackgroundColor(KRgbGray);
    EnableDragEvents();
    SetExtentToWholeScreen();
	SetBlank();
    iConsole=new(ELeave) CEikConsoleScreen;
	_LIT(KMsgExApp,"MsgExApp");
	iConsole->ConstructL(KMsgExApp,0);
	iConsole->SetHistorySizeL(10,10);
	(iCoeEnv->WsSession()).SetAutoFlush(ETrue);
	iMenuHandler = new (ELeave) CMenuHandler(*iConsole,iBuffer);
	iMenuHandler->ConstructL();
	}
コード例 #15
0
// ---------------------------------------------------------
// CSimpleLightContainer::HandleResourceChange(
//     TInt aType)
// Dynamic screen resize changes by calling the
// SetExtentToWholeScreen() method again.
// ---------------------------------------------------------
//
 void CSimpleLightContainer::HandleResourceChange(TInt aType)
    {
	switch( aType )
    	{
	    case KEikDynamicLayoutVariantSwitch:
	        // Do not go full-screen in touch devices.    
            if (AknLayoutUtils::PenEnabled())
            {
                SetRect(iAppUi->ClientRect());
            }
            else
            {
                SetExtentToWholeScreen();                // Take the whole screen into use
            }
	        break;
	    }
    }
コード例 #16
0
ファイル: SplashContainer.cpp プロジェクト: Tumunu/Mauru
// member functions
void CSplashContainer::ConstructL(const TRect &aRect)
{
  iBitmap = new(ELeave)CFbsBitmap();

  CreateWindowL();

  SetRect(aRect);
  SetExtentToWholeScreen();

  TFileName bitmapFile(KDrawBitmapPath);
  User::LeaveIfError(CompleteWithAppPath(bitmapFile));

  iLogoBitmap = new(ELeave)CFbsBitmap();
  User::LeaveIfError(iLogoBitmap->Load(bitmapFile, EMbmMauruSplash));

  ActivateL();
}
コード例 #17
0
	void ConstructL(TInt aSteps) {


		iWg=RWindowGroup(iEikonEnv->WsSession());
		User::LeaveIfError(iWg.Construct((TUint32)&iWg, EFalse));
		iWg.SetOrdinalPosition(1, ECoeWinPriorityAlwaysAtFront+1);
		iWg.EnableReceiptOfFocus(EFalse);

		CreateWindowL(&iWg);

		iSteps=aSteps;
		iBitmap=new (ELeave) CWsBitmap(iEikonEnv->WsSession());
		TBuf<50> bm=_L("c:\\");
#ifndef __S60V3__
		bm.Append(_L("system\\data\\"));
#else
		bm.Append(_L("resource\\"));
#endif

#ifdef FLICKR
		bm.Append(_L("contextflickr.mbm"));
#else
		bm.Append(_L("context_log.mbm"));
#endif
#ifndef __WINS__
		if (! BaflUtils::FileExists(iEikonEnv->FsSession(), bm) ) bm.Replace(0, 1, _L("e"));
#else
		bm.Replace(0, 1, _L("z"));
#endif
#ifdef FLICKR
		User::LeaveIfError(iBitmap->Load(bm, EMbmContextflickrMeaning));
#else
		User::LeaveIfError(iBitmap->Load(bm, EMbmContext_logMeaning));
#endif

		SetExtentToWholeScreen();
		TInt scale=1;
		if (Rect().Width()>176) scale=2;

		progress_left=28*scale;
		progress_width=120*scale;
		progress_height=6*scale;
		progress_top=165*scale;
	}
コード例 #18
0
void CMusicPlayerContainer::HandleResourceChange(TInt aType)
{
	CCoeControl::HandleResourceChange(aType);
	if(aType == KEikDynamicLayoutVariantSwitch)
	{
		TRect r(iMusicPlayerView->ClientRect());
		if(r==iCurrentTheme->iMySize)
			return; //no point in going further, nothing will change (right?)
		
		LOG(ELogGeneral,1,"CMusicPlayerContainer::HandleResourceChange(): start");
		iMusicPlayerView->iThemeManager->iImgEngine->CancelRequest(iCurrentTheme);
		LOG0("ImgRequest canceled");
		iCurrentTheme->Deactivate();
		LOG0("Deactivation succeeded");
		
		
#ifdef __TOUCH_ENABLED__
		SetExtentToWholeScreen();
#else
		iMusicPlayerView->SetStatusPaneVisibility();
		r=iMusicPlayerView->ClientRect();
		LOG0("Setting new rect: %dx%d",r.Width(),r.Height());
		SetRect(r);
		LOG0("SetRect succeeded");
#endif
		if(iMusicPlayerView->iTrack && iMusicPlayerView->iTrack->iMetadata.iFileDirEntry)
		{
			iCurrentTheme->SetMetadataL(iMusicPlayerView->iTrack->iMetadata,iMusicPlayerView->iPlaybackPosition);
			LOG0("SetMetadata succeeded");
		};
		LOG0("Will activate the new theme");
		iCurrentTheme->ActivateL();
		LOG0("Theme activated successfully");
		DrawDeferred();
		LOG(ELogGeneral,-1,"CMusicPlayerContainer::HandleResourceChange(): end");
	};
}
コード例 #19
0
// ---------------------------------------------------------
// CSimpleLightContainer::ConstructL
// Symbian 2nd phase constructor
// ---------------------------------------------------------
//
void CSimpleLightContainer::ConstructL(const TRect& aRect, CAknAppUi* aAppUi)
    {
    iAppUi = aAppUi;
    CreateWindowL();
    iOpenGlInitialized = EFalse;

   // Do not go to full-screen in touch devices.    
    if (AknLayoutUtils::PenEnabled())
    {
        SetRect(aRect);
    }
    else
    {
        SetExtentToWholeScreen();                // Take the whole screen into use
    }
    ActivateL();

    iFrame = 0;                              // Frame counter

    EGLConfig Config;                        // Describes the format, type and
                                             // size of the color buffers and
                                             // ancillary buffers for EGLSurface

    // Get the display for drawing graphics
    iEglDisplay = eglGetDisplay( EGL_DEFAULT_DISPLAY );
    if ( iEglDisplay == NULL )
        {
        _LIT(KGetDisplayFailed, "eglGetDisplay failed");
        User::Panic( KGetDisplayFailed, 0 );
        }

    // Initialize display
    if ( eglInitialize( iEglDisplay, NULL, NULL ) == EGL_FALSE )
        {
        _LIT(KInitializeFailed, "eglInitialize failed");
        User::Panic( KInitializeFailed, 0 );
        }

    EGLConfig *configList = NULL;            // Pointer for EGLConfigs
    EGLint numOfConfigs = 0;
    EGLint configSize   = 0;

    // Get the number of possible EGLConfigs
    if ( eglGetConfigs( iEglDisplay, configList, configSize, &numOfConfigs )
        == EGL_FALSE )
        {
        _LIT(KGetConfigsFailed, "eglGetConfigs failed");
        User::Panic( KGetConfigsFailed, 0 );
        }

    configSize = numOfConfigs;

    // Allocate memory for the configList
    configList = (EGLConfig*) User::Alloc( sizeof(EGLConfig)*configSize );
    if ( configList == NULL )
        {
        _LIT(KConfigAllocFailed, "config alloc failed");
        User::Panic( KConfigAllocFailed, 0 );
        }

    /* Define properties for the wanted EGLSurface.
       To get the best possible performance, choose
       an EGLConfig with a buffersize matching
       the current window's display mode*/
    TDisplayMode DMode = Window().DisplayMode();
    TInt BufferSize = 0;

    switch ( DMode )
         {
         case(EColor4K):
             BufferSize = 12;
             break;
         case(EColor64K):
             BufferSize = 16;
             break;
         case(EColor16M):
             BufferSize = 24;
             break;
         case(EColor16MU):
         case(EColor16MA):
             BufferSize = 32;
             break;
         default:
             _LIT(KDModeError,       "unsupported displaymode");
             User::Panic( KDModeError, 0 );
             break;
         }

    // Define properties for requesting a full-screen antialiased window surface
    const EGLint attrib_list_fsaa[] =
        {
				EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
        EGL_BUFFER_SIZE,  BufferSize,
        EGL_DEPTH_SIZE,   16,
				EGL_SAMPLE_BUFFERS, 1,
				EGL_SAMPLES,        4,
        EGL_NONE
        };

    // Define properties for requesting a non-antialiased window surface
    const EGLint attrib_list[] =
        {
				EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
        EGL_BUFFER_SIZE,  BufferSize,
        EGL_DEPTH_SIZE,   16,
        EGL_NONE
        };

    // Choose an EGLConfig that best matches to the properties in attrib_list_fsaa
    if ( eglChooseConfig( iEglDisplay, attrib_list_fsaa, configList, configSize, &numOfConfigs ) == EGL_FALSE )
        {
        _LIT( KChooseConfigFailed, "eglChooseConfig failed" );
        User::Panic( KChooseConfigFailed, 0 );
        }

    // Check if no configurations were found
    if ( numOfConfigs == 0 )
        {
        // No configs with antialising were found. Try to get the non-antialiased config
		    if ( eglChooseConfig( iEglDisplay, attrib_list, configList, configSize, &numOfConfigs ) == EGL_FALSE )
			      {
	          _LIT( KChooseConfigFailed, "eglChooseConfig failed" );
	          User::Panic( KChooseConfigFailed, 0 );
			      }

		    if ( numOfConfigs == 0 )
			      {
			      // No configs found without antialiasing
	          _LIT( KNoConfig, "Can't find the requested config." );
	          User::Panic( KNoConfig, 0 );
	          }
	      }

    Config = configList[0];   // Choose the best EGLConfig. EGLConfigs
                              // returned by eglChooseConfig are sorted so
                              // that the best matching EGLConfig is first in
                              // the list.
    User::Free( configList ); // Free configList, not used anymore.

    // Create a window where the graphics are blitted
    iEglSurface = eglCreateWindowSurface( iEglDisplay, Config, &Window(), NULL );
    if ( iEglSurface == NULL )
        {
        _LIT(KCreateWindowSurfaceFailed, "eglCreateWindowSurface failed");
        User::Panic( KCreateWindowSurfaceFailed, 0 );
        }

    // Create a rendering context
    iEglContext = eglCreateContext( iEglDisplay, Config, EGL_NO_CONTEXT, NULL );
    if ( iEglContext == NULL )
        {
        _LIT(KCreateContextFailed, "eglCreateContext failed");
        User::Panic( KCreateContextFailed, 0 );
        }

    /* Make the context current. Binds context to the current rendering thread
       and surface.*/
    if ( eglMakeCurrent( iEglDisplay, iEglSurface, iEglSurface, iEglContext )
        == EGL_FALSE )
        {
        _LIT(KMakeCurrentFailed, "eglMakeCurrent failed");
        User::Panic( KMakeCurrentFailed, 0 );
        }


    TSize size;
    size = this->Size();

    iSimpleLight = CSimpleLight::NewL( size.iWidth, size.iHeight ); // Create an instance of SimpleLight
    iSimpleLight->AppInit();                                       // Initialize OpenGL ES

    iOpenGlInitialized = ETrue;

    iPeriodic = CPeriodic::NewL( CActive::EPriorityIdle );         // Create an active object for
                                                                  // animating the scene
    iPeriodic->Start( 100, 100,
                      TCallBack( CSimpleLightContainer::DrawCallBack, this ) );
    }
コード例 #20
0
void TGLControl::ConstructL(const TRect&)
{
	iOpenGlInitialized = EFalse;
	CreateWindowL();

	SetExtentToWholeScreen();
	ActivateL();

	iFrame = 0;

	EGLConfig Config;
	iEglDisplay = eglGetDisplay( EGL_DEFAULT_DISPLAY );
	if ( iEglDisplay == NULL )
	{
		_LIT(KGetDisplayFailed, "eglGetDisplay failed");
		User::Panic( KGetDisplayFailed, 0 );
	}
	if ( eglInitialize( iEglDisplay, NULL, NULL ) == EGL_FALSE )
	{
		_LIT(KInitializeFailed, "eglInitialize failed");
		User::Panic( KInitializeFailed, 0 );
	}

	EGLConfig *configList = NULL; // Pointer for EGLConfigs
	EGLint numOfConfigs = 0;
	EGLint configSize = 0;

	if ( eglGetConfigs( iEglDisplay, configList, configSize, &numOfConfigs )
			== EGL_FALSE )
	{
		_LIT(KGetConfigsFailed, "eglGetConfigs failed");
		User::Panic( KGetConfigsFailed, 0 );
	}

	configSize = numOfConfigs;

	configList = (EGLConfig*) User::Alloc( sizeof(EGLConfig)*configSize );
	if ( configList == NULL )
	{
		_LIT(KConfigAllocFailed, "config alloc failed");
		User::Panic( KConfigAllocFailed, 0 );
	}

	TDisplayMode DMode = Window().DisplayMode();
	TInt BufferSize = 0;

	switch(DMode)
	{
	case EColor4K:
		BufferSize = 12;
        break;
	case EColor64K:
		BufferSize = 16;
		break;
	case EColor16M:
		BufferSize = 24;
		break;
	case EColor16MU:
		BufferSize = 32;
		break;
	default:
		_LIT(KDModeError, "unsupported displaymode");
		User::Panic( KDModeError, 0 );
		break;
	}

	const EGLint attrib_list[] = {	EGL_BUFFER_SIZE, BufferSize, EGL_NONE };

	if(eglChooseConfig( iEglDisplay, attrib_list, configList, configSize, &numOfConfigs ) == EGL_FALSE )
	{
		_LIT(KChooseConfigFailed, "eglChooseConfig failed");
		User::Panic( KChooseConfigFailed, 0 );
	}

	Config = configList[0];
	User::Free( configList );

	iEglSurface = eglCreateWindowSurface( iEglDisplay, Config, &Window(), NULL );
	if(iEglSurface == NULL)
	{
		_LIT(KCreateWindowSurfaceFailed, "eglCreateWindowSurface failed");
		User::Panic( KCreateWindowSurfaceFailed, 0 );
	}

	iEglContext = eglCreateContext( iEglDisplay, Config, EGL_NO_CONTEXT, NULL );
	if(iEglContext == NULL)
	{
		_LIT(KCreateContextFailed, "eglCreateContext failed");
		User::Panic( KCreateContextFailed, 0 );
	}

	if(eglMakeCurrent( iEglDisplay, iEglSurface, iEglSurface, iEglContext ) == EGL_FALSE )
	{
		_LIT(KMakeCurrentFailed, "eglMakeCurrent failed");
		User::Panic( KMakeCurrentFailed, 0 );
	}

	TSize size;
	size = this->Size();

	scene = new (ELeave) TGLScene(size.iWidth, size.iHeight);
	scene->AppInit();

	iOpenGlInitialized = ETrue;

	iPeriodic = CPeriodic::NewL( CActive::EPriorityIdle );
	iPeriodic->Start( 100, 100, TCallBack( TGLControl::DrawCallBack, this ) );
}
コード例 #21
0
// ---------------------------------------------------------
// CRollerCoasterContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CRollerCoasterContainer::ConstructL(const TRect& /*aRect*/)
{
    iIsGenerating = ETrue;

    CreateWindowL();

    // Make the window fullscreen
    SetExtentToWholeScreen();
    ActivateL();

    EGLConfig Config;

    // Get the display for drawing graphics
    iEglDisplay = eglGetDisplay( EGL_DEFAULT_DISPLAY );
    if( iEglDisplay == NULL )
    {
        _LIT(KGetDisplayFailed, "eglGetDisplay failed");
        User::Panic( KGetDisplayFailed, 0 );
    }

    // Initialize display
    if( eglInitialize( iEglDisplay, NULL, NULL ) == EGL_FALSE )
    {
        _LIT(KInitializeFailed, "eglInitialize failed");
        User::Panic( KInitializeFailed, 0 );
    }

    EGLConfig *configList = NULL;
    EGLint numOfConfigs = 0;
    EGLint configSize = 0;

    // Get the number of possible EGLConfigs
    if( eglGetConfigs(iEglDisplay, configList, configSize, &numOfConfigs) == EGL_FALSE )
    {
        _LIT(KGetConfigsFailed, "eglGetConfigs failed");
        User::Panic( KGetConfigsFailed, 0 );
    }

    configSize = numOfConfigs;

    // Allocate memory for the configList
    configList = (EGLConfig*) User::Alloc( sizeof(EGLConfig)*configSize );
    if( configList == NULL )
    {
        _LIT(KConfigAllocFailed, "config alloc failed");
        User::Panic( KConfigAllocFailed, 0 );
    }

    /* Define properties for the wanted EGLSurface.
       To get the best possible performance, choose
       an EGLConfig with a buffersize matching
       the current window's display mode*/
    TDisplayMode DMode = Window().DisplayMode();
    TInt BufferSize = 0;

    switch( DMode )
    {
         case(EColor4K):
             BufferSize = 12;
             break;
         case(EColor64K):
             BufferSize = 16;
             break;
         case(EColor16M):
             BufferSize = 24;
             break;
         default:
             _LIT(KDModeError, "unsupported displaymode");
             User::Panic( KDModeError, 0 );
             break;
    }

    // Define properties for the wanted EGLSurface
    const EGLint attrib_list[] = {EGL_BUFFER_SIZE, BufferSize, EGL_DEPTH_SIZE, 16, EGL_NONE};

    // Choose an EGLConfig that best matches to the properties in attrib_list
    if( eglChooseConfig(iEglDisplay, attrib_list, configList, configSize, &numOfConfigs) == EGL_FALSE )
    {
        _LIT(KChooseConfigFailed, "eglChooseConfig failed");
        User::Panic( KChooseConfigFailed, 0 );
    }

    Config = configList[0];
    User::Free( configList );

    // Create a window where the graphics are blitted
    iEglSurface = eglCreateWindowSurface( iEglDisplay, Config, &Window(), NULL );
    if( iEglSurface == NULL )
    {
        _LIT(KCreateWindowSurfaceFailed, "eglCreateWindowSurface failed");
        User::Panic( KCreateWindowSurfaceFailed, 0 );
    }

    // Create a rendering context
    iEglContext = eglCreateContext( iEglDisplay, Config, NULL, NULL );
    if( iEglContext == NULL )
    {
        _LIT(KCreateContextFailed, "eglCreateContext failed");
        User::Panic( KCreateContextFailed, 0 );
    }

    // Make the context current. Binds context to the current rendering thread and surface.
    if( eglMakeCurrent(iEglDisplay, iEglSurface, iEglSurface, iEglContext) == EGL_FALSE )
    {
        _LIT(KMakeCurrentFailed, "eglMakeCurrent failed");
        User::Panic( KMakeCurrentFailed, 0 );
    }

    TSize size;
    size = this->Size();

    iRollerCoaster = CRollerCoaster::NewL( size.iWidth, size.iHeight );
    iRollerCoaster->AppInit();

    iIsGenerating = EFalse;

	// Create an active object for animating the scene
    iPeriodic = CPeriodic::NewL( CActive::EPriorityIdle );
    iPeriodic->Start( 100, 100, TCallBack(CRollerCoasterContainer::DrawCallBack, this) );
//for(int i = 0 ; i < 200000000 ; i++) i += CountComponentControls();
}