📄 s60btlabappview.h
字号:
/*
* ============================================================================
* Name : CS60BTLabAppView from CS60BTLabAppView.h
* Part of : S60BTLab
* Created : 10/14/2002 by
* Description:
* Declares view for application.
* Version :
* Copyright:
* ============================================================================
*/
#ifndef S60BTLABAPPVIEW_H
#define S60BTLABAPPVIEW_H
// INCLUDES
#include <coecntrl.h>
#include <eikenv.h>
#include <e32std.h>
#include <f32file.h>
#include "Log.h"
#include "BTHostNotify.h"
#include "BTClientNotify.h"
// FORWARD DECLARATIONS
class CSprite;
class CBTConnectionHost;
class CBTConnectionClient;
class CAknWaitDialog;
// CLASS DECLARATION
/**
* CS60BTLabAppView view class.
*
*/
class CS60BTLabAppView : public CCoeControl,
public MLog,
public MBTHostNotify,
public MBTClientNotify
{
public:
/*!
@function NewL
@discussion Create a CS60BTLabAppView object
@param aRect the rectangle this view will be drawn to
@result a pointer to the created instance of CS60BTLabAppView
*/
static CS60BTLabAppView* NewL(const TRect& aRect);
/*!
@function NewLC
@discussion Create a CS60BTLabAppView object
@param aRect the rectangle this view will be drawn to
@result a pointer to the created instance of CS60BTLabAppView
*/
static CS60BTLabAppView* NewLC(const TRect& aRect);
/*!
@function ~CS60BTLabAppView
@discussion Destroy the object and release all memory objects
*/
~CS60BTLabAppView();
public: //new functions
/*!
@function StartHost
@discussion Starts game as a host
*/
void StartHostL();
/*!
@function StartClient
@discussion Starts game as a client
*/
void StartClientL();
/*!
@function EndGame
@discussion Ends the 2 player game and
*/
void EndGameL();
/*!
@function SendPositionsToClientL
@discussion Sends sprite positions to the client and
waits for user input data from the client
*/
void SendPositionsToClientL();
public: // MLog overrides
/*!
@function LogL
@discussion Add an entry to the log. Not Yet Implemented!
@param aText the text of the entry
*/
void LogL(const TDesC8& aText);
/*!
@function LogL
@discussion Add an entry to the log. Not Yet Implemented!
@param aText the text of the entry
@param aExtraText extra text to append onto the entry
*/
void LogL(const TDesC8& aText, const TDesC8& aExtraText);
/*!
@function LogL
@discussion Add an entry to the log. Not Yet Implemented!
@param aText the text of the entry
@param aNumber a number to append onto the entry
*/
void LogL(const TDesC8& aText, TInt aNumber);
public: // MBTHostNotify overrides
/*!
@function ClientConnected
@discussion called on the host device when a client connects to the host
@param aError the status code of the connection
*/
void ClientConnected(TInt aError);
/*!
@function ClientDataRead
@discussion called on host device when data is read from the client.
@param aData the data received
*/
void ClientDataRead(const TDesC8& aData);
/*!
@function ClientDisconnected
@discussion called on host device when the connection with the client is broken
@param aError the status code of the disconnection
*/
void ClientDisconnected(TInt aError);
public: // MBTClientNotify overrides
/*!
@function HostConnected
@discussion called on the client device when the client connects to the host
@param aError the status code of the connection
*/
void HostConnected(TInt aError);
/*!
@function HostDataRead
@discussion called on client device when data is read from the host.
@param aData the data received
*/
void HostDataRead(const TDesC8& aData);
/*!
@function HostDisconnected
@discussion called on client device when the connection with the host is broken
@param aError the status code of the disconnection
*/
void HostDisconnected(TInt aError);
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
*/
CS60BTLabAppView();
private: //new functions
/*!
@function UpdateScreen
@discussion Called by period task static function
*/
void UpdateScreen();
/*!
@function SetSpritePositions
@discussion sets the postions of the sprites based on the data read from the host
@param aData - the data read from the host
*/
void SetSpritePositions(const TDesC8& aData);
/*!
@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();
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;
/** player ball sprite */
CSprite* iMySprite;
// Other player's ball
CSprite* iOtherSprite;
/** screen (pixel) coordinate where text display begins */
TPoint iTextDisplay;
/** font for writing text to screen */
CFont* iFont;
// Bluetooth connectivity stuff
CBTConnectionHost* iServer;
CBTConnectionClient* iClient;
CAknWaitDialog* iWaitNote;
enum TKeyPress {ENoKey, ELeftArrow, ERightArrow, EUpArrow, EDownArrow};
TKeyPress iKeyPressed;
RFile iDebugLogFile;
RFs iDebugLogFs;
};
#endif
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -