@Override public boolean dispatchKeyEvent(KeyEvent e) { if (!super.dispatchKeyEvent(e)) { int code = e.getKeyCode(); float t_g = tickTimer.getTime(); if (MORE_KEYS) { if (code == KeyEvent.VK_F2) { // F2 pressed ? scene.getRez().toggle(); // toggle on/off REZ } else if (code == KeyEvent.VK_F3) { // F3 pressed ? scene.getParticles().toggle(); // toggle on/off particles } else if (code == KeyEvent.VK_F4) { // F4 pressed ? scene.getGlenz().toggle(); // toggle on/off glenz } else if (code == KeyEvent.VK_F5) { // F5 pressed ? scene.getLiner().toggle(); // toggle on/off liner } else if (code == KeyEvent.VK_F6) { // F6 pressed ? scene.getTitle().toggle(); // toggle on/off title } else if (code == KeyEvent.VK_F7) { // F7 pressed ? scene.getMapping().toggle(); // toggle on/off mapping scene.getMapping().setSynchroTime(t_g); } else if (code == KeyEvent.VK_SPACE) { // space pressed ? scene.getCube().setJumpAngle(0.0f); scene.getCube().setJump(0.5f); scene.getCube().setSynchroTime(t_g); f_n = 0.25f; f_v2 = f_n; f_t2 = t_g; } else if (code == KeyEvent.VK_ENTER) { // return pressed ? scene.getJump().setEnabled(true); // move cube and title f_n = 0.5f; f_v1 = f_n; f_t1 = t_g; scene.getCube().setPosY(-3.85f); scene.getJump().setJumpY(3.85f); scene.getJump().setSynchroTime(t_g); } else if (code == KeyEvent.VK_TAB) { // tab pressed ? Zoom zoom = scene.getZoom(); zoom.setEnabled(true); // move scene zoom.setZoom(10.0f); zoom.setMainAngle(0.0f); zoom.setSynchroTime(t_g); } else { return false; } } } return true; }
@Override protected void drawGLScene() { float t_g = tickTimer.getTime(); // synchro if (isSoundEnabled()) { modPlayer.stream(); // System.out.println(modPlayer); int ord = modPlayer.getOrd(); int row = modPlayer.getRow(); if (row == 0 || firstDraw) { firstDraw = false; switch (ord) { case 0: if (!scene.getMapping().isEnabled()) { scene.getMapping().setSynchroTime(t_g); scene.getMapping().setEnabled(true); } break; case 1: scene.getLiner().setEnabled(true); break; case 2: scene.getGlenz().setEnabled(true); boolean jumpEnabled = scene.getJump().isEnabled(); scene.getRez().setEnabled(jumpEnabled); scene.getParticles().setEnabled(false); scene.getLiner().setEnabled(false); scene.getTitle().setEnabled(true); if (!scene.getZoom().isEnabled()) { scene.getZoom().setSynchroTime(t_g); scene.getZoom().setEnabled(true); } break; case 4: scene.getRez().setEnabled(true); scene.getParticles().setEnabled(true); scene.getLiner().setEnabled(true); if (!scene.getJump().isEnabled()) { scene.getJump().setSynchroTime(t_g); scene.getJump().setEnabled(true); } scene.getLiner().setTxtCredits(); break; case 6: scene.getRez().setEnabled(false); scene.getGlenz().setEnabled(false); scene.getLiner().setTxtLoop(); break; } } if (row % 8 == 0) { f_n = 0.25f; f_v2 = f_n; f_t2 = t_g; } if (row == 0) { f_n = 0.5f; f_v1 = f_n; f_t1 = t_g; f_v2 = 0; } if ((((row % 8 - 4) == 0) || (row == 60) || (row == 62)) && (ord > 1)) { scene.getCube().setJumpAngle(0.0f); scene.getCube().setJump(0.5f); scene.getCube().setSynchroTime(t_g); } } Color f_c = ColorUtils.safe(f_v1 + f_v2, f_v1 + f_v2, f_v1 + f_v2, 1.0f); // fog color if (f_v1 > 0) { f_v1 = (float) (f_n - f_n * 2.0 * (t_g - f_t1)); } if (f_v2 > 0) { f_v2 = (float) (f_n - f_n * 2.0 * (t_g - f_t2)); } // 3d mode scene.init3D(); scene.draw(f_c, t_g); }