/**
*
* @brief Definition of Skiing Classes
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/
#include "ski.h"
#include <e32math.h> //Maths
#include <AknUtils.h> //CompletePathWithAppPath utility method
#include <images.mbg>
#include <eikenv.h>
#include "doublebufferedarea.h"
#include "skiconstants.h"
_LIT (KMultiBitmapFilename,"\\System\\Apps\\Skiing\\images.mbm");
//
//TMapPrimitive
//
/*
* C++ constructor
* @param aPosn the position of the map primitive
* @param aType the type of the map primitive
*/
TMapPrimitive::TMapPrimitive(const TPoint& aPosn, TMapPrimitive::TMapObjectType aType) :
iPosn(aPosn),
iType(aType)
{
}
/*
* Position accessor
* @return the primitive position
*/
const TPoint& TMapPrimitive::Posn() const
{
return iPosn;
}
/*
* Type accessor
* @return the primitive type
*/
TMapPrimitive::TMapObjectType TMapPrimitive::Type() const
{
return iType;
}
/*
* Type mutator
* @param aType the primitive type
*/
void TMapPrimitive::SetType(TMapObjectType aType)
{
iType = aType;
}
//
// MMapPrimitiveToRectConverter
//
/*
* Implementation to spawn a rectangle from a point on the map. The point is at the
* bottom centre of the spawned rectangle
* @param aPosn the position of the bottom centre of the spawned rectangle
* @param aSize the size of the rectangle generated
* @return a rectangle of the required dimensions
*/
TRect MMapPrimitiveToRectConverter::CreateRect(TPoint aPosn, TSize aSize) const
{
TRect rect(aPosn, aSize);
// map position is bottom centre of object
rect.Move(-aSize.iWidth / 2, -aSize.iHeight);
return rect;
}
//
//CSkiMap
//
/**
* Symbian OS 2 phase constructor.
*/
CSkiMap* CSkiMap::NewL()
{
CSkiMap* self = NewLC();
CleanupStack::Pop(self);
return self;
}
/**
* Symbian OS 2 phase constructor. The constructed object is left on the cleanup stack
*/
CSkiMap* CSkiMap::NewLC()
{
CSkiMap* self = new (ELeave) CSkiMap;
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
/**
* Symbian OS 2 phase constructor. The constructed object is left on the cleanup stack
* @param aArray a pre-constructed array of map primitives that this map will hold
*/
CSkiMap* CSkiMap::NewLC(CMapPrimitiveArray* aArray)
{
CSkiMap* self = new (ELeave) CSkiMap(aArray);
CleanupStack::PushL(self);
// self->ConstructL();
return self;
}
/*
* Standard c++ constructor
*/
CSkiMap::CSkiMap()
{
}
/*
* Standard c++ constructor
* @param aArray a pre-constructed array of map primitives that this map will hold
*/
CSkiMap::CSkiMap(CMapPrimitiveArray* aArray) :
iArray(aArray)
{
_LIT(KSkiPanic, "Ski Application Panic");
__ASSERT_ALWAYS(aArray != NULL, User::Panic(KSkiPanic, KErrArgument));
}
/*
* destructor
*/
CSkiMap::~CSkiMap()
{
delete iArray;
}
/*
* Accessor to the map primitives in the map
*/
CMapPrimitiveArray& CSkiMap::PrimitiveArray()
{
return *iArray;
}
/*
* Accessor to the map primitives in the map
*/
const CMapPrimitiveArray& CSkiMap::PrimitiveArray() const
{
return *iArray;
}
/*
* Finds all the objects in the map that are within a particular area.
* @param aArea the area in the map to be queried for map objects
* @param aRectRep a reference to an object that can convert the position of a map primitive into a rectangle
* @return a map containing any map objects in the area specified
*/
CSkiMap* CSkiMap::IntersectsLC(const TRect& aArea, const MMapPrimitiveToRectConverter& aRectRep)
{
CMapPrimitiveArray* array = new (ELeave) CMapPrimitiveArray(KSkiArrayGranularity);
CleanupStack::PushL(array);
const TInt count = iArray->Count();
for (TInt ii = 0; ii < count; ii++)
{
TMapPrimitive primitive = iArray->At(ii);
TRect rect = aRectRep.RectangleL(primitive);
TSize size = rect.Size();
// No object on the map will have a rectangle
// equivalent of zero-size - implementations of
// RectangleL return an empty rectangle if there's
// no stored TRect for that type
if ((size.iWidth > 0 || size.iHeight > 0) && rect.Intersects(aArea))
{
array->AppendL(primitive);
}
}
CSkiMap* retval = NewLC(array);
CleanupStack::Pop(2, array);
CleanupStack::PushL(retval);
return retval;
}
/*
* Finds all the objects in the map of the specified type
* @param aType A bitmask of the types required from the map (defined in TMapPrimitive::TMapObjectType)
* @return an array of the required objects on the cleanup stack, empty if none were found
*/
CMapPrimitiveArray* CSkiMap::TypeLC(TInt aType)
{
CMapPrimitiveArray* array = new (ELeave) CMapPrimitiveArray(KSkiArrayGranularity);
CleanupStack::PushL(array);
const TInt count = iArray->Count();
for (TInt ii = 0; ii < count; ii++)
{
TMapPrimitive primitive = iArray->At(ii);
if ((primitive.Type() & aType) != 0)
{
array->AppendL(primitive);
}
}
return array;
}
/*
* Standard 2nd phase construction
*/
void CSkiMap::ConstructL()
{
iArray = new (ELeave) CMapPrimitiveArray(KSkiArrayGranularity);
}
/*
* Accessor to the map limits
* @return the map extents
*/
TSize CSkiMap::MapLimits() const
{
return iLimits;
}
/*
* Set the size of the map
* @param aSize sets the extents of the map
*/
void CSkiMap::SetMapLimits(TSize aSize)
{
iLimits = aSize;
}
//
//TSkiScreenAttribs::
//
/*
* Accessor to the screen bounds
* @return the screen bounds
*/
const TRect& TSkiScreenAttribs::Rect() const
{
return iRect;
}
/*
* Accessor to the screen bounds
* @return the screen bounds
*/
TRect& TSkiScreenAttribs::Rect()
{
return iRect;
}
/*
* Accessor to the screen offset ie. the position of the top left corner of the
* screen on the game map
* @return the screen offset
*/
TPoint TSkiScreenAttribs::Offset() const
{
return iRect.iTl;
}
/*
* Mutator of the screen offset ie. the position of the top left corner of the
* screen on the game map
* @param the new screen offset
*/
void TSkiScreenAttribs::SetOffset(TPoint aOffset)
{
TPoint moveBy = aOffset - iRect.iTl;
iRect.Move(moveBy);
}
/*
* Standard c+ constructor
* @param aRect The size of the screen
*/
TSkiScreenAttribs::TSkiScreenAttribs(const TRect& aRect) :
iRect(aRect)
{
}
/*
* Standard c+ constructor
*/
TSkiScreenAttribs::TSkiScreenAttribs()
{
}
//
//CSkiSprite::
//
/**
* Symbian OS 2 phase constructor.
* @param aBitmap The bitmap
* @param aMask
* @param aType an integer to identify the sprite
*/
CSkiSprite* CSkiSprite::NewL(CFbsBitmap* aBitmap, CFbsBitmap* aMask, TInt aType)
{
CSkiSprite* self = NewLC(aBitmap, aMask, aType);
CleanupStack::Pop(self);
return self;
}
/**
* Symbian OS 2 phase constructor. The constructed object is left on the cleanup stack
* @param aMask
* @param aType an integer to identify the sprite
*/
CSkiSprite* CSkiSprite::NewLC(CFbsBitmap* aBitmap, CFbsBitmap* aMask, TInt aType)
{
CSkiSprite* self = new (ELeave) CSkiSprite(aBitmap, aMask, aType);
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
/**
* C++ constructor
*/
CSkiSprite::CSkiSprite(CFbsBitmap* aBitmap, CFbsBitmap* aMask, TInt aType) :
iBitmap(aBitmap),
iMask(aMask),
iType(aType)
{
}
/**
* Accessor to sprite type information
* @return an integer equivalent to an enumerated value that identifies the type
*/
TInt CSkiSprite::Type() const
{
return iType;
}
/**
* Destructor
*/
CSkiSprite::~CSkiSprite()
{
delete iBitmap;
delete iMask;
}
/**
* Bitmap accessor
* @return a reference to the bitmap
*/
const CFbsBitmap& CSkiSprite::Bitmap() const
{
return *iBitmap;
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
《Series 60 应用程序开发》 源码 (1625个子文件)
ABLD.BAT 413B
DisplayImageFrame5.bmp 62KB
DisplayTextFrame.bmp 62KB
DisplayImageFrame2.bmp 62KB
DisplayImageFrame6.bmp 62KB
DisplayImageFrame4.bmp 62KB
DisplayImageFrame3.bmp 62KB
DisplayImageFrame1.bmp 62KB
Logo.bmp 50KB
Logo.bmp 50KB
DrawBitmap.bmp 41KB
BitBltBitmap.bmp 41KB
card_mask.bmp 7KB
Golf.bmp 7KB
Hearts.bmp 7KB
snap.bmp 7KB
Poker.bmp 7KB
Rummy.bmp 7KB
aces.bmp 7KB
clock.bmp 7KB
card_mask.bmp 7KB
Golf.bmp 7KB
Hearts.bmp 7KB
snap.bmp 7KB
Poker.bmp 7KB
Rummy.bmp 7KB
aces.bmp 7KB
clock.bmp 7KB
Context.bmp 6KB
snowbump.bmp 5KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon02.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon03.bmp 3KB
context_pane_icon02_mask.bmp 3KB
context_pane_icon_mask.bmp 3KB
context_pane_icon03_mask.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
context_pane_icon.bmp 3KB
tree.bmp 3KB
treemask.bmp 3KB
Title.bmp 3KB
list_icon.bmp 2KB
list_icon.bmp 2KB
list_icon.bmp 2KB
list_icon.bmp 2KB
共 1625 条
- 1
- 2
- 3
- 4
- 5
- 6
- 17
资源评论
- yhp18882015-02-02下载了很久,一直没看,系统就没用了
- 满衣兄2012-08-14少文件,不过代码还可以
- pzfoot2012-06-20代码很多,就是有错误,有的缺少文件
- Lihai8202012-03-29代码很好,但是没有说明相关的文档
ggan23
- 粉丝: 5
- 资源: 22
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功