Beispiel #1
0
        //------------------------------------------------------------------------------------------
        //------------------------------------------------------------------------------------------
        protected override void Startup()
        {
            Demo that = this;

            /*initial libraries*/
            this.Engine.Library.LoadLibrary("/Data/JSON/mech.json").Finished.Subscribe(MechLibraryComplete, false);
            this.Engine.Library.LoadLibrary("/Data/JSON/scene.json").Finished.Subscribe(InitLibraryComplete, false);

            //this.Engine.Graphics.Camera.Rotate((float) (Math.PI) + 0.5f, new Vector3(new float[] { 0.0f, 1.0f, 0.0f }));
            //this.Engine.Graphics.Camera.Translate(new Vector3(new float[] { 0.0f, 25.0f, 0.0f }));
            //this.Engine.Graphics.Camera.RotateY((float) (Math.PI / 2));
            //this.Engine.Graphics.Camera.RotateX(-0.5f);

            /*register update function*/
            this._updateHandle = SystemCore.Timer.Start(delegate { that.Update(); }, 1000 / 20, true);

            /*change view occluder to a faster region occluder*/
            this.Engine.Graphics.ViewOccluder = new RegionOccluder(25, 20);

            /*add post process effects*/
            this.Engine.Graphics.QueuePostProcess(this._bloomEffect = new BloomEffect());
            this.Engine.Graphics.QueuePostProcess(this._ssaoEffect = new SsaoEffect());
            this.Engine.Graphics.QueuePostProcess(this._depthEffect = new DepthEffect());
            this.Engine.Graphics.QueuePostProcess(this._motionEffect = new MotionBlurEffect());
        }
Beispiel #2
0
        //------------------------------------------------------------------------------------------
        //------------------------------------------------------------------------------------------
        protected override void Startup()
        {
            this.Engine.Library.LoadLibrary("/Data/Lib/test.dae.lib");

            /*register update function*/
            this._updateHandle = SystemCore.Timer.Start(this.Update, 1000 / 20, true);
        }
Beispiel #3
0
 //------------------------------------------------------------------------------------------
 //------------------------------------------------------------------------------------------
 public void Stop(TimerHandle handle)
 {
     if(handle.Repeat) {
         Window.ClearInterval(handle.Id);
     } else {
         Window.ClearTimeout(handle.Id);
     }
 }
Beispiel #4
0
        //------------------------------------------------------------------------------------------
        //------------------------------------------------------------------------------------------
        public TimerHandle Start(Action action, int interval, bool repeat)
        {
            TimerHandle ret = new TimerHandle();
            ret.Repeat = repeat;

            if(repeat) {
                ret.Id = Window.SetInterval(action, interval);
            } else {
                ret.Id = Window.SetTimeout(action, interval);
            }

            return ret;
        }
Beispiel #5
0
        //------------------------------------------------------------------------------------------
        //------------------------------------------------------------------------------------------
        public void Run()
        {
            this.InitDebug();

            if (this.ActiveGame == null)
                throw new Exception("No active game defined.");

            Engine that = this;

            /*render cycle*/
            SystemCore.Timer.RequestAnimationFrame(delegate { that.Graphics.Render(); });
            this._cleanuphandle = SystemCore.Timer.Start(delegate { that.Library.Update(); }, 60000, true);
            this._updateHandle = SystemCore.Timer.Start(delegate { that.Update(); }, 1000 / 24, true);

            /*initialize graphics*/
            this.Graphics.Initialize(45, 0.1f, 200.0f);
            this.Graphics.ViewOccluder = new ViewFrustrumOccluder();

            /*initialize game*/
            this.ActiveGame.Initialize();

            /*initialize collision*/
            this._b2World = new B2World(new B2Vec2(0.0f, 0.0f), true);
        }