예제 #1
0
        public static void CreateEngine()
        {
            // The pipeline processors for our application.
            // These are responsible for consuming frames
            // created by the engine class.
            events    = new EventPipeline();
            physics   = new PhysicsPipeline();
            animation = new AnimationPipeline();
            rendering = new RenderPipeline();

            events.Subscribe <QuitEvent>(OnQuit);

            var actions = new Action <FrameState>[]
            {
                events.ProcessFrame,
                physics.ProcessFrame,
                animation.ProcessFrame,
                rendering.ProcessFrame
            };

            inputStates = new InputStateContainer();
            events.Subscribe <InputDeviceEvent>(inputStates.HandleInput);

            var sequence = new SequentialPipeline(actions);

            // create our engine.
            engine           = new Engine();
            engine.action    = events.ProcessFrame;
            engine.generator = new FrameGenerator();
        }
예제 #2
0
        public static void SetupPipelines()
        {
            Application.events = new EventPipeline();

            var actions = new Action <FrameState>[]
            {
                Application.events.ProcessFrame,
                Tick
            };

            Application.events.Subscribe <QuitEvent>(Application.OnQuit);

            var sequence = new SequentialPipeline(actions);

            Application.engine.action = sequence.ProcessFrame;

            Application.inputStates = new InputStateContainer();
            Application.events.Subscribe <InputDeviceEvent>(Application.inputStates.HandleInput);
        }