void debug() { int fps = (int) openGLGestion.getFPS(); ortho.drawText(1, 50, "fps=" + fps, new Vector3f(0.0f, 0.0f, 1.0f)); SpriteEntity zildo = spriteDisplay.getZildo(); if (zildo == null) { return; } ortho.drawText(1, 80, "zildo: " + zildo.x, new Vector3f(1.0f, 0.0f, 1.0f)); ortho.drawText(43, 86, "" + zildo.y, new Vector3f(1.0f, 0.0f, 1.0f)); // Debug collision Point camera = mapDisplay.getCamera(); if (EngineZildo.collideManagement != null && Zildo.infoDebugCollision) { for (Collision c : EngineZildo.collideManagement.getTabColli()) { if (c != null) { int rayon = c.cr; int color = 15; Perso damager = c.perso; Vector4f alphaColor = new Vector4f(0.2f, 0.4f, 0.9f, 16.0f); if (damager != null && damager.getInfo() == PersoInfo.ENEMY) { color = 20; } if (c.size == null) { ortho.box( c.cx - rayon - camera.x, c.cy - rayon - camera.y, rayon * 2, rayon * 2, 0, alphaColor); } else { Point center = new Point(c.cx - camera.x, c.cy - camera.y); Rectangle rect = new Rectangle(center, c.size); ortho.box(rect, color, null); } } } // -7, -10 int x = (int) zildo.x - 4; int y = (int) zildo.y - 10; ortho.box(x - 3 - camera.x, y - camera.y, 16, 16, 12, null); } if (Zildo.infoDebugCase) { for (int y = 0; y < 20; y++) { for (int x = 0; x < 20; x++) { int cx = x + camera.x / 16; int cy = y + camera.y / 16; int px = x * 16 - camera.x % 16; int py = y * 16 - camera.y % 16; if (cy < 64 && cx < 64) { Case c = EngineZildo.getMapManagement().getCurrentMap().get_mapcase(cx, cy + 4); int onmap = EngineZildo.getMapManagement().getCurrentMap().readmap(cx, cy); ortho.drawText(px, py + 4, "" + c.getZ(), new Vector3f(0, 1, 0)); ortho.drawText(px, py, "" + onmap, new Vector3f(1, 0, 0)); } } } } }
public void renderFrame(boolean p_editor) { if (waitingScene != 0) { return; } // long t1 = ZUtils.getTime(); // Focus camera on player if (!p_editor && client.connected) { if (mapDisplay.getCurrentMap() != null) { mapDisplay.centerCamera(); } // Is Zildo talking with somebody ? guiDisplay.manageDialog(); } // long t2 = ZUtils.getTime(); // Tile engine Area[] maps = new Area[] {mapDisplay.getCurrentMap(), mapDisplay.getPreviousMap()}; tileEngine.updateTiles(mapDisplay.getCamera(), maps, mapDisplay.getCompteur_animation()); // long t3 = ZUtils.getTime(); spriteDisplay.updateSpritesClient(mapDisplay.getCamera()); // long t4 = ZUtils.getTime(); ClientEngineZildo.openGLGestion.beginScene(); // // DISPLAY //// spriteEngine.initRendering(); // Display BACKGROUND tiles if (mapDisplay.getForeBackController().isDisplayBackground()) { tileEngine.render(true); } // long t5 = ZUtils.getTime(); // Display BACKGROUND sprites if (spriteDisplay.foreBackController.isDisplayBackground()) { spriteEngine.render(true); } // long t6 = ZUtils.getTime(); // Display FOREGROUND tiles if (mapDisplay.getForeBackController().isDisplayForeground()) { tileEngine.render(false); } // long t7 = ZUtils.getTime(); if (!p_editor) { guiDisplay.draw(!client.connected); } // Display FOREGROUND sprites if (spriteDisplay.foreBackController.isDisplayForeground()) { spriteEngine.render(false); } // long t8 = ZUtils.getTime(); if (Zildo.infoDebug && !p_editor) { this.debug(); } if (client.isMultiplayer()) { // Does player want to see the scores ? (tab key pressed) boolean tabPressed = false; KeyboardInstant kbInstant = client.getKbInstant(); if (kbInstant != null) { tabPressed = (client.getKbInstant().isKeyDown(KeysConfiguration.PLAYERKEY_TAB)); } guiDisplay.setToDisplay_scores(tabPressed); } // long t9 = ZUtils.getTime(); // System.out.println("t2 = "+(t2-t1)+"ms t3="+(t3-t2)+"ms t4="+(t4-t3)+"ms t5="+(t5-t4)+"ms // t6="+(t6-t5)+"ms t7="+(t7-t6)+"ms t8="+(t8-t7)+"ms "+(t9-t8)); openGLGestion.endScene(); }