本文整理汇总了C++中MainMenu::input方法的典型用法代码示例。如果您正苦于以下问题:C++ MainMenu::input方法的具体用法?C++ MainMenu::input怎么用?C++ MainMenu::input使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainMenu
的用法示例。
在下文中一共展示了MainMenu::input方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
#ifdef __GNUC__
XInitThreads();
#endif
xb::Joystick::isAnyXBox360ControllerConnected();
bool isSmall;
sf::View v(sf::FloatRect(0,0,sf::VideoMode::getDesktopMode().width,sf::VideoMode::getDesktopMode().height));
RenderWindow *window;
HEIGHT = 800;
WIDTH = 1280;
if (sf::VideoMode::getDesktopMode().height > 800)
{
window = new RenderWindow(VideoMode(WIDTH, HEIGHT), "Grief Trigger Turbo HD", sf::Style::Titlebar | sf::Style::Close);
isSmall = false;
}
else
{
//HEIGHT = sf::VideoMode::getDesktopMode().width;
//WIDTH = sf::VideoMode::getDesktopMode().height;
window = new RenderWindow(VideoMode(sf::VideoMode::getDesktopMode().width, sf::VideoMode::getDesktopMode().height), "Grief Trigger Turbo HD", sf::Style::Titlebar | sf::Style::Close);
isSmall = true;
window->setSize(sf::Vector2u(sf::VideoMode::getDesktopMode().width/2, 800/2));
v = window->getView();
//v.zoom(2.f);
window->setView(v);
}
//window->setFramerateLimit(60);
window->setVerticalSyncEnabled(true);
// window.setKeyRepeatEnabled(false);
sf::Clock frameClock;
sf::Clock updateClock;
sf::Int32 nextUpdate = updateClock.getElapsedTime().asMilliseconds();
float updateRate(1.0f / 15.f);
float maxUpdates = 1;
Level::instance().setDay(0); // Menu
Level::instance().setScene(0);//
GameData::instance().getPlayer().getWeapon().init(L"Клеймор x");
GameData::instance().getEmber().getWeapon().init(L"Посох x");
GameData::instance().getThunder().getWeapon().init(L"Катана x");
running = true;
isMenu = true;
while (running && window->isOpen())
{
sf::Int32 updateTime = updateClock.getElapsedTime().asMilliseconds();
Uint32 updates = 0;
sf::Event event;
while (window->pollEvent(event))
{
if (event.type == sf::Event::Closed) window->close();
if (!isMenu) SceneManager::instance().input(event);
else mm.input(event);
}
while((updateTime - nextUpdate) >= updateRate && updates++ < maxUpdates)
{
if (!isMenu)SceneManager::instance().update(sf::seconds(updateRate));
else mm.update(sf::seconds(updateRate));
nextUpdate += updateRate;
}
//float lt, rt;
//xb::Joystick::getTriggers(0, lt, rt);
//// Triggers controls the vibration
//xb::Joystick::setVibration(0, lt, rt);
if (Level::instance().getDay()==0 && Level::instance().getScene()==0)
{
isMenu = true;
}
if (Level::instance().getDay()==0 && Level::instance().getScene()==0)
{
isMenu = true;
}
window->clear();
if (isSmall)
{
if (!isMenu) SceneManager::instance().draw(*window);
else mm.draw(*window);
//.........这里部分代码省略.........