Exemple #1
0
        public TDEEditor(GameWindow mGameWindow)
        {
            TDGameWindow = mGameWindow;
            _drawEntities = new List<TDEEntity>();
            _elementSprites = new List<Sprite>();
            _common = new TDCommon(mGameWindow);

            _currentOutline = TDEOutlines.GetOutlines().First();
            _rectangleMode = true;

            OnUpdate += mFrameTime =>
                        {
                            UpdateSelector();
                            UpdateInfoText();
                        };
            AddDrawAction(DrawEntities);

            _previewSpriteCount = 14;
            for (var i = 0; i < _previewSpriteCount; i++) _elementSprites.Add(new Sprite());

            OnDrawAfterDefault += DrawGUI;
            OnDrawBeforeCamera += _common.GUI.DrawBackground;

            InitializeInputs();
        }
Exemple #2
0
        public Camera(GameWindow mGameWindow, int mWidth, int mHeight)
        {
            Debug.Assert(mGameWindow != null);

            _renderWindow = mGameWindow.RenderWindow;
            View = new View(new FloatRect(0, 0, mWidth, mHeight));
        }
Exemple #3
0
 public TDCommon(GameWindow mGameWindow)
 {
     _gameWindow = mGameWindow;
     _floorSprite = new Sprite(Assets.GetTexture(@"environment\floor\gray")) {Texture = {Repeated = true}};
     GUI = new TDGUI(mGameWindow.RenderWindow);
     SelectionSprite = new Sprite(Assets.GetTexture(@"selection"));
     GameTexture = new RenderTexture(1024, 768) {Smooth = true};
     GameSprite = new Sprite(GameTexture.Texture);
 }
Exemple #4
0
        public TDGGame(GameWindow mGameWindow)
        {
            _common = new TDCommon(mGameWindow);

            OnUpdate += mFrameTime => _common.UpdatePositions();
            OnDrawBeforeCamera += _common.GUI.DrawBackground;
            AddDrawAction(DrawEntities);
            OnDrawAfterDefault += DrawGUI;
            InitializeInputs();
        }
Exemple #5
0
        private static void Main(string[] args)
        {
            Settings.Framerate.IsLimited = false;
            Settings.Frametime.IsStatic = false;
            Settings.Framerate.Limit = 125;
            Settings.Frametime.StaticValue = 1.5f;

            var game = new SPGame();
            var window = new GameWindow(320, 240, 3);

            window.SetGame(game);
            window.Run();
        }
Exemple #6
0
        private static void Main()
        {
            Settings.Framerate.Limit = 60;
            Settings.Framerate.IsLimited = true;
            Settings.Frametime.IsStatic = false;
            Settings.Frametime.StaticValue = 1;

            var game = new BHGame();
            var gameWindow = new GameWindow(640, 480, 1);

            gameWindow.SetGame(game);
            gameWindow.Camera.Move(-new Vector2f(32, 16));
            gameWindow.Run();
        }
Exemple #7
0
        private static void Main()
        {
            Settings.Framerate.IsLimited = true;
            Settings.Framerate.Limit = 60;

            var gameWindow = new GameWindow(1024, 768, 1);
            var game = new TDGGame(gameWindow);
            var editor = new TDEEditor(gameWindow);

            game.Editor = editor;
            editor.Game = game;

            TDLFactory.Game = game;

            gameWindow.RenderWindow.Closed += (o, e) => Environment.Exit(0);
            gameWindow.SetGame(game);
            gameWindow.Run();
        }