本文整理汇总了C++中UIManager类的典型用法代码示例。如果您正苦于以下问题:C++ UIManager类的具体用法?C++ UIManager怎么用?C++ UIManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UIManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
/**
* @brief Filters message.
* @param[in,out] msg message.
* @return false to skip this message. true to dispatch this message.
*/
bool WinSkinWindow::FilterMessage(MSG* msg)
{
if (msg->hwnd != m_hWnd)
return true;
if (WM_KEYDOWN == msg->message || WM_SYSKEYDOWN == msg->message)
{
// マウスボタン、修飾キーは無視
switch (msg->wParam)
{
case VK_LBUTTON:
case VK_RBUTTON:
case VK_MBUTTON:
case VK_SHIFT:
case VK_CONTROL:
case VK_MENU:
return true;
}
UIManager* uiManager = getUIManager();
ASSERT(NULL != uiManager);
if (NULL != uiManager)
{
KeyEventParameter parameter;
UInt32 modifiers = 0;
modifiers |= ((::GetKeyState(VK_SHIFT) & 0x8000) ? KeyEventParameter::ModifierMask_Shift : 0);
modifiers |= ((::GetKeyState(VK_CONTROL) & 0x8000) ? KeyEventParameter::ModifierMask_Ctrl : 0);
modifiers |= ((::GetKeyState(VK_MENU) & 0x8000) ? KeyEventParameter::ModifierMask_Alt : 0);
parameter.SetKeyCode(static_cast<DWORD>(msg->wParam));
parameter.SetModifiers(modifiers);
return uiManager->KeyDown(parameter);
}
}
return true;
}
示例2: getUIManager
// ---------------------------------------------------------------------
//! Called when user releases a mouse button.
// ---------------------------------------------------------------------
void BeSkinView::MouseUp(
BPoint where //!< location of the cursor
)
{
if (0 == lastPressedMouseButton)
{
return;
}
UIManager* uiManager = getUIManager();
ASSERT(NULL != uiManager);
if (NULL != uiManager)
{
if (1 == lastPressedMouseButton)
{
uiManager->Button1Up();
}
else if (2 == lastPressedMouseButton)
{
uiManager->Button2Up();
}
}
lastPressedMouseButton = 0;
}
示例3: CloseMenu
void MenuManager::CloseMenu(const BSFixedString &menuName)
{
UIManager *ui = UIManager::GetSingleton();
if (ui)
{
ui->AddMessage(menuName, UIMessage::kMessage_Close, nullptr);
}
}
示例4: getUIManager
// ---------------------------------------------------------------------
//! Cancels this task.
// ---------------------------------------------------------------------
void MouseHoverUITask::CancelTask()
{
UIManager* uiManager = getUIManager();
ASSERT(NULL != uiManager);
uiManager->GetUIController()->EndTimer(UIController::TimerID_MouseHover);
uiManager->EndTask(this);
}
示例5: timerCommandToTimerId
/**
* @brief timer command handler.
*/
void BeSkinView::timerCommandReceived(uint32 timerCommand)
{
UIController::TimerID timerId = timerCommandToTimerId(timerCommand);
UIManager* uiManager = getUIManager();
ASSERT(NULL != uiManager);
if (NULL != uiManager)
{
uiManager->TimerEvent(timerId);
}
}
示例6: getUIManager
// ---------------------------------------------------------------------
LRESULT WinSkinWindow::onUMActivated(
HWND /*hWnd*/, //!< ウィンドウハンドル
UINT /*uMsg*/, //!< UM_ACTIVATED
WPARAM /*wParam*/, //!< 利用しないパラメータ
LPARAM /*lParam*/ //!< 利用しないパラメータ
)
{
UIManager* uiManager = getUIManager();
if (NULL != uiManager)
{
uiManager->UIActivated();
}
return 0;
}
示例7: Send
bool Send()
{
UIManager * uiManager = UIManager::GetSingleton();
if (!invokeDelegate_ || hasRun_ || !uiManager)
{
_WARNING("Failed to run PapyrusUICallback.");
return false;
}
// UI manager is now responsible for disposing
uiManager->QueueCommand(invokeDelegate_);
hasRun_ = true;
return true;
}
示例8: Window
// ---------------------------------------------------------------------
//! Called when user presses a mouse button.
// ---------------------------------------------------------------------
void BeSkinView::MouseDown(
BPoint where //!< location of the cursor
)
{
uint32 buttons = 0;
BMessage* message = Window()->CurrentMessage();
if (NULL != message)
{
int32 value = 0;
if (B_OK == message->FindInt32("buttons", &value))
{
buttons = value;
}
}
if (0 == (buttons & (B_PRIMARY_MOUSE_BUTTON | B_SECONDARY_MOUSE_BUTTON)))
{
return;
}
BWindow* window = Window();
if (!window->IsActive())
{
window->Activate();
}
// deactivate tool tip
BMessage deactivateMessage(BeToolTipWindow::MSG_DEACTIVATE);
toolTipMessenger->SendMessage(&deactivateMessage, static_cast<BHandler*>(NULL), 1000000);
UIManager* uiManager = getUIManager();
ASSERT(NULL != uiManager);
if (NULL != uiManager)
{
if (buttons & B_PRIMARY_MOUSE_BUTTON)
{
uiManager->Button1Down();
lastPressedMouseButton = 1;
}
else if (buttons & B_SECONDARY_MOUSE_BUTTON)
{
uiManager->Button2Down();
lastPressedMouseButton = 2;
}
}
}
示例9: parse
void CommandHandler::parse(int argc, char** argv)
{
if (argc == 0)
{
UIManager ui;
ui.setController(_gameController);
ui.start();
return;
}
std::string command(*argv);
if (command == "add") parseAdd(argc, argv);
if (command == "remove" || command == "rm") parseRemove(argc, argv);
if (command == "list" || command == "ls") parseList(argc, argv);
if (command == "lsp") parseListPlatform(argc, argv);
if (command == "lsc") parseListCategory(argc, argv);
if (command == "run") parseRun(argc, argv);
}
示例10: main
int main(int argc, char** argv)
{
QApplication app(argc, argv);
new UIManager;
new DBManager;
DBManager* db = DBManager::instance();
UIManager* ui = UIManager::instance();
//char* fn = "vega.udb";
char* fn = "geometryprocess.udb";
//char* fn = "vega.udb";
//char* fn = "vega.udb";
char* fileName = argc > 1 ? argv[1] : fn;
printf(fileName);
db->openDB(fileName);
ui->lockAll();
db->parse();
ui->unlockAll();
ui->updateScene();
ui->addMainUI();
//ui->addMainUI();
ui->showAllUI();
app.exec();
DBManager::instance()->closeDB();
return 0;
}
示例11: menu_selector
bool EquipmentUpgradeUILayer::init()
{
if(!CCLayer::init())
{
return false;
}
UIManager *manager = UIManager::sharedManager();
m_equipmentLayout = manager->CreateUILayoutFromFile("UIplist/equipmentUpgrade.plist", this, "equipmentUpgradeLayout");
manager->RegisterMenuHandler("equipmentUpgradeLayout","EquipmentUpgradeUILayer::closeEquipUpgradeBt",
menu_selector(EquipmentUpgradeUILayer::closeEquipUpgradeBt), this);
manager->RegisterMenuHandler("equipmentUpgradeLayout","EquipmentUpgradeUILayer::chooseOneEquipmentBt",
menu_selector(EquipmentUpgradeUILayer::chooseOneEquipmentBt), this);
manager->RegisterMenuHandler("equipmentUpgradeLayout","EquipmentUpgradeUILayer::onClickHeroEquip",
menu_selector(EquipmentUpgradeUILayer::onClickHeroEquip), this);
manager->RegisterMenuHandler("equipmentUpgradeLayout","EquipmentUpgradeUILayer::onClickFairyEquip",
menu_selector(EquipmentUpgradeUILayer::onClickFairyEquip), this);
manager->RegisterMenuHandler("equipmentUpgradeLayout","EquipmentUpgradeUILayer::onClickStrength",
menu_selector(EquipmentUpgradeUILayer::onClickStrength), this);
m_equipmentHelmetPic = m_equipmentLayout->FindChildObjectByName<UIPicture>("equipUpgradeHelmetIcon");
m_equipmentNecklacePic = m_equipmentLayout->FindChildObjectByName<UIPicture>("equipUpgradeNicklaceIcon");
m_equipmentWeaponPic = m_equipmentLayout->FindChildObjectByName<UIPicture>("equipUpgradeWeaponIcon");
m_equipmentArmorPic = m_equipmentLayout->FindChildObjectByName<UIPicture>("equipUpgradeArmorIcon");
m_equipmentRingPic = m_equipmentLayout->FindChildObjectByName<UIPicture>("equipUpgradeRingIcon");
m_equipmentShoePic = m_equipmentLayout->FindChildObjectByName<UIPicture>("equipUpgradeShoeIcon");
m_choosedEquipmentPic = m_equipmentLayout->FindChildObjectByName<UIPicture>("equipUpgradechoosedIcon");
m_heroEquipToggle = m_equipmentLayout->FindChildObjectByName<UIButtonToggle>("heroEquipButtonToggle");
m_fairyEquipToggle = m_equipmentLayout->FindChildObjectByName<UIButtonToggle>("fairyEquipButtonToggle");
m_levelUpCostLabel = m_equipmentLayout->FindChildObjectByName<UILabel>("equipUpgradeChoosedCostNumber");
m_levelLabel = m_equipmentLayout->FindChildObjectByName<UILabel>("equipUpgradeChoosedLevel");
m_coldTimeLabel = m_equipmentLayout->FindChildObjectByName<UILabel>("equipUpgradeCDText");
showPlayerEquipment();
if(m_heroEquipToggle)
{
m_heroEquipToggle->selected();
}
schedule(schedule_selector(EquipmentUpgradeUILayer::updateColdTime),1);
m_upTimesBar = (CCSprite*)m_equipmentLayout->FindChildObjectByName<UIPicture>("equipUpgradeBarTime")->getCurrentNode();
if(m_upTimesBar)
{
m_upTimesBar->setAnchorPoint(ccp(0,0.5f));
CCPoint oldPos = m_upTimesBar->getPosition();
float scale = UIManager::sharedManager()->getScaleFactor();
m_upTimesBar->setPosition(ccp(oldPos.x-scale * m_upTimesBar->getContentSize().width/2,oldPos.y));
}
showLvUpRemainTimes();
setDefaultSelectedEquip();
updateBottomCoinLabel();
updateBottomDiamondLabel();
NotificationCenter::defaultCenter()->registerAllMsgObserver(this);
return true;
}
示例12: GET_X_LPARAM
// ---------------------------------------------------------------------
LRESULT WinSkinWindow::onRButtonUp(
HWND hWnd, //!< ウィンドウハンドル
UINT uMsg, //!< WM_RBUTTONUP
WPARAM wParam, //!< 様々な仮想キーが押されているかどうのフラグ
LPARAM lParam //!< 下位ワードがマウスカーソルの X 座標、上位ワードが Y 座標
)
{
base::wndProc(hWnd, uMsg, wParam, lParam);
mousePosition.x = GET_X_LPARAM(lParam);
mousePosition.y = GET_Y_LPARAM(lParam);
mousePositionAvailable = true;
UIManager* uiManager = getUIManager();
ASSERT(NULL != uiManager);
if (NULL != uiManager)
{
uiManager->Button2Up();
}
return 0;
}
示例13: init
bool TaskChatLayer::init()
{
if(!CCLayer::init())
{
return false;
}
UIManager *manager = UIManager::sharedManager();
taskChatLayout = manager->CreateUILayoutFromFile("UIplist/taskChat.plist", this, "TaskChatPanel");
m_taskChatContainer = taskChatLayout->FindChildObjectByName<UIContainer>("taskChatContainer");
manager->RegisterMenuHandler("TaskChatPanel","TaskChatLayer::closeBtnClick",
menu_selector(TaskChatLayer::closeBtnClick), this);
manager->RegisterMenuHandler("TaskChatPanel","TaskChatLayer::OnTaskItemClickEvent_01",
menu_selector(TaskChatLayer::OnTaskItemClickEvent_01), this);
manager->RegisterMenuHandler("TaskChatPanel","TaskChatLayer::OnTaskItemClickEvent_02",
menu_selector(TaskChatLayer::OnTaskItemClickEvent_02), this);
manager->RegisterMenuHandler("TaskChatPanel","TaskChatLayer::OnTaskItemClickEvent_03",
menu_selector(TaskChatLayer::OnTaskItemClickEvent_03), this);
manager->RegisterMenuHandler("TaskChatPanel","TaskChatLayer::OnTaskshopExchangeBtnClick",
menu_selector(TaskChatLayer::OnTaskshopExchangeBtnClick), this);
manager->RegisterMenuHandler("TaskChatPanel","TaskChatLayer::OnTaskCityDefendBtnClick",
menu_selector(TaskChatLayer::OnTaskCityDefendBtnClick), this);
manager->RegisterMenuHandler("TaskChatPanel","TaskChatLayer::OnTaskItemExchangeBtnClick",
menu_selector(TaskChatLayer::OnTaskItemExchangeBtnClick), this);
m_leftHeroLogoPic = taskChatLayout->FindChildObjectByName<UIPicture>("npcLogoIcon");
m_taskNameLabel = taskChatLayout->FindChildObjectByName<UILabel>("TaskNameLable");
m_npcTaskTalkLabel = taskChatLayout->FindChildObjectByName<UILabel>("NpcTaskTalkLabel");
// Note: find container
m_taskRewardContainer = taskChatLayout->FindChildObjectByName<UIContainer>("RewardContainer");
m_taskContainerItem[0] = taskChatLayout->FindChildObjectByName<UIContainer>("taskItemContainer_01");
m_taskContainerItem[1] = taskChatLayout->FindChildObjectByName<UIContainer>("taskItemContainer_02");
m_taskContainerItem[2] = taskChatLayout->FindChildObjectByName<UIContainer>("taskItemContainer_03");
m_rewardMoneyLabel = taskChatLayout->FindChildObjectByName<UILabel>("TaskRewardMoneyLabel");
m_rewardExpLabel = taskChatLayout->FindChildObjectByName<UILabel>("TaskRewardExpLabel");
//setTouchEnabled(true);
return true;
}
示例14: TEST
// This one is a little more involved, as we will be simulating an entire editor session, including level testing
TEST(ObjectCleanupTests, TestEditorObjectManagement)
{
GameSettingsPtr settings = GameSettingsPtr(new GameSettings());
settings->setSetting(IniKey::Nickname, string("Alfonso")); // Set this to bypass startup screen
settings->getFolderManager()->setLevelDir("levels"); // Need something for hosting to work
settings->updatePlayerName("Alfonso");
Address addr;
ClientGame *clientGame = new ClientGame(addr, settings, new UIManager()); // ClientGame destructor will clean up UIManager
GameManager::addClientGame(clientGame);
UIManager *uiMgr = clientGame->getUIManager();
uiMgr->activate<MainMenuUserInterface>();
ASSERT_TRUE(uiMgr->isCurrentUI<MainMenuUserInterface>());
// Cheat a little; go directly to editor
uiMgr->getUI<EditorUserInterface>()->setLevelFileName("xyzzy"); // Reset this so we get the level entry screen
uiMgr->activate<EditorUserInterface>();
ASSERT_TRUE(uiMgr->isCurrentUI<EditorUserInterface>());
EditorUserInterface *editor = uiMgr->getUI<EditorUserInterface>();
///// Test basic object deletion, undo system not activated
SafePtr<TestItem> testItem = new TestItem(); // To track deletion... see "Basics" test above
ASSERT_FALSE(testItem.isNull()) << "Just created this!";
editor->addToEditor(testItem.getPointer());
editor->deleteItem(0, false); // Low level method doesn't save undo state; object should be deleted
ASSERT_TRUE(testItem.isNull()) << "Obj should be gone!";
///// Check deleting object with undo system -- do things get deleted as expected?
testItem = new TestItem();
ASSERT_FALSE(testItem.isNull()) << "Just created this -- shouldn't be gone yet!";
editor->addToEditor(testItem.getPointer());
testItem->setSelected(true);
ASSERT_EQ(1, editor->getLevel()->findObjects_fast()->size()) << "Started with one object";
editor->handleKeyPress(KEY_Z, "Del"); // Triggers deleteSelection(false)
ASSERT_TRUE(testItem.isNull()) << "Obj should be gone!";
ASSERT_EQ(0, editor->getLevel()->findObjects_fast()->size()) << "All objects deleted... none should be present";
editor->handleKeyPress(KEY_Z, editor->getEditorBindingString(BINDING_UNDO_ACTION)); // Undo
ASSERT_EQ(1, editor->getLevel()->findObjects_fast()->size()) << "Undeleted one object";
ASSERT_FALSE(testItem.isValid());
testItem = dynamic_cast<TestItem *>(editor->getLevel()->findObjects_fast()->get(0));
ASSERT_TRUE(testItem.isValid());
editor->handleKeyPress(KEY_Z, editor->getEditorBindingString(BINDING_REDO_ACTION));
ASSERT_EQ(0, editor->getLevel()->findObjects_fast()->size()) << "Redid delete... none should be present";
ASSERT_FALSE(testItem.isValid());
///// Test level
Level *level = editor->getLevel(); // Keep track of the level we were editing
editor->testLevelStart();
ASSERT_TRUE(uiMgr->isCurrentUI<EditorUserInterface>()) << "Still in editor";
ASSERT_TRUE(editor->getLevel()->getGameType()) << "Have valid GameType";
GameType *gt = editor->getLevel()->getGameType();
GameManager::getServerGame()->loadNextLevelInfo();
ASSERT_EQ(GameManager::DoneLoadingLevels, GameManager::getHostingModePhase()) << "Only loading one level here...";
ASSERT_TRUE(GameManager::hostGame()) << "Failure to host game!";
ASSERT_TRUE(uiMgr->isCurrentUI<GameUserInterface>()) << "In game UI";
GameManager::localClientQuits(GameManager::getClientGames()->get(0));
ASSERT_TRUE(uiMgr->isCurrentUI<EditorUserInterface>()) << "Back to the editor";
ASSERT_EQ(editor, uiMgr->getCurrentUI()) << "Expect same object";
ASSERT_EQ(level, editor->getLevel()) << "Level should not have changed";
ASSERT_TRUE(editor->getLevel()->getGameType()) << "Expect valid GameType";
ASSERT_EQ(gt, editor->getLevel()->getGameType()) << "GameType should not have changed";
}
示例15: initCityList
bool CityListLayer::init()
{
if(!CCLayer::init())
{
return false;
}
//读取城市列表
initCityList();
UIManager *manager = UIManager::sharedManager();
cityListLayout = manager->CreateUILayoutFromFile("UIplist/cityListUI.plist", this, "CityList");
//添加背景图片
CCSprite * bgImg = CCSprite::create("game.png");
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
CCSize bgSize = bgImg->getContentSize();
float scaleX = visibleSize.width / bgSize.width;
float scaleY = visibleSize.height / bgSize.height;
bgImg->setScaleX(scaleX);
bgImg->setScaleY(scaleY);
bgImg->setPosition(ccp(visibleSize.width/2, visibleSize.height/2));
this->addChild(bgImg, -1);
//添加主城
for (size_t i = 0; i < cityInfoList.size(); i++)
{
addCityBtn(i+1);
}
//添加关闭按钮
UIButton *btn = cityListLayout->FindChildObjectByName<UIButton>("cityListCloseBtn");
CCPoint closePoint = btn->getPosition();
closePoint = ccpAdd(ccp(visibleSize.width / 2, visibleSize.height / 2), closePoint);
CCPoint pt1;
ASprite * as1 = AspriteManager::getInstance()->getAsprite(KUI_BIN);
int normalCloseId = getResourceIDByName("map_ui_FRAME_INSTANCE_CLOSE");
int selectCloseId = getResourceIDByName("map_ui_FRAME_INSTANCE_CLOSE_CLICKED");
CCSprite * normalCloseBtn = as1->getSpriteFromFrame_Middle(normalCloseId, 0, pt1);
CCSprite * selectCloseBtn = as1->getSpriteFromFrame_Middle(selectCloseId, 0, pt1);
IconButton * closeBtn = new IconButton(normalCloseBtn, NULL, selectCloseBtn, this,
menu_selector(CityListLayer::closeCityList));
closeBtn->setPosition(closePoint);
this->addChild(closeBtn);
//初始化玩家头像资源
CCPoint pt;
ASprite * as = AspriteManager::getInstance()->getAsprite(KICON_BIN);
int playerType = UserData::Get()->GetUserType();
stringstream playerResStream;
playerResStream << "map_ui_system_icon_FRAME_ICON_ROLEONMAP_" << playerType;
string playerResName = playerResStream.str();
int playerResourceId = getResourceIDByName(playerResName.c_str());
playerImg = as->getSpriteFromFrame_Middle(playerResourceId, 0, pt);
playerImg->setVisible(false);
this->addChild(playerImg);
playerMoving = false;
return true;
}