public virtual void Dispose() { if (this.isActiveScene()) { Scene.setActiveScene(null); } foreach (Entity entity in this.getEntities()) { entity.Dispose(); } foreach (Model m in this.getModels()) { m.Dispose(); } foreach (Light l in this.getLights()) { l.Dispose(); } foreach (GUI gui in GUI.getGUIs()) { if (gui == null || gui.getScene() == null) { continue; } if (!gui.getScene().Equals(this)) { continue; } gui.Dispose(); } ENTITIES = null; MODELS = null; LIGHTS = null; }
public void start() { this.logger.log(this.getName() + " v" + this.getVersion() + " Started."); //Create User Dir try { if (!Directory.Exists(getFilePath())) { Directory.CreateDirectory(getFilePath()); } } catch (Exception e) { } this.getDisplayManager().init(); this.mainThread = Thread.CurrentThread; this.gameThread.Start(); this.gameRunning = true; Scene.setActiveScene(new InitialScene()); while (this.gameRunning) { for (int pd = 0; pd < this.gamePadData.Length; pd++) { try { gamePadData[pd] = GamePad.GetData(pd); } catch (Exception ex) { } } for (int td = 0; td < this.touchData.Length; td++) { try { List <TouchData> tdata = Touch.GetData(td); lock (tdata) { this.touchData[td] = new List <TouchData>(tdata); } } catch (Exception ex) {} } try { SystemEvents.CheckEvents(); } catch (Exception ex) { this.gameRunning = false; this.Dispose(); break; } if (debug) { if (isButtonDown(GamePadButtons.Select)) { this.Dispose(); break; } } getDisplayManager().render(); renderDone = true; } this.Dispose(); }