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

📄 winmain.cpp

📁 超级玛丽
💻 CPP
字号:
//-------------------------------------------------------------------------------------
//
// This is part of JGE++, a hardware accelerated 2D game engine for PSP/Windows.
// 
// Copyright (C) 2006 James Hui (a.k.a. Dr.Watson)
// 
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 of the License, or (at your option) any
// later version.
// 
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the Free Software Foundation, Inc., 59 Temple
// Place, Suite 330, Boston, MA 02111-1307 USA
// 
// Bugs and comments can be forwarded to jhkhui@yahoo.com.
//
//-------------------------------------------------------------------------------------

//------------------------------------------------------------------------------------------------------
//	HGE game framework
//------------------------------------------------------------------------------------------------------

#include <math.h>

#include "../../JGE/HGE/include/hge.h"

#include "../../JGE/include/JGE.h"
#include "../src/GameApp.h"

//#include "GameCore.h"

//------------------------------------------------------------------------------------------------------
//GameCore *gameCore;
//------------------------------------------------------------------------------------------------------

GameApp *game = NULL;
JGE *engine = NULL;
HGE *hge = NULL;

bool FrameFunc()
{
	JGEControl();
	
	if (game != NULL && engine != NULL)
	{
		game->Update();
		
		hge->Gfx_BeginScene();
		game->Render();
		hge->Gfx_EndScene();

		if (engine->IsDone())
			return true;

	}
	
	return false;
}


int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
	hge = hgeCreate(HGE_VERSION);

	hge->System_SetState(HGE_LOGFILE, "debug.log");
	hge->System_SetState(HGE_FRAMEFUNC, FrameFunc);
	hge->System_SetState(HGE_TITLE, "Mario Demo");
	hge->System_SetState(HGE_WINDOWED, true);
	hge->System_SetState(HGE_SCREENWIDTH, 640);
	hge->System_SetState(HGE_SCREENHEIGHT, 480);
	hge->System_SetState(HGE_SCREENBPP, 32);
	hge->System_SetState(HGE_USESOUND, true);
	hge->System_SetState(HGE_ZBUFFER, false);
	hge->System_SetState(HGE_FPS, 60);
	
	if(hge->System_Initiate()) 
	{
		engine = JGECreate();
		
		game = new GameApp(engine);
		game->Create();

		hge->System_Start();	
		
		game->Destroy();

		delete game;
		game = NULL;
		
		JGERelease();
	}

	hge->System_Shutdown();		// Clean up and shutdown
	hge->Release();
	return 0;
}

⌨️ 快捷键说明

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