当前位置: 首页>>代码示例>>C++>>正文


C++ Menu::Init方法代码示例

本文整理汇总了C++中Menu::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ Menu::Init方法的具体用法?C++ Menu::Init怎么用?C++ Menu::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Menu的用法示例。


在下文中一共展示了Menu::Init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Init

	bool Init() {

		Current = Structure::INTRO;

		//Inicializacion de SDL
		if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
			return false;

		//Inicializacion de Display
		if ((Display = SDL_SetVideoMode(1024, 768, 32,
				SDL_HWSURFACE | SDL_DOUBLEBUF)) == NULL)
			return false;

		//Inicializacion de ventanas
		if (!intro->Init())
			return false;
		if (!menu->Init())
			return false;
		if (!help->Init())
			return false;
		if (!ingame->Init())
			return false;
		if (!story->Init())
			return false;

		return true;
	}
开发者ID:nDy,项目名称:EscapeMadness,代码行数:27,代码来源:EscapeMadness.cpp

示例2: initMenu

void SceneCredits::initMenu()
{
	m_menu = new CCredits();

	int buttonCount = 0;
	const float HEIGHT_OFFSET = m_window_height * 0.1f;
	const Vector3 BUTTON_SIZE(m_window_width * 0.25f, m_window_height * 0.08f);

	// Menu creation
	Vector3 startPos = Vector3((m_window_width * 0.15f) - (BUTTON_SIZE.x * 0.5f), (m_window_height * 0.05f));// -(BUTTON_SIZE.y * 0.5f));

	Menu* newMenu = new Menu();
	newMenu->Init(Menu::MENU_CREDITS, NULL);
	// Button creation
	newMenu->AddButton(new UIButton(UIButton::BUTTON_RETURN_TO_MAIN_MENU, m_meshList[MESH_RETURN_TO_MAIN_MENU_OFF], m_meshList[MESH_RETURN_TO_MAIN_MENU_ON], startPos - Vector3(0.f, HEIGHT_OFFSET * buttonCount), BUTTON_SIZE));
	++buttonCount;

	m_menu->AddMenu(newMenu);

	m_menu->AssignCurrent(Menu::MENU_CREDITS, UIButton::BUTTON_RETURN_TO_MAIN_MENU);
}
开发者ID:NothingMuch123,项目名称:Adv-GDev,代码行数:21,代码来源:SceneCredits.cpp

示例3: wWinMain

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow )
{
	g_hInstance = hInstance;	// Store application handle
	g_bWindowed = true;			// Windowed mode or full-screen

	// Init the window
	InitWindow();

	// Use this msg structure to catch window messages
	MSG msg; 
	ZeroMemory(&msg, sizeof(msg));
	//perform the count for frames per second
	_int64 cntsPerSec = 0;
	QueryPerformanceFrequency((LARGE_INTEGER*)&cntsPerSec);//perform function QueryPerformanceFrequency: returns a BOOL value; true if timer exist
	float secsPerCnt = 1.0f / (float)cntsPerSec; //typecast the long int into a float
	//create an int for prev time
	_int64 prevTimeStamp = 0;
	QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp);

	//*************************************************************************
	// Initialize DirectX/Game here (call the Init method of your framwork)
	DXObj.Init(g_hWnd, g_hInstance, g_bWindowed);
	MenuObj.Init(g_hWnd, g_hInstance, g_bWindowed);
	//*************************************************************************

	// Main Windows/Game Loop
	while(msg.message != WM_QUIT)
	{
		if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		//begin current time stamp counter
		_int64 currTimeStamp = 0;
		//receive counter performance
		QueryPerformanceCounter((LARGE_INTEGER*)&currTimeStamp);
		float dt = (currTimeStamp - prevTimeStamp)*secsPerCnt;
		if(MenuObj.GetState() == 0) // Intro movie
		{
				DXObj.Update(dt);
				if(DXObj.GetMovieState() == true)
				{
					MenuObj.SetState(1);
				}
		}
		if(MenuObj.GetState() == 1)
		{
				//menu
				MenuObj.Update();
				MenuObj.Draw();
		}
		if(MenuObj.GetState() == 2)
		{
				//options
			MenuObj.Update();
			MenuObj.Draw();
		}
		if(MenuObj.GetState() == 3)
		{
				//game
			if(!g_bIsEnabled)
			{
				PFObj.Init(g_hWnd, g_hInstance, g_bWindowed);
				g_bIsEnabled = true;
			}
				PFObj.Update(dt);
				PFObj.Draw();
				if(PFObj.GetMenuBool())
				{
					MenuObj.SetState(1);
				}
		}
		if(MenuObj.GetState() == 4)
		{
				//credits
			MenuObj.Update();
			MenuObj.Draw();
		}
		if(MenuObj.GetState() == 5)
		{
				//quit game
				DXObj.Shutdown();
				PostQuitMessage(0);
		}
		//*************************************************************************
		// This is where you call your DirectXFramework/Game render/update calls
		
		//MenuObj.Draw();
		//PSObj.Draw();
		//*************************************************************************
		//Prepare for the next iteration: The current time
		//stamp becomes the previous time stamp for the next iteration
		
		prevTimeStamp = currTimeStamp; 

	}

	//*************************************************************************
	//Shutdown DirectXFramework/Game here
//.........这里部分代码省略.........
开发者ID:ChrisC64,项目名称:cplusplusprojects,代码行数:101,代码来源:WinMain.cpp


注:本文中的Menu::Init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。