• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ cInterfaceEventManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cInterfaceEventManager的典型用法代码示例。如果您正苦于以下问题:C++ cInterfaceEventManager类的具体用法?C++ cInterfaceEventManager怎么用?C++ cInterfaceEventManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: process

void cArenaTry::process()
{
	if (!ids_set) set_ids();							// we need to make sure the ID variables are set
	init();
	if (g_InterfaceEvents.GetNumEvents() == 0) return;	// no events means we can go home

	/*
	*	otherwise, compare event IDs
	*
	*	if it's the back button, pop the window off the stack
	*	and we're done
	*/
	if (g_InterfaceEvents.CheckButton(back_id))
	{
		g_InitWin = true;
		g_WinManager.Pop();
		return;
	}
	else if (g_InterfaceEvents.CheckButton(walk_id))
	{
		do_walk();
		if (!g_Cheats) g_TryOuts = true;
		g_InitWin = true;
	}
}
开发者ID:diamondialis,项目名称:crazys-wm-mod,代码行数:25,代码来源:cArenaTry.cpp


示例2: SetSelected

void cListBox::SetSelected(int ID, bool ev, bool deselect_others)
{
	cListItem* current = m_Items;
	m_LastSelected = 0;
	m_HeaderClicked = "";

	if (!current) return;

	// special case if ID "-2" is sent, select first actual list item (not based on ID)
	if (ID == -2)
	{
		current->m_Selected = true;
		m_LastSelected = current;
		m_Position = 0;
		m_ScrollBar->SetTopValue(m_Position);
		if (ev) g_InterfaceEvents.AddEvent(EVENT_SELECTIONCHANGE, m_ID);
		return;
	}

	int count = 0; int posit = 0;
	while (current)
	{
		if (current->m_ID == ID)
		{
			if (ev) g_InterfaceEvents.AddEvent(EVENT_SELECTIONCHANGE, m_ID);
			current->m_Selected = true;
			m_LastSelected = current;
			posit = count;
			if (!deselect_others) break;
		}
		else
		{
			if (deselect_others) current->m_Selected = false;
		}
		count++;
		current = current->m_Next;
	}

	if (count <= m_NumDrawnElements)
	{
		m_Position = 0;
	}
	else
	{
		if (m_Position >= posit)
			m_Position = posit - 1;
		else if (m_Position + m_NumDrawnElements - 1 <= posit)
			m_Position = posit - m_NumDrawnElements + 2;
	}

	if (m_Position > count - m_NumDrawnElements) m_Position = count - m_NumDrawnElements;
	if (m_Position < 0) m_Position = 0;

	m_ScrollBar->SetTopValue(m_Position);
}
开发者ID:Jenocke,项目名称:test,代码行数:55,代码来源:cListBox.cpp


示例3: check_events

void cScreenHouse::check_events()
{
	if (g_InterfaceEvents.GetNumEvents() == 0) return;	// no events means we can go home

	// if it's the back button, pop the window off the stack and we're done
	if (g_InterfaceEvents.CheckButton(back_id))
	{
		g_InitWin = true;
		g_WinManager.Pop();
		return;
	}
}
开发者ID:DagothRa,项目名称:crazys-wm-mod,代码行数:12,代码来源:cScreenHouse.cpp


示例4: Focused

void cInterfaceWindow::Focused()
{
	// clear any events
	g_InterfaceEvents.ClearEvents();
	// clear edit boxes and set the first one as focused
	for (unsigned int i = 0; i < m_EditBoxes.size(); i++)		m_EditBoxes[i]->ClearText();
	if (!m_EditBoxes.empty())	m_EditBoxes[0]->m_HasFocus = true;
}
开发者ID:diamondialis,项目名称:crazys-wm-mod,代码行数:8,代码来源:cInterfaceWindow.cpp


示例5: check_events

void cScreenMayor::check_events()
{
	if (g_InterfaceEvents.GetNumEvents() == 0) return;	// no events means we can go home

	if (g_InterfaceEvents.CheckButton(back_id)) 		// if it's the back button, pop the window off the stack and we're done
	{
		g_InitWin = true;
		g_WinManager.Pop();
		return;
	}
	if (g_InterfaceEvents.CheckButton(bribe_id))
	{
		SetBribe = true;
		g_GetInput.ModeGetInt();
		g_WinManager.push("GetInput");
		g_InitWin = true;
		return;
	}
}
开发者ID:mjsmagalhaes,项目名称:crazys-wm-mod,代码行数:19,代码来源:cScreenMayor.cpp


示例6: ButtonClicked

bool cButton::ButtonClicked(int x, int y)
{
	if (m_Disabled || m_Hidden) return false;
	if (IsOver(x, y))
	{
		g_InterfaceEvents.AddEvent(EVENT_BUTTONCLICKED, m_ID);
		return true;
	}
	return false;
}
开发者ID:DagothRa,项目名称:crazys-wm-mod,代码行数:10,代码来源:cButton.cpp


示例7: OnClicked

void cListBox::OnClicked(int x, int y, bool mouseWheelDown, bool mouseWheelUp)
{
	cListItem* current = 0;
	if (m_NumElements == 0)	// it doesn't matter if there are no items in the list
		return;

	// if user clicked on "un-sort" header, do that
	if (m_ShowHeaders && m_HeaderClicksSort
		&& x > m_XPos + m_eWidth - 16
		&& x <= m_XPos + m_eWidth
		&& y > m_YPos + m_BorderSize
		&& y <= m_YPos + m_BorderSize + LISTBOX_ITEMHEIGHT
		)
	{
		UnSortList();
		return;
	}

	if (IsOver(x, y))
	{
		if (mouseWheelDown)
		{
			ScrollDown();
			return;
		}

		if (mouseWheelUp)
		{
			ScrollUp();
			return;
		}

		if (m_EnableEvents)
			g_InterfaceEvents.AddEvent(EVENT_SELECTIONCHANGE, m_ID);

		// See if a header was clicked
		m_HeaderClicked = "";
		if (m_ShowHeaders && y > m_YPos + m_BorderSize && y <= m_YPos + m_BorderSize + LISTBOX_ITEMHEIGHT)
		{
			int x_start = 0, x_end = 0;
			for (int i = 0; i < m_ColumnCount; i++)
			{
				if (m_SkipColumn[i]) continue;

				x_start = m_ColumnOffset[i] - 3;

				if (i < m_ColumnCount - 1)
					x_end = m_ColumnOffset[i + 1] - 3;
				else
					x_end = m_eWidth;

				if (x >= m_XPos + x_start && x <= m_XPos + x_end)
				{
					// then set it as clicked
					m_HeaderClicked = m_ColumnName[i];

					// should we re-sort list based on header?
					if (m_HeaderClicksSort)
					{
						if (m_SortedColumn == m_ColumnName[i])
							m_SortedDescending = !m_SortedDescending;
						else
						{
							m_SortedColumn = m_ColumnName[i];
							m_SortedDescending = false;
						}
						ReSortList();
					}
					return;
				}
			}
		}

		bool deselect = false;
		if (m_MultiSelect == true)
		{
			if (g_ShiftDown == false && g_CTRLDown == false)
			{
				m_HasMultiSelect = false;
				deselect = true;
			}
			else m_HasMultiSelect = true;
		}
		else deselect = true;

		// first unselect any currently selected items
		if (deselect)
		{
			m_LastSelected = 0;
			current = m_Items;
			while (current)
			{
				current->m_Selected = false;
				current = current->m_Next;
			}
		}

		bool singleSelect = true;
		if (m_MultiSelect == true)
		{
//.........这里部分代码省略.........
开发者ID:Jenocke,项目名称:test,代码行数:101,代码来源:cListBox.cpp


示例8: check_events

void cScreenGangs::check_events()
{
	if (g_InterfaceEvents.GetNumEvents() == 0) return;	// no events means we can go home
	if (g_InterfaceEvents.CheckButton(back_id))			// if it's the back button, pop the window off the stack and we're done
	{
		g_InitWin = true;
		g_WinManager.Pop();
		return;
	}
	if (g_InterfaceEvents.CheckButton(ganghire_id))
	{
		hire_recruitable();
		return;
	}
	if (g_InterfaceEvents.CheckButton(weaponup_id))
	{
		int cost = 0;
		int *wlev = g_Gangs.GetWeaponLevel();
		cost = tariff.goon_weapon_upgrade(*wlev);
		if (g_Gold.item_cost(cost) == true)
		{
			*wlev += 1;
			g_InitWin = true;
		}
		wlev = 0;
		return;
	}

	int buynets = 0;
	if (g_InterfaceEvents.CheckButton(netbuy_id))	buynets = 1;
	if (g_InterfaceEvents.CheckButton(netbuy10_id))	buynets = 10;
	if (g_InterfaceEvents.CheckButton(netbuy20_id))	buynets = 20;
	if (buynets > 0)
	{
		int cost = 0;
		int amount = buynets;
		int *nets = g_Gangs.GetNets();
		if (((*nets) + buynets) > 60) amount = 60 - (*nets);
		cost = tariff.nets_price(amount);
		if (g_Gold.item_cost(cost) == true)
		{
			*nets += amount;
			if (IsCheckboxOn(netautobuy_id)) g_Gangs.KeepNetStocked(*nets);
			g_InitWin = true;
		}
		nets = 0;
		buynets = 0;
		return;
	}

	int buypots = 0;
	if (g_InterfaceEvents.CheckButton(healbuy_id))		buypots = 1;
	if (g_InterfaceEvents.CheckButton(healbuy10_id))	buypots = 10;
	if (g_InterfaceEvents.CheckButton(healbuy20_id))	buypots = 20;
	if (buypots > 0)
	{
		int cost = 0;
		int amount = buypots;
		int *potions = g_Gangs.GetHealingPotions();
		if (((*potions) + buypots) > 200)	amount = 200 - (*potions);
		cost = tariff.healing_price(amount);
		if (g_Gold.item_cost(cost) == true)
		{
			*potions += amount;
			if (IsCheckboxOn(healautobuy_id)) g_Gangs.KeepHealStocked(*potions);
			g_InitWin = true;
		}
		potions = 0;
		buypots = 0;
		return;
	}
	if (g_InterfaceEvents.CheckCheckbox(netautobuy_id))
	{
		int *nets = g_Gangs.GetNets();
		g_Gangs.KeepNetStocked(IsCheckboxOn(netautobuy_id) ? *nets : 0);
	}
	if (g_InterfaceEvents.CheckCheckbox(healautobuy_id))
	{
		int *potions = g_Gangs.GetHealingPotions();
		g_Gangs.KeepHealStocked(IsCheckboxOn(healautobuy_id) ? *potions : 0);
	}
	if (g_InterfaceEvents.CheckButton(gangfire_id))
	{
		selection = GetLastSelectedItemFromList(ganglist_id);
		if (selection != -1)
		{
			g_Gangs.FireGang(selection);
			g_InitWin = true;
		}
		return;
	}
	if (g_InterfaceEvents.CheckListbox(recruitlist_id))
	{
		string ClickedHeader = HeaderClicked(recruitlist_id);
		if (ClickedHeader != "")
		{
			g_LogFile.ss() << "User clicked \"" << ClickedHeader << "\" column header on Recruit listbox" << endl; g_LogFile.ssend();
			return;
		}

//.........这里部分代码省略.........
开发者ID:mjsmagalhaes,项目名称:crazys-wm-mod,代码行数:101,代码来源:cScreenGangs.cpp


示例9: process

void cClinicScreen::process()
{
	/*
	*	we need to make sure the ID variables are set
	*/
	if (!ids_set) set_ids();
	init();

	if (g_InitWin)
	{
		EditTextItem(g_Clinic.GetBrothelString(0), clinicdetails_id);
		g_InitWin = false;
	}
	/*
	*	no events means we can go home
	*/
	if (g_InterfaceEvents.GetNumEvents() == 0) return;

	/*
	*	otherwise, compare event IDs
	*
	*	if it's the back button, pop the window off the stack
	*	and we're done
	*/
	if (g_InterfaceEvents.CheckButton(back_id))
	{
		g_InitWin = true;
		g_WinManager.Pop();
		return;
	}
	else if (g_InterfaceEvents.CheckButton(walk_id))
	{
		g_InitWin = true;
		g_WinManager.push("Clinic Try");
		return;
	}
	else if (g_InterfaceEvents.CheckButton(girls_id))
	{
		g_InitWin = true;
		g_WinManager.push("Clinic");
		return;
	}
	else if (g_InterfaceEvents.CheckButton(staff_id))
	{
		g_InitWin = true;
		g_WinManager.push("Gangs");
		return;
	}
	else if (g_InterfaceEvents.CheckButton(turns_id))
	{
		g_InitWin = true;
		g_WinManager.push("TurnSummary");
		return;
	}
	else if (g_InterfaceEvents.CheckButton(setup_id))
	{
		g_Building = BUILDING_CLINIC;
		g_InitWin = true;
		g_WinManager.push("Building Setup");
		return;
	}
	else if (g_InterfaceEvents.CheckButton(dungeon_id))
	{
		g_InitWin = true;
		g_WinManager.push("Dungeon");
		return;
	}
	else if (g_InterfaceEvents.CheckButton(weeks_id))
	{
		g_InitWin = true;
		if (!g_CTRLDown) { g_CTRLDown = false; AutoSaveGame(); }
		NextWeek();
		g_WinManager.push("TurnSummary");
		return;
	}
}
开发者ID:diamondialis,项目名称:crazys-wm-mod,代码行数:76,代码来源:cClinicScreen.cpp


示例10: process

void cScreenTown::process()
{
	if (!ids_set)set_ids();								// we need to make sure the ID variables are set
	init();
	if (g_InterfaceEvents.GetNumEvents() == 0) return;	// no events means we can go home
	if (girlimage_id != -1 && !eventrunning)	HideImage(girlimage_id, true);

	/*
	*	otherwise, compare event IDs
	*
	*	if it's the back button, pop the window off the stack
	*	and we're done
	*/
	/* */if (g_InterfaceEvents.CheckButton(back_id))		{ g_InitWin = true;		g_WinManager.Pop();					return; }
	else if (g_InterfaceEvents.CheckButton(slavemarket_id)) { g_InitWin = true;		g_WinManager.push("Slave Market");	return; }
	else if (g_InterfaceEvents.CheckButton(prison_id))		{ g_InitWin = true;		g_WinManager.push("Prison");		return; }
	else if (g_InterfaceEvents.CheckButton(house_id))		{ g_Building = BUILDING_HOUSE;	g_CurrHouse = 0;	g_InitWin = true;	g_WinManager.push("Player House");	return; }
	else if (g_InterfaceEvents.CheckButton(clinic_id))		{ check_clinic(0);		g_InitWin = true;			return; }
	else if (g_InterfaceEvents.CheckButton(studio_id))		{ check_studio(0);		g_InitWin = true;			return; }
	else if (g_InterfaceEvents.CheckButton(arena_id))		{ check_arena(0);		g_InitWin = true;			return; }
	else if (g_InterfaceEvents.CheckButton(centre_id))		{ check_centre(0);		g_InitWin = true;			return; }
	else if (g_InterfaceEvents.CheckButton(farm_id))		{ check_farm(0);		g_InitWin = true;			return; }
	else if (g_InterfaceEvents.CheckButton(mayor_id))		{ g_InitWin = true;		g_WinManager.push("Mayor");	return; }
	else if (g_InterfaceEvents.CheckButton(bank_id))		{ g_InitWin = true;		g_WinManager.push("Bank");	return; }
	else if (g_InterfaceEvents.CheckButton(shop_id))		{ g_InitWin = true;		g_AllTogle = false;	g_WinManager.push("Item Management");	return; }
	else if (g_InterfaceEvents.CheckButton(brothel0_id))	{ check_brothel(0);		g_InitWin = true;	return; }
	else if (g_InterfaceEvents.CheckButton(brothel1_id))	{ check_brothel(1);		g_InitWin = true;	return; }
	else if (g_InterfaceEvents.CheckButton(brothel2_id))	{ check_brothel(2);		g_InitWin = true;	return; }
	else if (g_InterfaceEvents.CheckButton(brothel3_id))	{ check_brothel(3);		g_InitWin = true;	return; }
	else if (g_InterfaceEvents.CheckButton(brothel4_id))	{ check_brothel(4);		g_InitWin = true;	return; }
	else if (g_InterfaceEvents.CheckButton(brothel5_id))	{ check_brothel(5);		g_InitWin = true;	return; }
	else if (g_InterfaceEvents.CheckButton(brothel6_id))	{ check_brothel(6);		g_InitWin = true;	return; }
	else if (g_InterfaceEvents.CheckButton(walk_id))		{ do_walk();			if (!g_Cheats) g_WalkAround = true;	g_InitWin = true; }
	else if (g_InterfaceEvents.CheckButton(setup_id))		{ g_InitWin = true;		g_WinManager.push("Property Management");		return; }	// `J` added

}
开发者ID:belroshir,项目名称:crazys-wm-mod,代码行数:36,代码来源:cScreenTown.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cInventory类代码示例发布时间:2022-05-31
下一篇:
C++ cIniFile类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap