本文整理汇总了C++中Paddle::load方法的典型用法代码示例。如果您正苦于以下问题:C++ Paddle::load方法的具体用法?C++ Paddle::load怎么用?C++ Paddle::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paddle
的用法示例。
在下文中一共展示了Paddle::load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[]) {
for (int i = 1; i < argc; i++) {
std::string arg = static_cast<std::string>(argv[i]);
if (arg == "-ps3") {
keyboard = false;
std::cout << "ps3" << std::endl;
}
}
if (keyboard == false) {
// Check that joystick #0 is connected.
if (sf::Joystick::isConnected(0)) {
std::cout << "Joystick is connected." << std::endl;
} else {
std::cout << "Joystick is NOT connected." << std::endl;
return 0;
}
}
srand(time(NULL));
// Initializing game objects.
Paddle* player = new Paddle;
player->load("images/paddle.png");
player->set_position(SCREEN_WIDTH / 2, SCREEN_HEIGHT - player->get_height());
game_object_manager.add("player", player);
Ball* game_ball = new Ball;
game_ball->load("images/ball.png");
game_ball->set_position(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2);
game_object_manager.add("ball", game_ball);
main_window.setFramerateLimit(60);
// Game loop
while (main_window.isOpen() && end_game == false) {
process_input();
update();
render();
}
return 0;
}