/** Inform with a message ,the timer seconds remaining till its up.\n Send event to windows group when timer time is up .\n */ void CTestTimer::RunL() { --iSecondsRemaining; if (iSecondsRemaining>0) { QueueAndInfoPrint(); } else { User::InfoPrint(_L("Time's up")); iCompleted = ETrue; CCoeEnv* env = CCoeEnv::Static(); TWsEvent theEvent; theEvent.SetType(EEventUser + 1); RWsSession ws; TInt theRes = ws.Connect(); if(theRes == KErrNone) { RWindowGroup& winGroup = env->RootWin(); theEvent.SetType(EEventUser + 1); theEvent.SetTimeNow(); TInt theId = winGroup.Identifier(); ws.SendEventToWindowGroup(theId, theEvent); } ws.Close(); } }
// ----------------------------------------------------------------------------- // CGameController::ConstructL // Second phase constructor. // Initializes EGL. // ----------------------------------------------------------------------------- // void CGameController::ConstructL() { CCoeEnv* env = CCoeEnv::Static(); if( !env ) { User::Leave( KErrCoeEnvNotInitialized ); } // Get the Windows Server Session, screen device and window group. iWsSession = env->WsSession(); iWsScreenDevice = env->ScreenDevice(); iWindowGroup = env->RootWin(); if( !iWsScreenDevice ) { User::Leave( KErrCoeEnvNotInitialized ); } // Intializes iWindow to a full screen window. CreateNativeWindowL(); // Choose the buffer size based on the Window's display mode. TDisplayMode displayMode = iWindow->DisplayMode(); TInt bufferSize = 0; switch( displayMode ) { case(EColor4K): bufferSize = 12; break; case(EColor64K): bufferSize = 16; break; case(EColor16M): bufferSize = 24; break; case(EColor16MU): case(EColor16MA): bufferSize = 32; break; default: break; } // Set the desired properties for the EGLSurface const EGLint attributeList[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_BUFFER_SIZE, bufferSize, EGL_NONE }; EGLConfig bestConfig; EGLint numConfigs = 0; // Choose the best EGLConfig that matches the desired properties. if( eglChooseConfig( iEglDisplay, attributeList, &bestConfig, 1, &numConfigs ) == EGL_FALSE ) { User::Leave( KErrConfigFailed ); } if( numConfigs == 0 ) { User::Leave( KErrConfigFailed ); } // Create a window surface where the graphics are blitted. // Pass the Native Window handle to egl. iEglSurface = eglCreateWindowSurface( iEglDisplay, bestConfig, (void*)iWindow, NULL ); if( iEglSurface == NULL ) { User::Leave( KErrCreateWindowSurfaceFailed ); } // Create a rendering context iEglContext = eglCreateContext( iEglDisplay, bestConfig, EGL_NO_CONTEXT, NULL ); if( iEglContext == NULL ) { User::Leave( KErrCreateContextFailed ); } // Make it the current context. if( eglMakeCurrent( iEglDisplay, iEglSurface, iEglSurface, iEglContext ) == EGL_FALSE ) { User::Leave( KErrSetContextFailed ); } // Creates the Active Object that waits for Windows Server events. iWsEventReceiver = CWsEventReceiver::NewL( *this ); }