public OrthographicCameraOpenTk(IAppNode entryPoint)
 {
     this.entryPoint_ = entryPoint;
     this.emitRender_ =
         this.entryPoint_
         .CompileEmit <RenderForOrthographicCameraTickEvent>();
 }
예제 #2
0
        public void EnterSceneIfScheduled(IAppNode root, IApp app)
        {
            if (this.pendingScene_ == null)
            {
                return;
            }

            app.Instantiator.NewChild(root, this.pendingScene_);
            root.CompileEmit <SceneInitTickEvent>()(new SceneInitTickEvent(app));
            this.pendingScene_ = null;
        }
예제 #3
0
        public void ExitSceneIfScheduled(IAppNode root)
        {
            if (this.pendingScene_ == null || this.currentNode_ == null)
            {
                return;
            }

            root.CompileEmit <SceneEndTickEvent>()(new SceneEndTickEvent());
            //this.currentNode_.Discard();
            this.currentNode_ = null;
        }
예제 #4
0
                    AddOrthographicCamera(IAppNode entryPoint)
                    {
                        var camera = new OrthographicCameraOpenTk(entryPoint)
                        {
                            Left   = 0,
                            Right  = this.boundingBox_.Dimensions.Width,
                            Bottom = this.boundingBox_.Dimensions.Height,
                            Top    = 0,
                            Near   = -1,
                            Far    = 1000
                        };

                        this.cameras_.Add(camera);
                        return(camera);
                    }
예제 #5
0
        public AppOpenTk()
        {
            new DiscardableNodeFactoryImpl(
                root => this.rootDiscardableNode_ = root);

            this.Audio          = new AudioOpenTk(this.rootDiscardableNode_);
            this.Instantiator   = new InstantiatorImpl(this.rootDiscardableNode_);
            this.windowManager_ =
                new WindowManagerOpenTk(this, this.rootDiscardableNode_);

            this.root_ = this.Instantiator.NewRoot();

            var settings = Settings.Load();

            this.ticker_ =
                RecurrentCaller.FromFrequency(settings.Framerate,
                                              this.CompileTick_());
        }
예제 #6
0
        private void InstantiatePlayer_(IApp app, IAppNode viewRoot)
        {
            var instantiator = app.Instantiator;

            var gamepad   = app.Input.Controller;
            var rigidbody = new Rigidbody {
                Position      = (LevelConstants.SIZE * 10, LevelConstants.SIZE * 13),
                YAcceleration = PlayerConstants.GRAVITY,
                MaxYSpeed     = float.MaxValue,
            };
            var playerRigidbody = new PlayerRigidbody {
                Rigidbody = rigidbody,
            };

            var playerStateMachine = new PlayerStateMachine {
                State = PlayerState.STANDING,
            };

            var playerSounds =
                new PlayerSoundsComponent(app.Audio,
                                          rigidbody,
                                          playerStateMachine);
            var player = new PlayerComponent(gamepad,
                                             playerRigidbody,
                                             playerSounds,
                                             playerStateMachine);
            var itemSwitcher = new ItemSwitcherComponent(gamepad,
                                                         playerRigidbody,
                                                         playerSounds,
                                                         playerStateMachine);
            var vectorRenderer =
                new PlayerVectorRendererComponent(playerRigidbody,
                                                  playerStateMachine);

            instantiator.NewChild(viewRoot,
                                  player,
                                  playerSounds,
                                  itemSwitcher,
                                  vectorRenderer);
        }
예제 #7
0
 public void SetParent(IAppNode parent)
 => this.SetParent_(Expect.That(parent).AsA <AppNodeImpl>());