本文整理汇总了C++中Levels::setLevels方法的典型用法代码示例。如果您正苦于以下问题:C++ Levels::setLevels方法的具体用法?C++ Levels::setLevels怎么用?C++ Levels::setLevels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Levels
的用法示例。
在下文中一共展示了Levels::setLevels方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
sf::RenderWindow WINDOW(sf::VideoMode(1280, 720, 32), "Arctic", sf::Style::Close);
WINDOW.SetFramerateLimit(60);
Levels* levels;
levels->setLevels();
sf::Clock clock;
float time = clock.GetElapsedTime();
state = Ingame;
prevState = Menu;
/* Main Menu Buttons */
BUTTON play(440, 200, "PLAY");
BUTTON options(440, 320, "OPTIONS");
BUTTON quit(440, 440, "QUIT");
/* Pause Buttons */
BUTTON resume(440, 200, "RESUME");
BUTTON pauseOptions(440, 320, "OPTIONS");
BUTTON quitToMenu(440, 440, "QUIT TO MENU");
/* Strings */
STRING str("Arctic - Sprite Testing", 5, 2, sf::Color(255, 255, 255));
while(WINDOW.IsOpened())
{
sf::Event event;
sf::Vector2i mouse(WINDOW.GetInput().GetMouseX(), WINDOW.GetInput().GetMouseY());
time = clock.GetElapsedTime();
while(WINDOW.GetEvent(event))
{
switch(event.Type)
{
case sf::Event::Closed:
WINDOW.Close();
break;
case sf::Event::KeyPressed:
if(event.Key.Code == sf::Key::Escape)
{
if(state == Menu)
{
WINDOW.Close();
}
else if(state == Ingame)
{
state = Paused;
prevState = Ingame;
}
else if(state == Options)
{
state = prevState;
prevState = Options;
}
else if(state == Paused)
{
state = prevState;
prevState = Paused;
}
}
if(event.Key.Code == sf::Key::Space)
{
for(int i = 0; i < ice.size(); i++)
{
if(ice[i]->state != Ice::IceState::Rock)
{
ice[i]->state = Ice::IceState::Reg;
}
}
}
break;
case sf::Event::MouseButtonReleased:
if(event.MouseButton.Button == sf::Mouse::Button::Left)
{
if(state == Menu)
{
if(play.contains(mouse))
{
state = Ingame;
}
else if(options.contains(mouse))
{
state = Options;
prevState = Menu;
}
else if(quit.contains(mouse))
{
WINDOW.Close();
}
}
else if(state == Paused)
{
if(resume.contains(mouse))
{
state = Ingame;
}
else if(pauseOptions.contains(mouse))
{
state = Options;
//.........这里部分代码省略.........