Пример #1
0
        /// <summary>
        /// Setup Console and battle engine
        /// </summary>
        private static void Init()
        {
            Console.TreatControlCAsInput = false;
            Console.CancelKeyPress += CtrlCHandler;
            Console.CursorVisible = false;
            Console.Title = "Sharp Robots";

            // Change the console size
            Console.WindowWidth = ScreenWidth;
            Console.WindowHeight = ScreenHeight;

            _battleEngine = new BattleEngine();

            // Determine proper scaling ratio from the robots world coordinates to the screen coordinates
            // Screen width  80 / Battle Field width  1000 = 0.08
            // Screen height 24 / Battle Field height 1000 = 0.024
            _scaleX = (double)ArenaWidth / Arena.ArenaWidth;
            _scaleY = (double)ArenaHeight / Arena.ArenaHeight;

            // Render the right Wall
            for (int y = 0; y < ArenaHeight; y++)
            {
                Console.SetCursorPosition(ArenaWidth, y);
                Console.Write("|");
            }
        }
Пример #2
0
 /// <summary>
 /// 
 /// </summary>
 public SharpRobotsGame()
 {
     _graphics = new GraphicsDeviceManager(this);
     _battleEngine = new BattleEngine();
     Content.RootDirectory = "Content";
     _graphics.PreferredBackBufferWidth = _currentWidth;
     _graphics.PreferredBackBufferHeight = _currentHeight;
 }
Пример #3
0
        /// <summary>
        /// 
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            _gameEventTimer = new Timer {Interval = 35, Enabled = true};
            _gameEventTimer.Tick += NextGameFrame;
            _battleEngine = new BattleEngine();

            Init();
        }