function Game() {
  
  this.width = 960;
  this.height = 480;
  
  this.interval;
  
  this.frameCounter = 0;
  this.fps = 0;

  
  this.init = function() {
    this.drawEmpty();
    img.startLoading();
  };
  
  
  this.imageLoadingEnded = function() {
    this.setupGame();
    this.startLoop();
    window.setInterval(function() {
      game.calculateFps();
    }, 1000);
  };
  
  
  this.setupGame = function() {
    
    fonts.create("Border", img.get("fontBorder"), 1900, 20, 20, -2, 4);
    fonts.create("Black", img.get("fontBlack"), 1900, 20, 20, 0, 4);
    fonts.create("Shadow", img.get("fontShadow"), 1900, 20, 20, 0, 4);
    
    viewport = new Viewport();
    viewport.init(8, 8, 676, 464);
    
    map = new Map();
    map.init();
    
    ship = new Ship();
    ship.init();
    
    panel = new Panel();
    panel.init();

  };
  
  
  this.startLoop = function() {
    this.interval = window.setInterval(function() {
      game.loop();
    }, 33);
  };
  
  
  this.loop = function() {
    this.update();
    this.draw();
    this.frameCounter++;
  };
  
  
  this.update = function() {
    map.update();
    ship.update();
  };
  
  
  this.draw = function() {
    
    this.drawEmpty();
    
    viewport.applyTranslation();
    map.draw();
    ship.draw();
    map.drawCannonballs();
    viewport.removeTranslation();
    
    panel.draw();

  };
  
  
  this.calculateFps = function() {
    this.fps = this.frameCounter;
    this.frameCounter = 0;
    this.printFps();
  };
  
  
  this.printFps = function() {
    
  };
  
  
  this.drawEmpty = function() {
    c.fillStyle = "#000";
    c.fillRect(0, 0, this.width, this.height);
  };

}