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

📄 gameapp.cpp

📁 psp的jge开发初始文件,具体有中文的说明文档在其中
💻 CPP
字号:
//-------------------------------------------------------------------------------------
//
// JGE++ is a hardware accelerated 2D game SDK for PSP/Windows.
//
// Licensed under the BSD license, see LICENSE in JGE root for details.
// 
// Copyright (c) 2007 James Hui (a.k.a. Dr.Watson) <jhkhui@gmail.com>
// 
//-------------------------------------------------------------------------------------

#include <stdio.h>

#include <JGE.h>
#include <JRenderer.h>
#include <JLBFont.h>

#include "GameApp.h"


//-------------------------------------------------------------------------------------
// Constructor. Variables can be initialized here.
// 构造器.变量可以在这里被初始化
//-------------------------------------------------------------------------------------
GameApp::GameApp()
{

}


//-------------------------------------------------------------------------------------
// Destructor.
// 析构函数
//-------------------------------------------------------------------------------------
GameApp::~GameApp()
{

}


//-------------------------------------------------------------------------------------
// This is the init callback function. You should load and create your in-game 
// resources here.
// 这个是初始化函数的回调函数.你应在在这里加载并创建游戏中的资源
//-------------------------------------------------------------------------------------
void GameApp::Create()
{
	
}


//-------------------------------------------------------------------------------------
// This is the clean up callback function. You should delete all your in-game 
// resources, for example texture and quads, here.
// 这是清理函数的回调函数.你应该在这里删除你游戏的所有资源 
//-------------------------------------------------------------------------------------
void GameApp::Destroy()
{

}


//-------------------------------------------------------------------------------------
// This is the update callback function and is called at each update frame
// before rendering. You should update the game logic here.
// 这是更新的回调函数.在描绘之前 你应该调用每个更新函数
//-------------------------------------------------------------------------------------
void GameApp::Update()
{

	JGE* engine = JGE::GetInstance();

	// do a screen shot when the TRIANGLE button is pressed
	// 当按下△的时候 截图
	if (engine->GetButtonClick(PSP_CTRL_TRIANGLE))		
	{
		char s[80];

		// save screen shot to root of Memory Stick 
		// 将截图保存到记忆棒
		sprintf(s, "ms0:/screenshot.png");				
		JRenderer::GetInstance()->ScreenShot(s);
	}

	// exit when the CROSS button is pressed
	// 当按下○的时候退出
	if (engine->GetButtonClick(PSP_CTRL_CROSS))	
	{
		engine->End();
		return;
	}

	float dt = engine->GetDelta();		// Get time elapsed since last update.

	//===================================================================
	// Your updating code here...
	// 在这里键入你的更新代码...
	//===================================================================

}


//-------------------------------------------------------------------------------------
// All rendering operations should be done in Render() only.
// 
//-------------------------------------------------------------------------------------
void GameApp::Render()
{
	// get JRenderer instance
	// 获取 JRenderer实例 
	JRenderer* renderer = JRenderer::GetInstance();		
	// clear screen to black
	//将屏幕清屏为黑色
	renderer->ClearScreen(ARGB(0,0,0,0));








	//===================================================================
	// Your rendering code here...
	//所有的主要代码应该放在这里
	//==================================================================

}


//-------------------------------------------------------------------------------------
// This function is called when the system wants to pause the game. You can set a flag
// here to stop the update loop and audio playback.
// 当系统想要暂停游戏的时候会调用这个函数.你可以在这里设置一个标志来暂停更新循环和声音的回放
//-------------------------------------------------------------------------------------
void GameApp::Pause()
{
	
}


//-------------------------------------------------------------------------------------
// This function is called when the game returns from the pause state.
// 这个函数会在系统从暂停中恢复过来的时候被调用
//-------------------------------------------------------------------------------------
void GameApp::Resume()
{
	
}

⌨️ 快捷键说明

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