亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ski.cpp

?? s60源碼
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
const CSkiSprite& CSkier::SpriteL() const
    {
    return iGallery->SpriteL(iAttribs.State());
    }

/**
* Accessor to the sprite that represents the skier's current state
* @return the current skier sprite
*/
CSkiSprite& CSkier::SpriteL()
    {
    return iGallery->SpriteL(iAttribs.State());
    }

/**
* C++ constructor
*/
CSkier::CSkier()
    {
    }

/**
* Standard Symbian OS 2nd phase construction
*/
void CSkier::ConstructL()
    {
    iGallery = CGameGallery::NewL();
    }

/**
* Accessor to the skier's attributes
* @return the skier attributes
*/
TSkierAttribs& CSkier::Attribs()
    {
    return iAttribs;
    }

/**
* Returns a flag to indicate whether or not the skier is currently jumping
* @retval ETrue the skier is jumping
* @retval EFalse the skier is not jumping
*/
TBool CSkier::Jumping() const
    {
    return iJumping;
    }

/**
* Sets a flag that indicates whether or not the skier is currently jumping
* @param the required jump state for the skier
*/
void CSkier::SetJumping(TBool aJump)
    {
    iJumping = aJump;
    }

/**
* Accesses the magnitude of the maximum velocity
* @return the maximum velocity
*/
TReal CSkier::MaxVel() const
    {
    return iMaxVel;
    }

/**
* Sets the magnitude of the maximum velocity
* @param the maximum velocity
*/
void CSkier::SetMaxVel(TReal aVel)
    {
    iMaxVel = aVel;
    }

/**
* Gets the force that the skier jumps with
* @return the jump force
*/
TInt CSkier::DefJumpForce() const
    {
    return iDefJumpForce;
    }

/**
* Sets the force that the skier jumps with
* @param the jump force
*/
void CSkier::SetDefJumpForce(TInt aForce)
    {
    iDefJumpForce = aForce;
    }

/**
* Gets the friction factor that opposes the skier's motion
* @param aCoeff the friction factor
*/
TReal CSkier::CoeffOfRestitution() const
    {
    return iCoeff;
    }

/**
* Set the friction factor opposing the skier's motion
* @param aCoeff the friction factor
*/
void CSkier::SetCoeffOfRestitution(TReal aCoeff)
    {
    iCoeff = aCoeff;
    }

/**
* Determine the skier's current acceleration from its direction
* @return the skier's acceleration
*/
TSkiVector CSkier::GetAccelFromState() const
    {
    switch (iAttribs.State())
        {
        case TSkierAttribs::ESkier0 :
        case TSkierAttribs::ESkier180 :
            return TSkiVector(0.0f, 0.0f);

        case TSkierAttribs::ESkier30 :
            return TSkiVector(-KSkiingMaxXAccel, KSkiingMinYAccel);

        case TSkierAttribs::ESkier60 :
            return TSkiVector(-KSkiingMaxXAccel, KSkiingMaxYAccel);

        case TSkierAttribs::ESkier90 :
            return TSkiVector(0.0f, 1.0f);

        case TSkierAttribs::ESkier120 :
            return TSkiVector(KSkiingMaxXAccel, KSkiingMaxYAccel);

        case TSkierAttribs::ESkier150 :
            return TSkiVector(KSkiingMaxXAccel, KSkiingMinYAccel);

        default:
            break;
        }

    return TSkiVector();
    }

/**
* Make sure that the skier doesn't exceed the maximum velocity
*/
void CSkier::LimitVelocity()
    {
    TSkiVector vel = iAttribs.Vel();

    if (vel.Magnitude() > iMaxVel)
        {
        vel.Normalize();
        vel.iX *= iMaxVel;
        vel.iY *= iMaxVel;
        }

    //vel.iX *= iCoeff;
    //vel.iY *= iCoeff;

    // we don't want the skier to go backwards!
    if (vel.iY < 0.0f)
    	{
        vel.iY = 0.0f;
		}

    iAttribs.SetVel(vel);
    }

/**
* Update the attributes of the skier eg. increase velocity
* by acceleration
*/
void CSkier::Update()
    {
    if (iJumping)
        {
        TInt elev = iAttribs.Elevation();
        TInt netForce = iAttribs.JumpForce() - iAttribs.Gravity();
        iAttribs.SetJumpForce(netForce);
        elev += netForce;

        if (elev < 0)
            {
            // reset
            elev = 0;
            iJumping = EFalse;
            iAttribs.SetJumpForce(iDefJumpForce);
            }

        iAttribs.SetElevation(elev);
        }

    // update velocity by acceleration
    iAttribs.SetAccel(GetAccelFromState());
    TSkiVector vel = iAttribs.Vel() + iAttribs.Accel();

    iAttribs.SetVel(vel);
    DoFriction();
    LimitVelocity();

    iAttribs.SetPosn(iAttribs.Posn() + vel);
    }

/**
* Limit the motion of the skier with friction
*/
void CSkier::DoFriction()
    {
    TSkiVector vel = iAttribs.Vel();
    TSkiVector accel = iAttribs.Accel();
    vel.Normalize();
    accel.Normalize();

    // find proportion of velocity in direction of accel
    TReal dot = vel.DotProduct(accel);

    // find part of velocity not in direction of acceleration
    vel = iAttribs.Vel();
    TSkiVector velProjection(vel.iX * dot, vel.iY * dot);
    TSkiVector diff = vel - velProjection;

    // account for friction force opposing motion of skier not in direction
    // of skies
    diff.iX *= iCoeff;
    diff.iY *= iCoeff;

    vel = velProjection + diff;
    iAttribs.SetVel(vel);
    }

/**
* Returns the skier to the default state
*/
void CSkier::Reset()
    {
    iJumping = EFalse;
    iAttribs.SetElevation(0);
    iAttribs.SetAccel(TSkiVector(0.0f, 0.0f));
    iAttribs.SetVel(TSkiVector(0.0f, 0.0f));
    }

/**
* Get's the skier's bounding rectangle
* @return the bounding rectangle
*/
TRect CSkier::GetRect() const
    {
    // get skier position as a TPoint
    TSkiVector posVect = iAttribs.Posn();
    TPoint skierPosn(static_cast<TInt>(posVect.iX), static_cast<TInt>(posVect.iY));

     // from MMapPrimitiveToRectConverter::CreateRect
    TSize skierSize = iAttribs.SkierSize();
    TRect skierRect(skierPosn, skierSize);
    // map position is bottom centre of object
    skierRect.Move(-skierSize.iWidth / 2, -skierSize.iHeight);

    return skierRect;
    }
//
// TSkiVector::
//

/**
* Default c++ constructor
*/
TSkiVector::TSkiVector():
 iX(0.0f),
 iY(0.0f)
    {
    }

/**
* c++ constructor
* @param aX the x direction of the vector
* @param aY the y direction of the vector
*/
TSkiVector::TSkiVector(TReal aX, TReal aY):
 iX(aX),
 iY(aY)
    {
    }

/**
* operator overload
*/
TSkiVector TSkiVector::operator+(const TSkiVector& aVector) const
    {
    return TSkiVector(iX + aVector.iX, iY + aVector.iY);
    }


/**
* operator overload
*/
TSkiVector TSkiVector::operator-(const TSkiVector& aVector) const
    {
    return TSkiVector(iX - aVector.iX, iY - aVector.iY);
    }

/**
* Find the dot product of this vector and another vector
* @param aVector the vector to dot his vector with
* @return the dot product
*/
TReal TSkiVector::DotProduct(const TSkiVector& aVector) const
    {
    return (iX * aVector.iX) + (iY * aVector.iY);
    }

/**
* Find the magnitude of this vector
* @return the magnitude
*/
TReal TSkiVector::Magnitude() const
    {
    TReal magSqrd = (iX * iX) + (iY * iY);
    TReal mag;
    TInt err = Math::Sqrt(mag, magSqrd);

    return err == KErrNone ? mag : 0.0f;
    }

/**
* Normalize this vector
*/
TInt TSkiVector::Normalize()
    {
    TReal mag = Magnitude();

    if (mag == 0)
    	{
        return KErrDivideByZero;
		}

    iX /= mag;
    iY /= mag;

    return KErrNone;
    }

//
// TScrollDriver::
//

/**
* C++ constructor
* @param aAttribs screen attributes
* @param aMapLimits the size of the play area
* @param aScrollBox the size of an invisible box in the centre of the screen.  The game scrolls when
* the skier moves outside of this box
*/
TScrollDriver::TScrollDriver(TSkiScreenAttribs& aAttribs, TSize aMapLimits, TSize aScrollBox) :
 iAttribs(aAttribs),
 iLimits(aMapLimits),
 iScrollBox(aScrollBox)
    {
    }

/**
* C++ constructor
* @param aAttribs screen attributes
*/
TScrollDriver::TScrollDriver(TSkiScreenAttribs& aAttribs) :
 iAttribs(aAttribs)
    {
    }

/**
* Updates the screen offset with respect to the new position and the scrollbox size
* @param aPosn the new position
*/
void TScrollDriver::Move(TPoint aPosn)
    {
    TRect scrRect = iAttribs.Rect();
    TRect scrBox = GetScrollBox();

    // If the map co-ordinate aPosn is outside of the scroll box, update
    // the screen offset.  The screen offset is the top left hand corner of the
    // screen rectangle.  Changing this causes the scrolling.
    //

    if (!scrBox.Contains(aPosn))
        {
        TPoint oldOffset = iAttribs.Offset();
        TPoint newOffset = oldOffset;

        if (aPosn.iX < scrBox.iTl.iX)
        	{
            newOffset.iX += aPosn.iX - scrBox.iTl.iX;
			}
        else if (aPosn.iX > scrBox.iBr.iX)
        	{
            newOffset.iX += aPosn.iX - scrBox.iBr.iX;
			}

        if (aPosn.iY < scrBox.iTl.iY)
        	{
            newOffset.iY += aPosn.iY - scrBox.iTl.iY;
			}
        else if (aPosn.iY > scrBox.iBr.iY)
        	{
            newOffset.iY += aPosn.iY - scrBox.iBr.iY;
			}

        iAttribs.SetOffset(newOffset);

        if (KeptOffsetInMap(newOffset, oldOffset))
        	{
            iAttribs.SetOffset(newOffset);
			}
        else
            {
            TPoint oldTopRight(scrRect.iBr.iX, scrRect.iTl.iY);
            scrRect = iAttribs.Rect();
            TPoint newTopRight(scrRect.iBr.iX, scrRect.iTl.iY);

            if (KeptOffsetInMap(newTopRight, oldTopRight))
                {
                newTopRight.iX -= scrRect.Size().iWidth;
                iAttribs.SetOffset(newTopRight);
                }
            }
        }
    }

/**
 * Returns the scroll box
 * @return the scroll box
 */
TRect TScrollDriver::GetScrollBox() const
    {
    // The screen rectangle is in terms of map co-ordinates, not screen
    // co-ordinates.  By shrinking and shifting a copy of the screen
    // rectangle, we can create the scrollbox in terms of map co-ordinates

    TRect scrRect = iAttribs.Rect();
    TSize scrRectSize = scrRect.Size();

    TInt xShrink = (scrRectSize.iWidth - iScrollBox.iWidth) / 2;
    TInt yShrink = (scrRectSize.iHeight - iScrollBox.iHeight) / 2;
    scrRect.Shrink(xShrink, yShrink);
    scrRect.Move(iOffset);  // scrRect is now the scroll box

    return scrRect;
    }

/**
* Method to ensure that the offset value (the coordinate of the top left of the screen)
* stays in the map
* @param aOffset the offset
* @param the previous position
* @return a boolean flag to indicate if aOffset has been changed
*/
TBool TScrollDriver::KeptOffsetInMap(TPoint& aOffset, TPoint aPrevious)
    {
    TPoint tempOffset = aOffset;
    TRect map(iLimits);
    TBool retVal = !map.Contains(aOffset);

    if (retVal)
        {
        // could be just the x or y coordinate responsible for
        // entering here, so need to try both combinations of
        // possible offset value
        tempOffset.iX = aPrevious.iX;

        if (!map.Contains(tempOffset))
            {
            tempOffset = aOffset;
            tempOffset.iY = aPrevious.iY;

            if (!map.Contains(tempOffset))
                tempOffset = aPrevious;
            }
        }

    aOffset = tempOffset;
    return retVal;
    }

/**
* Gets the size of the map limits
* @return the size of the map
*/
TSize TScrollDriver::Limits() const
    {
    return iLimits;
    }

/**
* Sets the size of the map limits
* @param the new size of the map
*/
void TScrollDriver::SetLimits(TSize aSize)
    {
    iLimits = aSize;
    }

/**
* Gets the size of the scroll box
* @return the size of the scroll box
*/
TSize TScrollDriver::ScrollBox() const
    {
    return iScrollBox;
    }

/**
* Sets the size of the scroll box
* @param the size of the scroll box
*/
void TScrollDriver::SetScrollBox(TSize aSize)
    {
    iScrollBox = aSize;
    }

/**

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99re视频这里只有精品| 国产亚洲一区二区在线观看| 久久综合色婷婷| 亚洲精品国产一区二区精华液 | 日韩欧美一区在线观看| 国产亚洲成aⅴ人片在线观看| 亚洲综合免费观看高清完整版 | 欧美一区二区女人| 亚洲欧洲国产专区| 国产最新精品免费| 日本精品视频一区二区三区| 日本一区二区三区在线不卡| 日本aⅴ亚洲精品中文乱码| 91九色最新地址| 中文字幕av一区二区三区高 | 五月激情综合色| 91亚洲精品乱码久久久久久蜜桃| www国产精品av| 日韩影视精彩在线| 欧美日韩精品一区二区三区四区| 亚洲欧美日本韩国| 91在线视频播放地址| 国产精品少妇自拍| 日本欧美一区二区| 欧美一区二区美女| 日韩和欧美一区二区| 欧美三级欧美一级| 亚洲电影你懂得| 日本韩国欧美一区| 一区二区三区免费网站| 91福利在线看| 亚洲第一精品在线| 欧美美女直播网站| 日韩精品欧美精品| 337p亚洲精品色噜噜噜| 日韩不卡在线观看日韩不卡视频| 欧美三级视频在线播放| 日韩av电影免费观看高清完整版 | 午夜精品福利在线| 欧美人xxxx| 免费在线欧美视频| 日韩一级成人av| 极品少妇xxxx精品少妇偷拍| 欧美精品一区在线观看| 国产盗摄一区二区三区| 日本一区二区三区四区在线视频| 成人app在线| 亚洲专区一二三| 欧美性猛交一区二区三区精品| 亚洲成人av电影在线| 91精品黄色片免费大全| 久久狠狠亚洲综合| 国产午夜亚洲精品羞羞网站| 91欧美激情一区二区三区成人| 一区二区三区日本| 精品美女在线播放| 不卡的电影网站| 亚洲成人资源网| 久久日韩粉嫩一区二区三区| 99riav一区二区三区| 日韩国产欧美三级| 久久久av毛片精品| 在线一区二区三区| 精品一区二区三区在线播放| 亚洲国产精品v| 91麻豆精品国产自产在线观看一区 | 欧美午夜精品免费| 久久成人久久爱| 自拍偷拍亚洲欧美日韩| 日韩一区二区在线看| 国产99久久久久久免费看农村| 一区二区三区在线不卡| 日韩精品资源二区在线| 99精品视频在线免费观看| 久久99精品国产.久久久久| 国产精品高潮呻吟| 日韩一区二区在线免费观看| 91小视频在线免费看| 精品综合久久久久久8888| 亚洲视频 欧洲视频| 日韩欧美高清在线| 欧洲精品中文字幕| 国产馆精品极品| 天天综合色天天综合| 国产精品精品国产色婷婷| 日韩一区二区不卡| 91色|porny| 国产麻豆9l精品三级站| 天天免费综合色| 亚洲卡通动漫在线| 国产视频一区二区在线| 欧美一区二区视频网站| 色吊一区二区三区| 成人在线视频一区二区| 九九精品一区二区| 日韩国产在线观看一区| 亚洲天堂a在线| 国产精品欧美一区二区三区| 精品国产123| 337p亚洲精品色噜噜噜| 欧美裸体一区二区三区| 色婷婷国产精品综合在线观看| 国产盗摄视频一区二区三区| 久久精品噜噜噜成人88aⅴ| 亚洲国产另类精品专区| 亚洲精品日韩一| 中文在线一区二区| 中文字幕不卡的av| 国产精品久久久久久亚洲伦| 欧美国产欧美综合| 国产日韩精品一区二区三区| 国产三级三级三级精品8ⅰ区| 欧美成人精品3d动漫h| 日韩欧美在线不卡| 久久亚洲一区二区三区四区| 精品欧美黑人一区二区三区| 欧美一区二区三区日韩视频| 欧美一级高清片在线观看| 8v天堂国产在线一区二区| 日韩一区二区三区视频| 精品国产乱码久久久久久免费| 制服视频三区第一页精品| 91精品国产入口在线| 91超碰这里只有精品国产| 制服丝袜亚洲播放| 26uuu久久综合| 国产午夜精品一区二区| 国产精品拍天天在线| 亚洲欧美日韩一区| 肉丝袜脚交视频一区二区| 蜜桃视频在线观看一区| 国产精品中文字幕欧美| 成人免费毛片aaaaa**| 北岛玲一区二区三区四区| 色婷婷av一区二区三区大白胸| 91成人在线精品| 欧美精品九九99久久| 欧美成人三级在线| 国产精品午夜在线观看| 一区二区不卡在线播放 | 亚洲美女在线一区| 亚洲高清免费一级二级三级| 日韩和欧美一区二区三区| 韩国在线一区二区| 91污片在线观看| 这里只有精品电影| 国产精品网站一区| 午夜成人免费视频| 国产成人综合精品三级| 色偷偷88欧美精品久久久| 欧美一区二区三级| 亚洲同性同志一二三专区| 日韩电影免费在线| 不卡的av电影| 欧美一区二区视频在线观看| 中文字幕在线免费不卡| 日韩电影在线一区| 99久久精品国产麻豆演员表| 欧美精品99久久久**| 中文字幕精品一区二区精品绿巨人| 亚洲成人激情av| 国产精品一区二区不卡| 欧美女孩性生活视频| 国产日韩三级在线| 蜜臀av性久久久久蜜臀aⅴ四虎| 成人精品视频一区| 欧美一级片免费看| 亚洲男人天堂av| 国产乱色国产精品免费视频| 欧美色涩在线第一页| 国产精品麻豆99久久久久久| 美女视频网站久久| 欧美性高清videossexo| 中文字幕欧美激情| 另类小说欧美激情| 欧美羞羞免费网站| 国产精品视频一区二区三区不卡| 麻豆高清免费国产一区| 91福利视频在线| 最新久久zyz资源站| 国产黄色成人av| 精品国产伦理网| 五月婷婷欧美视频| 欧美在线观看视频一区二区三区| 国产女主播一区| 国产精品一区专区| 欧美va亚洲va在线观看蝴蝶网| 亚洲制服丝袜在线| 91福利国产成人精品照片| 亚洲免费电影在线| 99v久久综合狠狠综合久久| 国产精品嫩草久久久久| 国产一区啦啦啦在线观看| 精品久久久久久无| 精品一区二区三区影院在线午夜| 777a∨成人精品桃花网| 美女一区二区在线观看| 欧美一区午夜精品| 美女在线一区二区| 精品播放一区二区|