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

📄 example3dcontainer.cpp

📁 This package includes a 3-D game engine example application and a document describing the most impor
💻 CPP
字号:
    /*
    *
============================================================================
    *  Name     : CExample3DContainer.cpp
    *  Part of  : Example3D
    *  Created  : 12/14/2003 by Forum Nokia
    *  Description:
    *     This is the project specification file for Example3D.
    *     Initial content was generated by Series 60 AppWizard.
    *
    *  Version  : 1.0.0
    *  Copyright: Forum Nokia
    *
============================================================================
    */


// INCLUDES
#include "Example3DContainer.h"
#include "CEngine.h"
#include <eikenv.h>

// MEMBER FUNCTIONS

void CExample3DContainer::ConstructL( const TRect& /*aRect*/ )
    {

    CreateWindowL();

	iEngine = CEngine::NewL( SystemGc(), Window(),
							 CCoeEnv::Static()->ScreenDevice()->SizeInPixels(),
							 CCoeEnv::Static()->ScreenDevice()->DisplayMode()
							 );

	SetExtentToWholeScreen();
    ActivateL();

	ControlEnv()->AddForegroundObserverL( *this );
	iEngine->Start();
    }


CExample3DContainer::~CExample3DContainer()
    {
	ControlEnv()->RemoveForegroundObserver( *this );
	delete iEngine;
    }


void CExample3DContainer::HandleGainingForeground()
	{
	iEngine->Start();
	}

void CExample3DContainer::HandleLosingForeground()
	{
	iEngine->Stop();
	}


TKeyResponse CExample3DContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
	{
	// Game's idle timer doesn't allow focuschange too easily,
	// this is to help it a little
	// So when application change key is pressed, the key event comes here
	// but the OS doesn't have enough time to change the application focus
	// This catches the application key press and leaves the thread for one second
	// In that time OS has all the time it needs to change focus.
	if( aKeyEvent.iScanCode == EStdKeyApplication0 )
		{
		User::After( 1000000 );
		return EKeyWasConsumed;
		}

	// In all other cases just forward the key presses to the game engine.
	iEngine->KeyEvent( aKeyEvent, aType );
	return EKeyWasConsumed;
	}



⌨️ 快捷键说明

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