📄 gamesection.cpp
字号:
// ***************************************************************
// GameSection version: 1.0
// -------------------------------------------------------------
// File Name: GameSection.cpp
// Created: 2007/07/18
// Modified: 2007/07/18 17:20
// Author: William.Liang
// Msn: lwq49@msn.com
// Email: lwq49@21cn.com, lwq49@msn.com
// Description:
//
// Purpose:
// -------------------------------------------------------------
// license:
//
// The contents of this file are subject to the Mozilla Public
// License Version 1.1 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy
// of the License at http://www.mozilla.org/MPL/ Software dis-
// tributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or im-
// plied. See the License for the specific language governing
// rights and limitations under the License.
//
// The Initial Developer of the Original Code is William.Liang .
// Copyright (C) 2007 - All Rights Reserved.
// ***************************************************************
#include "StdAfx.h"
#include ".\gamesection.h"
//************************************
// <p>Description: 构造函数</p>
// <p>Parameters: </p>
// <p> WORD wSectionID</p>
//
// <p>Returns: </p>
//************************************
CGameSection::CGameSection(WORD wSectionID)
{
m_pGameView = NULL;
m_wSectionID = wSectionID;
m_bIsLoaded = false;
}
//************************************
// <p>Description: 析构函数</p>
//************************************
CGameSection::~CGameSection(void)
{
//删除视图下链相关的物件(场景、层、对象)
SafeDelete(m_pGameView);
}
//************************************
// <p>Description: 设置游戏框架指针</p>
// <p>Parameters: </p>
// <p> LPFRAMEMANAGERHANDLE lpFMH</p>
//
// <p>Returns: void</p>
//************************************
void CGameSection::SetFrameManagerHandles(LPFRAMEMANAGERHANDLE lpFMH){
m_lpFMHandles = lpFMH;
}
//************************************
// <p>Description: 返回环节ID</p>
//
// <p>Returns: WORD</p>
//************************************
WORD CGameSection::GetSectionID(){
return m_wSectionID;
}
//************************************
// <p>Description: 返回视图指针</p>
//
// <p>Returns: CGameView*</p>
//************************************
CGameView* CGameSection::GetGameView(){
return m_pGameView;
}
//************************************
// <p>Description: 设置环节ID</p>
// <p>Parameters: </p>
// <p> WORD wSectionID</p>
//
// <p>Returns: void</p>
//************************************
void CGameSection::SetSectionID(WORD wSectionID){
m_wSectionID = wSectionID;
}
//************************************
// <p>Description: 环节切换是否有效</p>
// <p>Parameters: </p>
// <p> WORD wBeforeSectionID</p>
//
// <p>Returns: bool</p>
//************************************
bool CGameSection::IsValidSwitch(WORD wBeforeSectionID){
return true;
}
//************************************
// <p>Description: 资源标记为已加载</p>
// <p>Parameters: </p>
// <p> bool bFlag</p>
//
// <p>Returns: void</p>
//************************************
void CGameSection::SetLoaded(bool bFlag){
m_bIsLoaded = bFlag;
if(bFlag==true){
OnLoadingFinish();
}
}
//************************************
// <p>Description: 资源是否已加载</p>
//
// <p>Returns: bool</p>
//************************************
bool CGameSection::IsLoaded(){
return m_bIsLoaded;
}
//************************************
// <p>Description: 资源加载事件</p>
//
// <p>Returns: void</p>
//************************************
void CGameSection::OnLoading(){
//资源已加载完毕则不处理
if(m_bIsLoaded==true) return;
SetLoaded(true);
}
//************************************
// <p>Description: 资源加载完毕</p>
//
// <p>Returns: void</p>
//************************************
void CGameSection::OnLoadingFinish(){
}
//************************************
// <p>Description: 初始化事件</p>
//
// <p>Returns: bool</p>
//************************************
bool CGameSection::OnInitialize(){
m_pGameView = new CGameView();
//创建默认的视图、场景、层
CGameScene* pGameScene = m_pGameView->Create("default");
if(pGameScene){
if(pGameScene->Create("default")){
return true;
}
}
return false;
}
//************************************
// <p>Description: 结束事件</p>
//
// <p>Returns: bool</p>
//************************************
bool CGameSection::OnUnInitialize(){
return true;
}
//************************************
// <p>Description: 环节切换进入前事件</p>
// <p>Parameters: </p>
// <p> WORD wBeforeSection</p>
//
// <p>Returns: bool</p>
//************************************
bool CGameSection::OnSectionIn(WORD wBeforeSection){
return true;
}
//************************************
// <p>Description: 环节切换离开事件</p>
// <p>Parameters: </p>
// <p> WORD wAfterSection</p>
//
// <p>Returns: bool</p>
//************************************
bool CGameSection::OnSectionOut(WORD wAfterSection){
return true;
}
//************************************
// <p>Description: 鼠标移动</p>
// <p>Parameters: </p>
// <p> float x</p>
// <p> float y</p>
// <p> int nType</p>
// <p> int nKey</p>
//
// <p>Returns: bool</p>
//************************************
bool CGameSection::OnMouseMove(float x, float y, UINT nComboKey){
return true;
}
//************************************
// <p>Description: 鼠标点击</p>
// <p>Parameters: </p>
// <p> IGameObject * pGameObject</p>
// <p> float x</p>
// <p> float y</p>
// <p> int nType</p>
// <p> int nKey</p>
//
// <p>Returns: bool</p>
//************************************
bool CGameSection::OnMouseClick(IGameObject* pGameObject, float x, float y, int nType, UINT nMessage, UINT nComboKey){
return true;
}
//************************************
// <p>Description: 鼠标双击</p>
// <p>Parameters: </p>
// <p> IGameObject * pGameObject</p>
// <p> float x</p>
// <p> float y</p>
// <p> int nType</p>
// <p> int nKey</p>
//
// <p>Returns: bool</p>
//************************************
bool CGameSection::OnMouseDBClick(IGameObject* pGameObject, float x, float y, UINT nMessage, UINT nComboKey){
return true;
}
//************************************
// <p>Description: 鼠标点击</p>
// <p>Parameters: </p>
// <p> IGameObject * pGameObject</p>
// <p> float x</p>
// <p> float y</p>
// <p> int nKey</p>
//
// <p>Returns: bool</p>
//************************************
bool CGameSection::OnMouseUp(IGameObject* pGameObject, float x, float y, UINT nMessage, UINT nComboKey){
return true;
}
//************************************
// <p>Description: 鼠标点击</p>
// <p>Parameters: </p>
// <p> IGameObject * pGameObject</p>
// <p> float x</p>
// <p> float y</p>
// <p> int nKey</p>
//
// <p>Returns: bool</p>
//************************************
bool CGameSection::OnMouseDown(IGameObject* pGameObject, float x, float y, UINT nMessage, UINT nComboKey){
return true;
}
//************************************
// <p>Description: 鼠标移入</p>
// <p>Parameters: </p>
// <p> IGameObject * pGameObject</p>
// <p> float x</p>
// <p> float y</p>
// <p> int nType</p>
// <p> int nKey</p>
//
// <p>Returns: bool</p>
//************************************
bool CGameSection::OnMouseIn(IGameObject* pGameObject, float x, float y, int nType, UINT nMessage, UINT nComboKey){
return true;
}
//************************************
// <p>Description: 鼠标移出</p>
// <p>Parameters: </p>
// <p> IGameObject * pGameObject</p>
// <p> float x</p>
// <p> float y</p>
// <p> int nType</p>
// <p> int nKey</p>
//
// <p>Returns: bool</p>
//************************************
bool CGameSection::OnMouseOut(IGameObject* pGameObject, float x, float y, int nType, UINT nMessage, UINT nComboKey){
return true;
}
//************************************
// <p>Description: 鼠标移过</p>
// <p>Parameters: </p>
// <p> IGameObject * pGameObject</p>
// <p> float x</p>
// <p> float y</p>
// <p> int nType</p>
// <p> int nKey</p>
//
// <p>Returns: bool</p>
//************************************
bool CGameSection::OnMouseOver(IGameObject* pGameObject, float x, float y, int nType, UINT nMessage, UINT nComboKey){
return true;
}
//************************************
// <p>Description: 键盘事件</p>
// <p>Parameters: </p>
// <p> TCHAR nType</p>
// <p> UINT nFlag</p>
// <p> char cChar</p>
//
// <p>Returns: bool</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -