本文整理汇总了C++中UINode类的典型用法代码示例。如果您正苦于以下问题:C++ UINode类的具体用法?C++ UINode怎么用?C++ UINode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UINode类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: onGesture
bool UINode::onGesture (int64_t gestureId, float error, int32_t numFingers)
{
if (!_enabled)
return false;
for (UINodeListRevIter i = _nodes.rbegin(); i != _nodes.rend(); ++i) {
UINode* nodePtr = *i;
if (!nodePtr->hasFocus())
continue;
if ((*i)->onGesture(gestureId, error, numFingers)) {
return true;
}
}
return false;
}
开发者ID:RobertoMalatesta,项目名称:caveexpress,代码行数:16,代码来源:UINode.cpp
示例2: onGestureRecord
bool UINode::onGestureRecord (int64_t gestureId)
{
if (!_enabled)
return false;
for (UINodeListRevIter i = _nodes.rbegin(); i != _nodes.rend(); ++i) {
UINode* nodePtr = *i;
if (!nodePtr->hasFocus())
continue;
if ((*i)->onGestureRecord(gestureId)) {
return true;
}
}
return false;
}
开发者ID:RobertoMalatesta,项目名称:caveexpress,代码行数:16,代码来源:UINode.cpp
示例3: onMultiGesture
bool UINode::onMultiGesture (float theta, float dist, int32_t numFingers)
{
if (!_enabled)
return false;
for (UINodeListRevIter i = _nodes.rbegin(); i != _nodes.rend(); ++i) {
UINode* nodePtr = *i;
if (!nodePtr->hasFocus())
continue;
if ((*i)->onMultiGesture(theta, dist, numFingers)) {
return true;
}
}
return false;
}
开发者ID:RobertoMalatesta,项目名称:caveexpress,代码行数:16,代码来源:UINode.cpp
示例4: BoundingRectInLocalCoordinates
IntRect MaskNode::BoundingRectInLocalCoordinates() {
if (!m_bBoundingDirty)
return m_rcItem;
m_bBoundingDirty = false;
if (!m_bChildNeedDraw && !m_bBoundingDirty)
return m_rcItem;
for(size_t it = 0; it < m_children.size(); ++it) {
UINode* n = static_cast<UINode*>(m_children[it]);
// 不考虑子节点的坐标变换
IntRect childBounding = n->BoundingRectInLocalCoordinates();
m_rcItem.unite(childBounding);
}
return m_rcItem;
}
开发者ID:henryrao,项目名称:kdguigl,代码行数:17,代码来源:MaskNode.cpp
示例5: UINode
void UIMapWindow::initHudNodes ()
{
UINode* panel = new UINode(_frontend);
panel->setImage("bones");
panel->setStandardPadding();
panel->setAlignment(NODE_ALIGN_TOP | NODE_ALIGN_CENTER);
add(panel);
UINode *innerPanel = new UINode(_frontend);
innerPanel->setLayout(new UIHBoxLayout(0.01f));
innerPanel->setPos(panel->getX() + 0.07f, panel->getY());
_points = new UICavePackerNodePoint(_frontend, 30);
_points->setFont(HUGE_FONT);
_points->setId(UINODE_POINTS);
innerPanel->add(_points);
add(innerPanel);
}
开发者ID:RobertoMalatesta,项目名称:caveexpress,代码行数:17,代码来源:UIMapWindow.cpp
示例6: getNode
UINode* UINode::getNode (const std::string& nodeId)
{
if (_nodes.empty())
return nullptr;
for (UINodeListIter i = _nodes.begin(); i != _nodes.end(); ++i) {
UINode* node = (*i);
if (node->getId() == nodeId)
return node;
UINode* nodeR = node->getNode(nodeId);
if (nodeR)
return nodeR;
}
return nullptr;
}
开发者ID:RobertoMalatesta,项目名称:caveexpress,代码行数:17,代码来源:UINode.cpp
示例7: showCursor
void IUIMapWindow::onActive ()
{
UIWindow::onActive();
_cursorActive = UI::get().isCursorVisible();
if (_cursorActive && !_startButton->isVisible())
showCursor(false);
UINode* lives = getNode(UINODE_LIVES);
if (lives != nullptr)
lives->setVisible(Config.isModeHard());
//if (!getSystem().hasItem(PAYMENT_ADFREE)) {
// const int h = _frontend->getHeight() - getSystem().getAdHeight();
// _nodeMap->setMapRect(0, 0, _frontend->getWidth(), h);
//}
if (_nodeMap->getMap().isStarted())
Config.setBindingsSpace(BINDINGS_MAP);
}
开发者ID:LibreGames,项目名称:caveexpress,代码行数:18,代码来源:IUIMapWindow.cpp
示例8: getNodeByPos
UINode* UI::MouseButton(int button, int state, int x, int y)
{
UINode* node = getNodeByPos(x, y);
if(node!=NULL && state == 0)
{
node->MouseButton(button, state, x, y);
mRootNode->previousPressed = node;
return node;
}
if(state == 1 && mRootNode->previousPressed != NULL)
{
mRootNode->previousPressed->MouseButton(button, state, x, y);
mRootNode->previousPressed = NULL;
}
return NULL;
}
开发者ID:cdaniel8937,项目名称:cashew,代码行数:19,代码来源:UI.cpp
示例9: addFirstFocus
bool UINode::addFirstFocus ()
{
bool focus = false;
for (UINodeListIter i = _nodes.begin(); i != _nodes.end(); ++i) {
UINode* nodePtr = *i;
nodePtr->removeFocus();
if (focus)
continue;
focus = nodePtr->addFirstFocus();
if (focus)
addFocus(0, 0);
}
if (_nodes.empty() && isActive()) {
addFocus(0, 0);
return true;
}
return focus;
}
开发者ID:RobertoMalatesta,项目名称:caveexpress,代码行数:19,代码来源:UINode.cpp
示例10: addLastFocus
bool UINode::addLastFocus ()
{
bool focus = false;
for (UINodeListRevIter i = _nodes.rbegin(); i != _nodes.rend(); ++i) {
UINode* nodePtr = *i;
nodePtr->removeFocus();
if (!focus) {
focus = nodePtr->addLastFocus();
if (focus) {
addFocus(0, 0);
}
}
}
if (_nodes.empty() && isActive()) {
addFocus(0, 0);
return true;
}
return focus;
}
开发者ID:RobertoMalatesta,项目名称:caveexpress,代码行数:20,代码来源:UINode.cpp
示例11: getId
void UINode::removeFocus ()
{
if (!_focus)
return;
Log::debug(LOG_CLIENT, "remove focus for %s", getId().c_str());
_focus = false;
_focusMouseX = -1;
_focusMouseY = -1;
for (Listeners::iterator i = _listeners.begin(); i != _listeners.end(); ++i) {
(*i)->onRemoveFocus();
}
if (!fequals(_focusAlpha, 0.0f))
restoreAlpha();
for (UINodeListIter i = _nodes.begin(); i != _nodes.end(); ++i) {
UINode* node = *i;
if (!node->hasFocus())
continue;
node->removeFocus();
}
}
开发者ID:RobertoMalatesta,项目名称:caveexpress,代码行数:21,代码来源:UINode.cpp
示例12: removeFocus
bool UINode::checkFocus (int32_t x, int32_t y)
{
if (x <= -1 || y <= -1 || !isVisible() || !isActive()) {
if (hasFocus())
removeFocus();
return false;
}
if (checkBounds(x, y)) {
if (_nodes.empty()) {
addFocus(x, y);
return true;
}
const int childX = x - getRenderX();
const int childY = y - getRenderY();
bool focusOnChildren = false;
for (UINodeListRevIter i = _nodes.rbegin(); i != _nodes.rend(); ++i) {
UINode* nodePtr = *i;
int focusX = childX;
int focusY = childY;
if (focusOnChildren) {
focusX = focusY = -1;
}
const bool focus = nodePtr->checkFocus(focusX, focusY);
focusOnChildren |= focus;
}
if (focusOnChildren) {
addFocus(x, y);
return true;
}
}
if (hasFocus()) {
removeFocus();
}
return false;
}
开发者ID:RobertoMalatesta,项目名称:caveexpress,代码行数:39,代码来源:UINode.cpp
示例13: createHPanel
void UIGameHelpWindow::addTreeHelp (UINode *panel)
{
UINode* hbox = createHPanel();
hbox->add(createSprite(EntityTypes::STONE));
hbox->add(createTexture("icon-plus"));
hbox->add(createSprite(EntityTypes::TREE));
hbox->add(createTexture("icon-result"));
hbox->add(createSprite(EntityTypes::TREE, Animations::ANIMATION_DAZED));
hbox->add(createSprite(EntityTypes::APPLE));
panel->add(hbox);
}
开发者ID:RobertoMalatesta,项目名称:caveexpress,代码行数:11,代码来源:UIGameHelpWindow.cpp
示例14: UINode
UINode* UIGameHelpWindow::createHPanel ()
{
UINode* hbox = new UINode(_frontend);
hbox->setLayout(new UIHBoxLayout(hboxspacing, false));
hbox->setBackgroundColor(backgroundColor);
hbox->setBorder(true);
hbox->setBorderColor(colorWhite);
hbox->setStandardPadding();
return hbox;
}
开发者ID:RobertoMalatesta,项目名称:caveexpress,代码行数:10,代码来源:UIGameHelpWindow.cpp
示例15: addFocus
bool UINode::nextFocus ()
{
if (_nodes.empty()) {
if (!isActive())
return false;
if (hasFocus())
return false;
addFocus(0, 0);
return true;
}
for (UINodeListIter i = _nodes.begin(); i != _nodes.end(); ++i) {
UINode* nodePtr = *i;
// search the node that currently has the focus
if (!nodePtr->hasFocus())
continue;
if (nodePtr->nextFocus()) {
addFocus(0, 0);
return true;
}
nodePtr->removeFocus();
for (++i; i != _nodes.end(); ++i) {
UINode* focusNodePtr = *i;
if (focusNodePtr->addFirstFocus()) {
addFocus(0, 0);
return true;
}
}
break;
}
removeFocus();
return false;
}
开发者ID:RobertoMalatesta,项目名称:caveexpress,代码行数:37,代码来源:UINode.cpp
示例16: layout
void UIHBoxLayout::layout (UINode* parent)
{
float currentSize = 2.0f * parent->getPadding();
float minHeight = 0.0f;
for (UINodeListIter i = _nodes.begin(); i != _nodes.end(); ++i) {
UINode* node = *i;
currentSize += node->getWidth() + _spacing;
minHeight = std::max(node->getHeight() + 2.0f * parent->getPadding(), minHeight);
}
float size = currentSize - _spacing;
parent->setSize(size, minHeight);
// the size might change the alignment and thus the position of the parent
float currentPos = parent->getPadding();
for (UINodeListIter i = _nodes.begin(); i != _nodes.end(); ++i) {
UINode* node = *i;
if (_expandChildren)
node->setSize(node->getWidth(), parent->getHeight() - 2.0f * parent->getPadding());
if (_align & NODE_ALIGN_MIDDLE) {
node->setPos(currentPos, parent->getHeight() / 2.0f - node->getHeight() / 2.0f);
} else if (_align & NODE_ALIGN_BOTTOM) {
node->setPos(currentPos, parent->getHeight() - node->getHeight());
} else {
node->setPos(currentPos, node->getY());
}
currentPos += node->getWidth() + _spacing;
}
}
开发者ID:ptitSeb,项目名称:caveexpress,代码行数:32,代码来源:UIHBoxLayout.cpp
示例17: UIWindow
UIMainWindow::UIMainWindow (IFrontend *frontend, ServiceProvider& serviceProvider) :
UIWindow(UI_WINDOW_MAIN, frontend, WINDOW_FLAG_ROOT)
{
add(new UINodeMainBackground(frontend, false));
const SpritePtr& mammutSprite = UI::get().loadSprite("ui-npc-mammut");
_mammut = new UINodeSprite(frontend, mammutSprite->getMaxWidth(), mammutSprite->getMaxHeight());
_mammut->addSprite(mammutSprite);
const SpritePtr& grandPaSprite = UI::get().loadSprite("ui-npc-grandpa");
_grandpa = new UINodeSprite(frontend, grandPaSprite->getMaxWidth(), grandPaSprite->getMaxHeight());
_grandpa->addSprite(grandPaSprite);
const SpritePtr& playerSprite = UI::get().loadSprite("ui-player");
_player = new UINodeSprite(frontend, playerSprite->getMaxWidth(), playerSprite->getMaxHeight());
_player->addSprite(playerSprite);
add(_mammut);
add(_grandpa);
add(_player);
const float padding = 10.0f / static_cast<float>(_frontend->getHeight());
UINode *panel = new UINode(_frontend, "panelMain");
UIVBoxLayout *layout = new UIVBoxLayout(padding, true);
panel->setLayout(layout);
panel->setAlignment(NODE_ALIGN_MIDDLE | NODE_ALIGN_CENTER);
panel->setPadding(padding);
UINodeMainButton *campaign = new UINodeMainButton(_frontend, tr("Campaign"));
campaign->addListener(UINodeListenerPtr(new OpenWindowListener(UI_WINDOW_CAMPAIGN)));
panel->add(campaign);
#ifndef NONETWORK
if (Config.isNetwork()) {
UINodeMainButton *multiplayer = new UINodeMainButton(_frontend, tr("Multiplayer"));
multiplayer->addListener(UINodeListenerPtr(new OpenWindowListener(UI_WINDOW_MULTIPLAYER)));
panel->add(multiplayer);
}
#endif
UINodeMainButton *settings = new UINodeMainButton(_frontend, tr("Settings"));
settings->addListener(UINodeListenerPtr(new OpenWindowListener(UI_WINDOW_SETTINGS)));
panel->add(settings);
if (System.supportPayment()) {
UINodeMainButton *payment = new UINodeMainButton(_frontend, tr("Extras"));
payment->addListener(UINodeListenerPtr(new OpenWindowListener(UI_WINDOW_PAYMENT)));
panel->add(payment);
}
if (System.supportGooglePlay()) {
UINodeButtonImage *googlePlay = new UINodeGooglePlayButton(_frontend);
googlePlay->setPadding(padding);
add(googlePlay);
}
#ifndef STEAMLINK
if (System.supportsUserContent()) {
UINodeMainButton *editor = new UINodeMainButton(_frontend, tr("Editor"));
editor->addListener(UINodeListenerPtr(new OpenWindowListener(UI_WINDOW_EDITOR)));
panel->add(editor);
}
UINodeMainButton *twitter = new UINodeMainButton(_frontend, tr("Twitter"));
twitter->addListener(UINodeListenerPtr(new OpenURLListener(_frontend, "https://twitter.com/MartinGerhardy")));
panel->add(twitter);
UINodeMainButton *homepage = new UINodeMainButton(_frontend, tr("Homepage"));
homepage->addListener(UINodeListenerPtr(new OpenURLListener(_frontend, "http://caveproductions.org/")));
panel->add(homepage);
#endif
UINodeMainButton *help = new UINodeMainButton(_frontend, tr("Help"));
help->addListener(UINodeListenerPtr(new OpenWindowListener(UI_WINDOW_HELP)));
panel->add(help);
#if 0
#ifdef __EMSCRIPTEN__
UINodeMainButton *fullscreen = new UINodeMainButton(_frontend, tr("Fullscreen"));
fullscreen->addListener(UINodeListenerPtr(new EmscriptenFullscreenListener()));
panel->add(fullscreen);
#endif
#endif
UINodeMainButton *quit = new UINodeMainButton(_frontend, tr("Quit"));
#ifdef __EMSCRIPTEN__
quit->addListener(UINodeListenerPtr(new OpenURLListener(_frontend, "http://caveproductions.org/", false)));
#else
quit->addListener(UINodeListenerPtr(new QuitListener()));
#endif
panel->add(quit);
add(panel);
Application& app = Singleton<Application>::getInstance();
UINodeLabel *versionLabel = new UINodeLabel(_frontend, app.getPackageName() + " " + app.getVersion());
versionLabel->setAlignment(NODE_ALIGN_BOTTOM|NODE_ALIGN_RIGHT);
versionLabel->setColor(colorWhite);
versionLabel->setPadding(getScreenPadding());
add(versionLabel);
}
开发者ID:LibreGames,项目名称:caveexpress,代码行数:100,代码来源:UIMainWindow.cpp
示例18: UIWindow
UIMainWindow::UIMainWindow (IFrontend *frontend) :
UIWindow(UI_WINDOW_MAIN, frontend, WINDOW_FLAG_ROOT)
{
add(new UINodeMainBackground(frontend, false));
const float padding = 10.0f / static_cast<float>(_frontend->getHeight());
UINode *panel = new UINode(_frontend, "panelMain");
UIVBoxLayout *layout = new UIVBoxLayout(padding, true);
panel->setLayout(layout);
panel->setAlignment(NODE_ALIGN_MIDDLE | NODE_ALIGN_CENTER);
panel->setPadding(padding);
UINodeMainButton *campaign = new UINodeMainButton(_frontend, tr("Start"));
campaign->addListener(UINodeListenerPtr(new OpenWindowListener(UI_WINDOW_CAMPAIGN)));
panel->add(campaign);
#ifndef NONETWORK
if (Config.isNetwork()) {
UINodeMainButton *multiplayer = new UINodeMainButton(_frontend, tr("Multiplayer"));
multiplayer->addListener(UINodeListenerPtr(new OpenWindowListener(UI_WINDOW_MULTIPLAYER)));
panel->add(multiplayer);
}
#endif
UINodeMainButton *settings = new UINodeMainButton(_frontend, tr("Settings"));
settings->addListener(UINodeListenerPtr(new OpenWindowListener(UI_WINDOW_SETTINGS)));
panel->add(settings);
#if 0
UINodeMainButton *gesture = new UINodeMainButton(_frontend, tr("Gesture"));
gesture->addListener(UINodeListenerPtr(new OpenWindowListener("gesture")));
panel->add(gesture);
#endif
if (System.supportPayment()) {
UINodeMainButton *payment = new UINodeMainButton(_frontend, tr("Extras"));
payment->addListener(UINodeListenerPtr(new OpenWindowListener(UI_WINDOW_PAYMENT)));
panel->add(payment);
}
if (System.supportGooglePlay()) {
UINodeButtonImage *googlePlay = new UINodeGooglePlayButton(_frontend);
googlePlay->setPadding(padding);
add(googlePlay);
}
UINodeMainButton *twitter = new UINodeMainButton(_frontend, tr("Twitter"));
twitter->addListener(UINodeListenerPtr(new OpenURLListener(_frontend, "https://twitter.com/MartinGerhardy")));
panel->add(twitter);
UINodeMainButton *homepage = new UINodeMainButton(_frontend, tr("Homepage"));
homepage->addListener(UINodeListenerPtr(new OpenURLListener(_frontend, "http://caveproductions.org/")));
panel->add(homepage);
#if 0
#ifdef __EMSCRIPTEN__
UINodeMainButton *fullscreen = new UINodeMainButton(_frontend, tr("Fullscreen"));
fullscreen->addListener(UINodeListenerPtr(new EmscriptenFullscreenListener()));
panel->add(fullscreen);
#endif
#endif
UINodeMainButton *quit = new UINodeMainButton(_frontend, tr("Quit"));
#ifdef __EMSCRIPTEN__
quit->addListener(UINodeListenerPtr(new OpenURLListener(_frontend, "http://caveproductions.org/", false)));
#else
quit->addListener(UINodeListenerPtr(new QuitListener()));
#endif
panel->add(quit);
add(panel);
}
开发者ID:LibreGames,项目名称:caveexpress,代码行数:71,代码来源:UIMainWindow.cpp
注:本文中的UINode类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论