/** * Should be called after {@link #initializeServer} * * @param p_awt TRUE=ZEditor / FALSE=game */ public void initializeClient(boolean p_awt) { editing = p_awt; Zildo.pdPlugin.init(editing); openGLGestion = Zildo.pdPlugin.openGLGestion; openGLGestion.init(); screenConstant = new ScreenConstant(Zildo.viewPortX, Zildo.viewPortY); filterCommand = new FilterCommand(); if (!p_awt) { // No sound in ZEditor soundEngine = Zildo.pdPlugin.soundEngine; soundPlay = new SoundPlay(soundEngine); } ortho = Zildo.pdPlugin.ortho; if (!p_awt) { Zildo.pdPlugin.initFilters(); filterCommand.addDefaultFilters(); } pixelShaders = Zildo.pdPlugin.pixelShaders; if (pixelShaders.canDoPixelShader()) { pixelShaders.preparePixelShader(); } spriteEngine = Zildo.pdPlugin.spriteEngine; tileEngine = Zildo.pdPlugin.tileEngine; spriteDisplay = new SpriteDisplay(spriteEngine); mapDisplay = new MapDisplay(null); guiDisplay = new GUIDisplay(); spriteEngine.init(spriteDisplay); // GUI guiDisplay.setToDisplay_generalGui(false); ortho.setOrthographicProjection(false); }
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)); } } } } }