public ScenariosComponent(SandboxGame game, PenumbraComponent penumbra, PenumbraControllerComponent penumbraController, PythonInterpreter interpreter)
     : base(game)
 {
     _penumbra = penumbra;
     _penumbraController = penumbraController;
     _interpreter = interpreter;
 }
예제 #2
0
        public SandboxGame()
        {
            _deviceManager = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            _penumbra = new PenumbraComponent(this, Transforms.OriginCenter_XRight_YUp | Transforms.Custom)
            {
                AmbientColor = Color.Black
            };
            Components.Add(_penumbra);
            _penumbraController = new PenumbraControllerComponent(this, _penumbra);
            Components.Add(_penumbraController);
            _scenarios = new ScenariosComponent(this, _penumbra, _penumbraController, _consoleInterpreter);
            Components.Add(_scenarios);
            var ui = new UIComponent(this, _penumbraController)
            {
                DrawOrder = int.MaxValue
            };
            Components.Add(ui);
            _camera = new CameraMovementComponent(this, _penumbra);
            Components.Add(_camera);
            Components.Add(new FpsGarbageComponent(this));
            _console = new ConsoleComponent(this);
            Components.Add(_console);

            // There's a bug when trying to change resolution during window resize.
            // https://github.com/mono/MonoGame/issues/3572
            _deviceManager.PreferredBackBufferWidth = 1280;
            _deviceManager.PreferredBackBufferHeight = 720;
            Window.AllowUserResizing = false;
            IsMouseVisible = true;
        }
예제 #3
0
        public UIComponent(SandboxGame game, PenumbraControllerComponent penumbraController)
            : base(game)
        {
            _penumbraController = penumbraController;
            _scenarios = game.Scenarios;

            penumbraController.ShadowTypeChanged += (s, e) => SetShadowTypeInfo();
            SetShadowTypeInfo();

            Enabled = false;
            Visible = true;
        }
        public PlatformerGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            #if WINDOWS_PHONE
            TargetElapsedTime = TimeSpan.FromTicks(333333);
            #endif

            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;
            graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
            IsMouseVisible = true;

            Accelerometer.Initialize();

            Penumbra = new PenumbraComponent(this)
            {
                AmbientColor = new Color(30, 20, 10),
                Visible = true,
                Debug = false
            };

            penumbraController = new PenumbraControllerComponent(this, Penumbra);
            Components.Add(penumbraController);

            Console = new ConsoleComponent(this);
            Components.Add(Console);
        }