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

📄 gameappui.cpp

📁 这个是symbian下的一个蛮庞大的3D游戏源代码!对于学习3D开发的人有很大的帮助!
💻 CPP
字号:
////////////////////////////////////////////////////////////////////////
//
// GameAppUi.cpp
//
// Copyright (c) 2006 Nokia Corporation.  All rights reserved.
//
////////////////////////////////////////////////////////////////////////

#include <avkon.hrh>
#include <eikmenup.h>
#include <aknsoundsystem.h>
#include <avkon.rsg>

#include "dprintf.h"
#include "GameAppUi.h"
#include "GameAppView.h"
#include "Game.hrh"

#include <tutorialgame.rsg>


////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

CGameAppUi::CGameAppUi()
    {
    }

////////////////////////////////////////////////////////////////////////

// ConstructL is called by the application framework
void CGameAppUi::ConstructL()
    {
	dprintf( "CGameAppUi::ConstructL\n" );
    BaseConstructL();

    //  Create the application view
	iAppView = CGameAppView::NewL(ApplicationRect());    

    AddToStackL(iAppView);
		
	SetKeyBlockMode( ENoKeyBlock );
		
	KeySounds()->PushContextL(R_AVKON_SILENT_SKEY_LIST);
    }

////////////////////////////////////////////////////////////////////////

CGameAppUi::~CGameAppUi()
    {
	dprintf( "~CGameAppUi\n" );
	KeySounds()->PopContext();	

	if (iAppView)
		{
		RemoveFromStack(iAppView);

		delete iAppView;
		iAppView = NULL;
		}
    }

////////////////////////////////////////////////////////////////////////

void CGameAppUi::HandleCommandL(TInt aCommand)
    {
    switch(aCommand)
        {
        case EAknSoftkeyExit:
            Exit();
            break;
		case EGameGameStart:
			static_cast<CGameAppView*>(iAppView)->StartGameL();
			break;
		case EGameGameStop:
			static_cast<CGameAppView*>(iAppView)->StopGame();
			break;
        default:
            break;
        }
    }

////////////////////////////////////////////////////////////////////////

// The Uikon framework calls this function immediately before the menu pane is activated 
void CGameAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
	{
	if (aResourceId == R_TUTORIALGAME_MENUPANE)
		{
		if (static_cast<CGameAppView*>(iAppView)->IsPlaying())
			{
			aMenuPane->SetItemDimmed(EGameGameStart, ETrue);
			aMenuPane->SetItemDimmed(EGameGameStop, EFalse);
			}
		else
			{
			aMenuPane->SetItemDimmed(EGameGameStart, EFalse);
			aMenuPane->SetItemDimmed(EGameGameStop, ETrue);
			}
		}
	}

////////////////////////////////////////////////////////////////////////

void CGameAppUi::HandleForegroundEventL(TBool aForeground)
{
	if (!aForeground)
	{
		iAppView->StopGame();
	}
	else
	{
		iAppView->StartGameL();
	}
}

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

// End of File

⌨️ 快捷键说明

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