|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : LensFlareContainer.h 00004 * Part of : OpenGLEx / LensFlare 00005 * Interface : 00006 * Description : 00007 * Version : 00008 * 00009 * Copyright (c) 2004-2006 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. 00013 * ============================================================================== 00014 */ 00015 00016 #ifndef LENSFLARECONTAINER_H 00017 #define LENSFLARECONTAINER_H 00018 00019 // INCLUDES 00020 #include <coecntrl.h> 00021 #include <GLES\egl.h> 00022 #include "lensflare.h" 00023 #include <akndef.h> 00024 00025 00026 // CLASS DECLARATION 00027 00028 /** 00029 * Container control class that handles the OpenGL ES initialization and deinitializations. 00030 * Also uses the CLensFlare class to do the actual OpenGL ES rendering. 00031 */ 00032 class CLensFlareContainer : public CCoeControl, MCoeControlObserver 00033 { 00034 public: // Constructors and destructor 00035 00036 /** 00037 * Symbian default constructor. 00038 * @param aRect Frame rectangle for container. 00039 */ 00040 void ConstructL(const TRect& aRect); 00041 00042 /** 00043 * Destructor. Destroys the CPeriodic, CLensFlare and uninitializes OpenGL ES. 00044 */ 00045 virtual ~CLensFlareContainer(); 00046 00047 public: // New functions 00048 00049 /** 00050 * Callback function for the CPeriodic. Calculates the current frame, keeps the background 00051 * light from turning off and orders the CLensFlare to do the rendering for each frame. 00052 *@param aInstance Pointer to this instance of CLensFlareContainer. 00053 */ 00054 static TInt DrawCallBack( TAny* aInstance ); 00055 00056 private: // Functions from base classes 00057 00058 /** 00059 * Method from CoeControl that gets called when the display size changes. 00060 * If OpenGL has been initialized, notifies the renderer class that the screen 00061 * size has changed. 00062 */ 00063 void SizeChanged(); 00064 00065 00066 /** 00067 * Method from CoeControl. Does nothing in this implementation. 00068 */ 00069 TInt CountComponentControls() const; 00070 00071 /** 00072 * Method from CCoeControl. Does nothing in this implementation. 00073 */ 00074 CCoeControl* ComponentControl(TInt aIndex) const; 00075 00076 /** 00077 * Method from CCoeControl. Does nothing in this implementation. 00078 * All rendering is done in the DrawCallBack() method. 00079 */ 00080 void Draw(const TRect& aRect) const; 00081 00082 /** 00083 * Method from MCoeControlObserver that handles an event from the observed control. 00084 * Does nothing in this implementation. 00085 * @param aControl Control changing its state. 00086 * @param aEventType Type of the control event. 00087 */ 00088 void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); 00089 00090 /** 00091 * Handles a change to the control's resources. This method 00092 * reacts to the KEikDynamicLayoutVariantSwitch event (that notifies of 00093 * screen size change) by calling the SetExtentToWholeScreen() again so that 00094 * this control fills the new screen size. This will then trigger a call to the 00095 * SizeChanged() method. 00096 * @param aType Message UID value, only KEikDynamicLayoutVariantSwitch is handled by this method. 00097 */ 00098 void HandleResourceChange(TInt aType); 00099 00100 private: // Data 00101 00102 /** Display where the OpenGL ES window surface resides. */ 00103 EGLDisplay iEglDisplay; 00104 00105 /** Window surface where the OpenGL ES rendering is blitted to. */ 00106 EGLSurface iEglSurface; 00107 00108 /** OpenGL ES rendering context. */ 00109 EGLContext iEglContext; 00110 00111 /** Frame counter variable, used in the animation. */ 00112 TInt iFrame; 00113 00114 /** Active object that is the timing source for the animation. */ 00115 CPeriodic* iPeriodic; 00116 00117 /** 00118 * Flag that indicates if OpenGL ES has been initialized or not. 00119 * Used to check if SizeChanged() can react to incoming notifications. 00120 */ 00121 TBool iOpenGlInitialized; 00122 00123 public: //data 00124 00125 /** Used in DrawCallBack() method to do the actual OpenGL ES rendering. */ 00126 CLensflare* iLensflare; 00127 }; 00128 00129 #endif 00130 00131 // End of File
|
© Nokia 2006 |