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


C++ CInput::Initialize方法代码示例

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


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

示例1: WinMain

int WINAPI WinMain  ( HINSTANCE hInstance,  HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow )
{
	CoInitialize(NULL);

	Mycapp.Initilize(hInstance,TEXT("MY"),WndProc);
	hwnd = Mycapp.GetHWND();
	ghInstance = hInstance;

	w.Initialize(Mycapp);

	CInput cinput;
	cinput.Initialize(hInstance,Mycapp.GetHWND());
	pcinput = &cinput;
	RECT _rect ={0,0,640,480};

	PlaySound(TEXT("melody of life.wav"),hInstance,SND_LOOP|SND_FILENAME|SND_ASYNC );

	LeadReader r;
	Attribute attr = r.GetAttr();
	CLead  lead(&w,attr);
	lead.Initialize();

	CWeaponReader cwR;
	CSceneReader cr;
	vector<WeaponInfo> vecWeapon = cwR.GetWeapons();
	CWeapons Weapon(&w);
	Weapon.SetVec(vecWeapon);
	psmanger.SetWeapon(&Weapon);
	psmanger.SetDraw(&w);
	psmanger.SetOverImage(TEXT("gameover.bmp"));

	

	

	CSceneInit csi;
	CScene* pscene = csi.InitScene("4096",&lead,&w,pcinput);
	CScene* pscene2 = csi.InitScene("4097",&lead,&w,pcinput);
	CScene* pscene3 = csi.InitScene("4098",&lead,&w,pcinput);
	CScene* pscene4 = csi.InitScene("4099",&lead,&w,pcinput);
	CScene* pscene5 = csi.InitScene("4100",&lead,&w,pcinput);
	CPathReader cpr;
	psmanger.SetPaths(cpr.GetPaths());

	psmanger.RegisterScene(pscene);
	psmanger.RegisterScene(pscene2);
	psmanger.RegisterScene(pscene3);
	psmanger.RegisterScene(pscene4);
	psmanger.RegisterScene(pscene5);
	CSceneReader sr;
	SceneDesc scenedesc = sr.GetDesc("4097");
	scenedesc.lpImage = NULL;
	scenedesc.pCDraw = &w;
	scenedesc.pcInput = &cinput;	
	scenedesc.lpwFileName = TEXT("4.bmp");
	scenedesc.bIsFightable = true;
	CMyMenu menuRectVictory(TEXT("6.bmp"),pcinput,&w,250,400);
	CMyMenu menuSelect(TEXT("6.bmp"),pcinput,&w,250,200);
	menuSelect.Initialize();
	menuSelect.AddItem(TEXT("Attack!"));
	menuSelect.AddItem(TEXT("使用药水:10个"));
	CMyMenu menuStatus(TEXT("6.bmp"),pcinput,&w,250,200);
	menuStatus.Initialize();
	menuStatus.AddItem(TEXT("主  角 H P:"));
	menuStatus.AddItem(TEXT("主角攻击力:"));
	menuStatus.AddItem(TEXT("主角防御力:"));
	menuRectVictory.Initialize();
	CFightScene csceneFight(scenedesc,&menuRectVictory,&menuSelect,TEXT("bomb.bmp"),&menuStatus);

	CMyMenu menuSelectBuy(TEXT("6.bmp"),pcinput,&w,250,400);
	menuSelectBuy.Initialize();
	cwR.FillItems( vecWeapon,menuSelectBuy);

	CSellScene css(scenedesc,&menuSelectBuy);
	css.Initialize();
	css.SetWeapons(&Weapon);
	css.RegisterLead(&lead);
	
	psmanger.SetSellScene(&css);
	csceneFight.Initialize();
	psmanger.SetFightScene(&csceneFight);
	

#ifndef WINDOW_DEBUG
	psmanger.Draw();

#else
		psmanger.Draw(Mycapp.GetHWND());

#endif
	MSG  msg;	
	msg.message = WM_NULL;
	for(;;)
	{	if(PeekMessage(&msg,NULL,NULL,NULL,PM_REMOVE))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);		
	}
	if(msg.message == WM_QUIT) break;
	else
//.........这里部分代码省略.........
开发者ID:wubaolin2009,项目名称:2DRPG,代码行数:101,代码来源:main.cpp


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