本文整理汇总了C++中Tooltip::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ Tooltip::draw方法的具体用法?C++ Tooltip::draw怎么用?C++ Tooltip::draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tooltip
的用法示例。
在下文中一共展示了Tooltip::draw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
Game::clearEntities();
Game::clearTowers();
Game::life = 20;
Game::money = 1500;
Game::tickCount = 0;
}
break;
case sf::Event::KeyReleased:
keys[ev.key.code] = false;
break;
case sf::Event::MouseButtonPressed:
SetFocus(window.getSystemHandle());
if(ev.mouseButton.button == sf::Mouse::Left) {
Vec2i p = Vec2i(mouse.x,mouse.y)/Game::pixelsPerSquare;
if(Game::map.size()>p.x && p.x>=0
&& Game::map[p.x].size()>p.y && p.y>=0) {
bool mustDeselect = true;
if(Game::map[p.x][p.y] == Game::TileType::EmptyTile) {
if(placingTower != nullptr && Game::money >= placingTower->cost) {
Game::money -= placingTower->cost;
Tower* t = placingTower->model->clone();
t->setPosition(p);
if(!Game::putTower(t))
delete t;
else
mustDeselect = false;
}
} else if(Game::map[p.x][p.y] == Game::TileType::TowerTile) {
Game::selectedTower = Game::getTower(Vec2i(mouse.x,mouse.y)/Game::pixelsPerSquare);
mustDeselect = false;
}
if(mustDeselect)
Game::selectedTower = nullptr;
}
placingTower = nullptr;
} else if(ev.mouseButton.button == sf::Mouse::Right) {
Vec2i p = Vec2i(mouse.x,mouse.y)/Game::pixelsPerSquare;
if(Game::map[p.x][p.y] == Game::TileType::TowerTile) {
Tower* t = Game::removeTower(p);
if(t==nullptr) {
cout << "ERROR DELETING TOWER" << endl;
} else {
Game::money += Game::towerManager->getTowerCost(t->getId());
delete t;
}
}
}
break;
default:
break;
}
TowerType* tt = Game::towerManager->parseEvent(ev, mouse, sf::Vector2i(towersPanel.left,towersPanel.top));
if(ev.type==sf::Event::MouseMoved)
setTooltip(tooltip, mouse, tt);
else if(tt!=nullptr) {
if(tt->cost <= Game::money)
placingTower = tt;
}
}
window.clear();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
window.pushGLStates();
sf::RectangleShape rect;
rect.setOutlineColor(sf::Color::White);
rect.setOutlineThickness(1);
rect.setFillColor(sf::Color::Green);
rect.setPosition(upgradesPanel.left, upgradesPanel.top);
rect.setSize(sf::Vector2f(upgradesPanel.width, upgradesPanel.height));
window.draw(rect);
window.popGLStates();
Game::towerManager->drawTowersPanel(&window, sf::Vector2i(towersPanel.left,towersPanel.top));
Game::draw(&window);
if(placingTower!=nullptr) {
placingTower->model->draw(&window, mouse);
placingTower->model->drawOver(&window, mouse);
}
if(tooltip!=nullptr)
tooltip->draw(&window);
window.display();
this_thread::sleep_for(chrono::milliseconds(10));
if(!paused) {
if(Game::tick())
running = false;
}
}
window.close();
freeGame();
}