Exemplo n.º 1
0
        public static void Main()
        {
            //Start the audio system so sound can be played
            SwinGame.OpenAudio();
            //Open the game window
            SwinGame.OpenGraphicsWindow("GameMain", 800, 600);
            SwinGame.ShowSwinGameSplashScreen();
            StateHandler _statehandler = new StateHandler ();
            ObjectsHandler _objecthandler = new ObjectsHandler (_statehandler);
            Input_Handler _inputhandler = new Input_Handler(_statehandler,_objecthandler);
            GraphicsHandler _graphicshandler = new GraphicsHandler (_statehandler,_objecthandler);

            //Run the game loop
            while(false == SwinGame.WindowCloseRequested())
            {
                //Fetch the next batch of UI interaction
                SwinGame.ProcessEvents();
                //Clear the screen and draw the framerate
                SwinGame.ClearScreen(Color.Black);
                _graphicshandler.Run ();
                _inputhandler.Run ();
                _statehandler.Run ();
                _objecthandler.Run ();

                SwinGame.DrawFramerate(0,0);
                //Draw onto the screen
                SwinGame.RefreshScreen();
                System.Threading.Thread.Sleep (2);
            }
            //End the audio
            SwinGame.CloseAudio();

            //Close any resources we were using
            SwinGame.ReleaseAllResources();
        }
Exemplo n.º 2
0
        public void TestCaseCharPosReset()
        {
            // test that character starts in default position after the level resets
            StateHandler sh = new StateHandler ();
            ObjectsHandler oh = new ObjectsHandler (sh);
            Input_Handler ih = new Input_Handler(sh,oh);

            Character c = oh.LevelCharacter;
            c.Xpos = 150;
            c.Ypos = 250;

            ih.ResetCharacter ();

            // check that is at defualt pos
            Assert.IsTrue (c.Xpos == 110);
            Assert.IsTrue (c.Ypos == 552);
            Assert.IsTrue (sh.Gamestate == GameState.Menu);
            Assert.IsTrue (sh.Characterstate == CharacterState.Standing);
        }