コード例 #1
0
        public void TestInitNegativeWidth()
        {
            int testHeight = 30;
            int testWidth  = -5;

            testRenderer.Init(testWidth, testHeight);
        }
コード例 #2
0
        [STAThread]         /// required to read user input multiple keys at a time
        static void Main(string[] args)
        {
            // Displays a loading message for user
            Console.Write("Loading");
            System.Threading.Thread.Sleep(100);

            // Setup console for a game
            NativeFunctions.InitializeConsole();                /// sets up console for use (no clicks, no arrow keys, etc)
            Console.TreatControlCAsInput = true;                /// prevents keyboard inturrupts, only reads input


            // Initialize engine classes
            ConsoleRenderer.Init();
            Input.Init();
            Time.Init();
            Runesole.Engine.Random.Init();

            // Game Setup
            SpriteManager.GenerateSprites();            /// generates sprites
            WorldBlock.Init();                          /// generates world blocks
            GameManager.Start();                        /// starts the game logic
            GameObject.__CallStartEvent();              /// calls start event on all gameobjects
            Console.Clear();                            /// clears the screen once everything is loaded

            mainLoopStarted = true;                     /// sets main loop started "flag" to true

            // while loop for each frame
            while (true)
            {
                // updates engine classes
                Time.Update();
                Input.Update();
                ConsoleRenderer.Update();

                // core game
                GameObject.__CallUpdateEvent();                                 /// Preforms game logic on gameobjects
                GameManager.Update();                                           /// updates game logic
                CoroutineManager.Update();                                      /// updates coroutine logic
                GameManager.world.Draw(GameManager.camera);                     /// draws the world
                GameObject.__DrawGameObjects(GameManager.camera);               /// draws game objects
                UI.Draw();                                                      ///	draws UI
                ConsoleRenderer.Render();                                       /// renders everything (UI & world) to console

                // updates engine classes end of frame
                GameManager.LateUpdate();
                Input.LateUpdate();
                Time.LateUpdate();

                // Add and destroy any gameobjects at end of frame
                GameObject.__AddGameObjects();
                GameObject.__DestroyGameObjects();
            }
        }