本文整理汇总了C++中Level::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ Level::draw方法的具体用法?C++ Level::draw怎么用?C++ Level::draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Level
的用法示例。
在下文中一共展示了Level::draw方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
sf::RenderWindow window(sf::VideoMode(WIDTH,HEIGHT,32),"Application");
window.setFramerateLimit(60);
Level* level;
std::vector<std::string> levelfiles;
levelfiles.push_back("level1.txt");
levelfiles.push_back("level2.txt");
levelfiles.push_back("level3.txt");
int currentLevel = 0;
level = new Level("level1.txt", &window);
while(window.isOpen())
{
level->update();
level->handle();
window.clear(sf::Color(200, 200, 200));
level->draw();
window.display();
if(level->isCompleted())
{
delete level;
level = new Level(levelfiles[++currentLevel], &window);
}
}
return 0;
}
示例2: draw
static void draw(TransformPipeline& tp)
{
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glFrontFace(GL_CCW);
glEnable(GL_DEPTH_TEST);
level.draw(tp);
}
示例3: main
int main(int argc, char ** argv) {
try {
// game engine subsystems
Graphics graphics;
Level level;
Time time;
// load level
level.setLevel(graphics.load("levels/mountains.bmp"));
level.setBackground(graphics.load("levels/summer_sky.bmp"));
auto player1 = Ship();
auto player2 = Ship(Player::Two);
player1.setSpawn(Point(50, 250));
player1.respawn();
player2.setSpawn(Point(100, 250));
player2.respawn();
player1.setImage(graphics.load("ships/ship2.bmp"));
player2.setImage(graphics.load("ships/ship3.bmp"));
level.add(player1);
level.add(player2);
// rendering loop
bool quit{ false };
while(!quit) {
// calculate framerate
int frameTime = time.frame();
int fps = (int)round(1000.f / frameTime);
Input::Event e;
do { // handle input
e = Input::nextInput();
if(e == Input::QUIT) quit = true;
level.notify(e);
} while(e != Input::NO_EVENT);
graphics.clear();
level.update(frameTime);
level.draw(graphics);
graphics.draw(std::to_string(fps) + " fps", Point(25, graphics.getHeight() - 20.f));
graphics.present();
}
} catch(std::exception e) {
return EXIT_FAILURE; // error return code
}
return EXIT_SUCCESS; // normal program exit
}
示例4: draw
void draw(Level lvl)
{
//Clear color buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//handleCamera();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(FoV, WINDOW_WIDTH / WINDOW_HEIGHT, 0.1, 100);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// Render Camera
camera.render();
glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
glLightfv(GL_LIGHT0, GL_AMBIENT, ambientColour);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseColour);
glLightfv(GL_LIGHT0, GL_SPECULAR, specularColour);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_emission);
glPushMatrix();
// Draw Level
lvl.draw();
glPopMatrix();
// Draw HUD
drawHUD(lvl);
SDL_GL_SwapWindow(gWindow);
}
示例5: drawLevel
void World::drawLevel(float delta) {
Level* level = this->level;
level->draw((Screen*) gs);
}