⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graphicslabappview.h

📁 给初学者
💻 H
字号:
/*
* ============================================================================
*  Name     : CGraphicsLabAppView from CGraphicsLabAppView.h
*  Part of  : GraphicsLab
*  Created  : 10/14/2002 by 
*  Description:
*     Declares view for application.
*  Version  :
*  Copyright: 
* ============================================================================
*/

#ifndef GRAPHICSLABAPPVIEW_H
#define GRAPHICSLABAPPVIEW_H

// INCLUDES
#include <coecntrl.h>
#include <eikenv.h>

   
// FORWARD DECLARATIONS
class CSprite;

// CLASS DECLARATION

/**
*  CGraphicsLabAppView  view class.
*  
*/
class CGraphicsLabAppView : public CCoeControl
    {
    public:
   /*!
  @function NewL
   
  @discussion Create a CGraphicsLabAppView object
  @param aRect the rectangle this view will be drawn to
  @result a pointer to the created instance of CGraphicsLabAppView
  */
        static CGraphicsLabAppView* NewL(const TRect& aRect);

/*!
  @function NewLC
   
  @discussion Create a CGraphicsLabAppView object
  @param aRect the rectangle this view will be drawn to
  @result a pointer to the created instance of CGraphicsLabAppView
  */
        static CGraphicsLabAppView* NewLC(const TRect& aRect);

/*!
  @function ~CGraphicsLabAppView  
  @discussion Destroy the object and release all memory objects
  */
        ~CGraphicsLabAppView();

    public: //new functions

    /*!
      @function StartAnimation  
      @discussion Start the ball moving using an off screen bitmap
      */
        void StartAnimation();

    /*!
      @function StopAnimation  
      @discussion Stop animation
      */
        void StopAnimation() const;

    /*!
      @function ResetCounter  
      @discussion Reset the ball bounce counter
      */

        void ResetCounter() const;

    private: 
    // Functions from base class
    /**
    * From CCoeControl,Draw.
    */
        void Draw(const TRect& aRect) const;

    private:
    /*!
    @function ConstructL  
    @discussion  Perform the second phase construction of a CGraphicsAppView object
    @param aRect the rectangle this view will be drawn to
    */
        void ConstructL(const TRect& aRect);

    /*!
     @function CGraphicsAppView
    @discussion Perform the first phase of two phase construction 
    */
        CGraphicsLabAppView();
        
    private: //new functions

    /*!
      @function DoPeriodTask  
      @discussion Called by period task static function
      */
        void DoPeriodTask();

    /*!
      @function Period  
      @discussion Call back function for a periodic timer
      @param aPtr a parameter passed to the timer when the timer is started
      */
        static TInt Period(TAny* aPtr);

    /*!
      @function UpdateDisplay  
      @discussion Perfom the drawing, does not activate the GC
      */
        void UpdateDisplay() const;

    /*!
      @function SetUpSpritesL  
      @discussion Initialise the objects being drawn
      */
        void SetUpSpritesL();

    /*!
      @function StartTimer  
      @discussion Starts the timer
      */
        void StartTimer();

    public:
        // key event handling
        TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);

    private:
        // data 

        /** background bitmap */
        CFbsBitmap* iBackground;
        /** player "ball" image */
        CFbsBitmap* iBallImage;
        /** player "ball" mask */
        CFbsBitmap* iBallMask;
        /** other "ball" image */
        CFbsBitmap* iOtherBallImage;
        /** other "ball" mask */
        CFbsBitmap* iOtherBallMask;
            
        /** off screen bitmap */
        CFbsBitmap* iOffScreenBitmap;
        /** off screen bitmap device */
        CFbsBitmapDevice* iOffScreenBitmapDevice;
        /** off screen bitmap gc */
        CFbsBitGc* iOffScreenBitmapGc;

        /** periodic timer used to control the animation */
        CPeriodic* iPeriodicTimer;

        /** player ball sprite */
        CSprite* iMySprite;

        /** other ball sprites */
        CArrayPtrFlat<CSprite>* iOtherSprites;

        /** screen (pixel) coordinate where text display begins */ 
        TPoint iTextDisplay;

        /** font for writing text to screen */
        CFont* iFont;
       
    };

#endif

// End of File

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -