Beispiel #1
0
        private EntityGame(Game game, GraphicsDeviceManager g, SpriteBatch spriteBatch, Rectangle viewport)
        {
            Game = game;
            Game.Exiting += (sender, args) => Exit();

            SpriteBatch = spriteBatch;
            Viewport = viewport;
            Assets.LoadConent(game);

            //Inject debug info into active state
            StateChanged += state => LastID = 1;
            StateChanged += state => _debugInfo = new DebugInfo(state, "DebugInfo");
            StateChanged += state => ActiveCamera = new Camera(state, "EntityEngineDefaultCamera");

            Log = new Log();
            Process p = Process.GetCurrentProcess();
            _ramCounter = new PerformanceCounter("Process", "Working Set", p.ProcessName);
            _cpuCounter = new PerformanceCounter("Process", "% Processor Time", p.ProcessName);

            MakeWindow(g, viewport);
        }
Beispiel #2
0
        private EntityGame(Game game, SpriteBatch spriteBatch)
        {
            Game = game;
            Game.Exiting += (sender, args) => Exit();

            SpriteBatch = spriteBatch;
            Assets.LoadConent(game);

            //Inject debug info into active state
            StateChanged += state => LastID = 1;
            StateChanged += state => _debugInfo = new DebugInfo(state, "DebugInfo");
            StateChanged += state => ActiveCamera = new Camera(state, "EntityEngineDefaultCamera");

            Log = new Log();

            //Start counters

            Process p = Process.GetCurrentProcess();
            _ramCounter = new PerformanceCounter("Process", "Working Set", p.ProcessName);
            _cpuCounter = new PerformanceCounter("Process", "% Processor Time", p.ProcessName);
        }
Beispiel #3
0
        public void Destroy(IComponent sender = null)
        {
            Game = null;
            GameTime = null;
            ActiveCamera = null;
            Log.Dispose();

            if (DestroyEvent != null)
                DestroyEvent(this);
        }
Beispiel #4
0
 public static void StartDrawing(Camera camera)
 {
     SpriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, SamplerState.PointClamp,
                       DepthStencilState.None, RasterizerState.CullNone, null, camera.Transform);
 }
 public override void Destroy(IComponent sender = null)
 {
     base.Destroy(sender);
     Camera c = new Camera(this, "Camera");
     c.View();
 }
            public CameraController(State stateref, string name)
                : base(stateref, name)
            {
                _up = new DoubleInput(this, "Up", Keys.Up, Buttons.DPadUp, PlayerIndex.One);
                _down = new DoubleInput(this, "Down", Keys.Down, Buttons.DPadDown, PlayerIndex.One);
                _left = new DoubleInput(this, "Left", Keys.Left, Buttons.DPadLeft, PlayerIndex.One);
                _right = new DoubleInput(this, "Right", Keys.Right, Buttons.DPadRight, PlayerIndex.One);
                _zoomIn = new DoubleInput(this, "ZoomIn", Keys.W, Buttons.LeftShoulder, PlayerIndex.One);
                _zoomOut = new DoubleInput(this, "ZoomOut", Keys.S, Buttons.LeftTrigger, PlayerIndex.One);
                _rotateLeft = new DoubleInput(this, "RotateLeft", Keys.A, Buttons.LeftShoulder, PlayerIndex.One);
                _rotateRight = new DoubleInput(this, "RotateRight", Keys.D, Buttons.RightShoulder, PlayerIndex.One);

                _camera = new Camera(this, "Camera");
                _camera.View();
            }