egl/sfegltest/src/main.cpp
branchbug235_bringup_0
changeset 208 7df094ed4a3f
parent 193 bbf967b65d9e
child 210 da03feddbab7
equal deleted inserted replaced
207:69cf6858ae99 208:7df094ed4a3f
    18 #include <e32keys.h>
    18 #include <e32keys.h>
    19 #include "eglrendering.h"
    19 #include "eglrendering.h"
    20 
    20 
    21 #define KDefaultScreenNo 0
    21 #define KDefaultScreenNo 0
    22 
    22 
       
    23 // Amount of time for which to run the app
       
    24 static const TInt KAppRunDuration = 5000000;
       
    25 
    23 class CWsRedrawHandler;
    26 class CWsRedrawHandler;
    24 
    27 
    25 class CWsCanvas: public CBase
    28 class CWsCanvas: public CBase
    26 {
    29 {
    27 public:
    30 public:
    73 public:
    76 public:
    74 	static CWsApp* NewL();
    77 	static CWsApp* NewL();
    75 	~CWsApp();
    78 	~CWsApp();
    76 	void Start();
    79 	void Start();
    77 	void Stop();
    80 	void Stop();
       
    81 	
       
    82 private:
       
    83 	static TInt TimerCallBack(TAny* aApp);
    78 
    84 
    79 private:
    85 private:
    80 	CWsApp();
    86 	CWsApp();
    81     void ConstructL();
    87     void ConstructL();
    82     
    88     
       
    89     CPeriodic* iTimer;
    83     CWsCanvas* iAppView;    
    90     CWsCanvas* iAppView;    
    84 	CEGLRendering* iDemo;	
    91 	CEGLRendering* iDemo;	
    85 	TBool iCallWindow;	
    92 	TBool iCallWindow;	
    86 	
    93 	
    87     TPoint iQvgaPos;
    94     TPoint iQvgaPos;
   249  * 		 target the output of the program.  By default, screen 0 is used.
   256  * 		 target the output of the program.  By default, screen 0 is used.
   250  */
   257  */
   251 void CWsApp::ConstructL()
   258 void CWsApp::ConstructL()
   252     {
   259     {
   253 	RDebug::Printf("CWsApp::ConstructL()");
   260 	RDebug::Printf("CWsApp::ConstructL()");
       
   261 	
       
   262 	// Set a timer to stop the application after a short time
       
   263 	iTimer = CPeriodic::NewL(CActive::EPriorityIdle);
       
   264 	iTimer->Start(KAppRunDuration, KAppRunDuration, TCallBack(TimerCallBack,this));
       
   265 	
   254     iPos = iQhd? iQhdPos : iQvgaPos;
   266     iPos = iQhd? iQhdPos : iQvgaPos;
   255 
   267 
   256 	iScrId = KDefaultScreenNo;
   268 	iScrId = KDefaultScreenNo;
   257 	if (User::CommandLineLength() > 0)
   269 	if (User::CommandLineLength() > 0)
   258 		{
   270 		{
   282 #endif
   294 #endif
   283 
   295 
   284 	iCallWindow = EFalse;
   296 	iCallWindow = EFalse;
   285 	}
   297 	}
   286 
   298 
       
   299 TInt CWsApp::TimerCallBack(TAny* aApp)
       
   300     {
       
   301     reinterpret_cast<CWsApp*>(aApp)->Stop();
       
   302     return KErrNone;
       
   303     }
       
   304 
   287 void CWsApp::Start()
   305 void CWsApp::Start()
   288 	{
   306 	{
   289 	RDebug::Printf("CWsApp::Start");
   307 	RDebug::Printf("CWsApp::Start");
   290 	CActiveScheduler::Start();
   308 	CActiveScheduler::Start();
   291 	}
   309 	}
   297 
   315 
   298 CWsApp::~CWsApp()
   316 CWsApp::~CWsApp()
   299 	{	
   317 	{	
   300 	delete iDemo;
   318 	delete iDemo;
   301 	delete iAppView;
   319 	delete iAppView;
       
   320 	delete iTimer;
   302 	}
   321 	}
   303 
   322 
   304 /**
   323 /**
   305  * Application second level entry point.
   324  * Application second level entry point.
   306  * 
   325  *