skizzle/src/main.cpp

79 lines
2.8 KiB
C++
Raw Normal View History

2016-03-25 17:40:39 +00:00
#include "player.hpp"
2016-03-10 20:58:30 +00:00
#include "block.hpp"
2016-03-28 13:05:18 +00:00
#include "game.hpp"
#include "constants.hpp"
2016-03-25 17:40:39 +00:00
#include <cstdlib>
2016-03-10 20:58:30 +00:00
#include <iostream>
2016-03-04 15:29:31 +00:00
int main() {
2016-03-28 13:05:18 +00:00
Game game;
2016-03-10 20:58:30 +00:00
2016-03-25 17:40:39 +00:00
Player player1(3.5f * Constants::GRID, 10 * Constants::GRID);
player1.setPlayerNumber(1);
Player player2(18.5f * Constants::GRID, 10 * Constants::GRID);
player2.setPlayerNumber(2);
2016-03-18 18:14:16 +00:00
Block block01(2 * Constants::GRID, 10 * Constants::GRID);
Block block02(2 * Constants::GRID, 11 * Constants::GRID);
Block block03(3 * Constants::GRID, 11 * Constants::GRID);
Block block04(4 * Constants::GRID, 11 * Constants::GRID);
Block block05(5 * Constants::GRID, 11 * Constants::GRID);
Block block06(6 * Constants::GRID, 11 * Constants::GRID);
Block block07(7 * Constants::GRID, 11 * Constants::GRID);
Block block08(8 * Constants::GRID, 11 * Constants::GRID);
Block block09(9 * Constants::GRID, 11 * Constants::GRID);
2016-03-19 18:34:24 +00:00
Block block10(10 * Constants::GRID, 11 * Constants::GRID);
Block block11(11 * Constants::GRID, 11 * Constants::GRID);
Block block12(12 * Constants::GRID, 11 * Constants::GRID);
Block block13(13 * Constants::GRID, 11 * Constants::GRID);
Block block14(14 * Constants::GRID, 11 * Constants::GRID);
Block block15(15 * Constants::GRID, 11 * Constants::GRID);
Block block16(16 * Constants::GRID, 11 * Constants::GRID);
Block block17(17 * Constants::GRID, 11 * Constants::GRID);
Block block18(18 * Constants::GRID, 11 * Constants::GRID);
Block block19(19 * Constants::GRID, 11 * Constants::GRID);
Block block20(20 * Constants::GRID, 10 * Constants::GRID);
Block block21(20 * Constants::GRID, 11 * Constants::GRID);
2016-03-19 21:14:41 +00:00
Block block22(11 * Constants::GRID, 10 * Constants::GRID);
2016-03-04 15:29:31 +00:00
2016-03-25 17:40:39 +00:00
player1.setCharge(-.01f);
player2.setCharge(-.01f);
2016-03-19 18:34:24 +00:00
block22.setCharge(1.f);
block22.setMass(2);
2016-03-11 15:14:34 +00:00
2016-03-28 13:05:18 +00:00
game.addObject(player1);
game.addObject(player2);
game.addObject(block01);
game.addObject(block02);
game.addObject(block03);
game.addObject(block04);
game.addObject(block05);
game.addObject(block06);
game.addObject(block07);
game.addObject(block08);
game.addObject(block09);
game.addObject(block10);
game.addObject(block11);
game.addObject(block12);
game.addObject(block13);
game.addObject(block14);
game.addObject(block15);
game.addObject(block16);
game.addObject(block17);
game.addObject(block18);
game.addObject(block19);
game.addObject(block20);
game.addObject(block21);
game.addObject(block22);
2016-03-10 20:58:30 +00:00
2016-03-25 17:40:39 +00:00
try {
2016-03-28 13:05:18 +00:00
game.start();
2016-03-25 17:40:39 +00:00
} catch (const std::exception& exception) {
std::cerr << std::endl;
std::cerr << "Le programme a quitté après une erreur d'exécution." << std::endl;
std::cerr << exception.what() << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
2016-03-04 15:29:31 +00:00
}