Ejemplo n.º 1
0
 private void renderLevelSelectStats(Graphics g) {
   g.setFont(FONT_TEXT_DISPLAY);
   String balance = "";
   balance += dataModel.getRecord().balance;
   g.drawString(
       balance, PathXConstants.LEVEL_SELECT_BALANCE_X, PathXConstants.LEVEL_SELECT_BALANCE_Y);
   String goal = 50000 + "";
   g.drawString(goal, PathXConstants.LEVEL_SELECT_GOAL_X, PathXConstants.LEVEL_SELECT_GOAL_Y);
 }
Ejemplo n.º 2
0
  private void renderMap(Graphics g) {
    Viewport vp = dataModel.getViewport();
    int vpx = vp.getViewportX();
    int vpy = vp.getViewportY();
    g.drawImage(
        map,
        VIEWPORT_X,
        VIEWPORT_Y,
        VIEWPORT_X + VIEWPORT_WIDTH,
        VIEWPORT_Y + VIEWPORT_HEIGHT,
        vpx,
        vpy,
        vpx + VIEWPORT_WIDTH,
        vpy + VIEWPORT_HEIGHT,
        this);

    // Render level nodes
    //        Collection<PathXLevel> levels = dataModel.getLevels().values();
    //        for (PathXLevel level : levels){
    //            int x = level.getxPos();
    //            int y = level.getyPos();
    //
    //            // if the level is completed draw a green circle at the appropriate
    //            //coordinates otherwise draw a red circle
    //            if (level.isCompleted()){
    //                SpriteType sT = new SpriteType(PathXConstants.COMPLETE_LEVEL_TYPE);
    //                sT.addState("VISIBLE",
    // ((PathXMiniGame)game).getLevelNodeImage(PathXConstants.COMPLETE_LEVEL_TYPE));
    //                sT.addState("MOUSE_OVER",
    // ((PathXMiniGame)game).getLevelNodeImage(PathXConstants.COMPLETE_LEVEL_TYPE));
    //
    //                Sprite s = new Sprite(sT, x, y, 0, 0, "VISIBLE");
    //                s
    ////                s.setActionListener(new ActionListener(){
    ////                    public void ActionPerformed()
    ////                    {   eventHandler.
    ////                });
    //                renderSprite(g, s);
    //            }else{
    //                SpriteType sT = new SpriteType(PathXConstants.INCOMPLETE_LEVEL_TYPE);
    //                sT.addState("VISIBLE",
    // ((PathXMiniGame)game).getLevelNodeImage(PathXConstants.INCOMPLETE_LEVEL_TYPE));
    //                sT.addState("MOUSE_OVER",
    // ((PathXMiniGame)game).getLevelNodeImage(PathXConstants.INCOMPLETE_LEVEL_TYPE));
    //
    //                Sprite s = new Sprite(sT, x, y, 0, 0, "VISIBLE");
    //                renderSprite(g, s);
    //            }
    //        }
  }
Ejemplo n.º 3
0
  /**
   * This is where rendering starts. This method is called each frame, and the entire game
   * application is rendered here with the help of a number of helper methods.
   *
   * @param g The Graphics context for this panel.
   */
  @Override
  public void paintComponent(Graphics g) {

    try {
      // MAKE SURE WE HAVE EXCLUSIVE ACCESS TO THE GAME DATA
      game.beginUsingData();

      // CLEAR THE PANEL
      super.paintComponent(g);

      // RENDER THE BACKGROUND, WHICHEVER SCREEN WE'RE ON
      renderBackground(g);

      // Render these things if the game as has started.
      if (!dataModel.notStarted()) {

        //                RENDER THE CARS IF THE LEVEL HASN'T BEEN WON YET
        //               if (!dataModel.won())
        //                    renderCars(g);
        //
        //                RENDER THE GRAPH, INCLUDING THE ROADS AND NODES.
        //                renderGraph();
        //
        //                RENDER DIALOGS IF THERE ARE ANY.
        //                renderDialogs(g);
        //                //
        //                renderLevelName(g);

      }
      if (((PathXMiniGame) game).isCurrentScreenState(LEVEL_SELECT_SCREEN_STATE)) {
        renderMap(g);
        renderLevelSelectStats(g);
        updateLevelSprites();
      }

      // RENDER BUTTONS AND DECOR
      renderGUIControls(g);

      // renderStats(g);

    } finally {
      game.endUsingData();
    }
  }
Ejemplo n.º 4
0
 private void updateLevelSprites() {
   for (PathXLevelSprite ls : dataModel.getLevelSprites()) ls.update();
 }