public Form1()
        {
            _fastLoop = new FastLoop(GameLoop);

            InitializeComponent();
            _openGLControl.InitializeContexts();

            // Initialize DevIL
            Il.ilInit();
            Ilu.iluInit();
            Ilut.ilutInit();
            Ilut.ilutRenderer(Ilut.ILUT_OPENGL);

            // Load textures
            _textureManager.LoadTexture("face", "face.tif");
            _textureManager.LoadTexture("face_alpha", "face_alpha.tif");

            if (_fullscreen)
            {
                FormBorderStyle = FormBorderStyle.None;
                WindowState     = FormWindowState.Maximized;
            }
            else
            {
                ClientSize = new Size(1280, 720);
            }

            // Initialize states
            _system.AddState("splash", new SplashScreenState(_system));
            _system.AddState("title_menu", new TitleMenuState());
            _system.AddState("sprite_test", new DrawSpriteState(_textureManager));
            _system.AddState("sprite_class_test", new TestSpriteClassState(_textureManager));

            _system.ChangeState("sprite_class_test");
        }
        public void TestChangeStates()
        {
            StateSystem stateSystem = new StateSystem();
            MockState   mock1       = new MockState();
            MockState   mock2       = new MockState();

            stateSystem.AddState("mock1", mock1);
            stateSystem.AddState("mock2", mock2);
            stateSystem.ChangeState("mock1");
            stateSystem.ChangeState("mock2");
            stateSystem.Render();
            // State wasn't changed to mock so it shouldn't be
            // rendered.
            Assert.IsFalse(mock1.HasRenderBeenCalled);
            Assert.IsTrue(mock2.HasRenderBeenCalled);
        }
示例#3
0
 public void Update(double elapsedTime)
 {
     _delayInSeconds -= elapsedTime;
     if (_delayInSeconds <= 0)
     {
         _delayInSeconds = 3;
         _system.ChangeState("title_menu");
     }
 }
        public void TestProcessSelectedState()
        {
            StateSystem stateSystem = new StateSystem();
            MockState   mock        = new MockState();

            stateSystem.AddState("mock", mock);
            stateSystem.ChangeState("mock");
            stateSystem.Update(0);
            Assert.IsTrue(mock.HasProcessBeenCalled);
        }
 public void TestRenderSelectedState()
 {
     StateSystem stateSystem = new StateSystem();
     MockState mock = new MockState();
     stateSystem.AddState("mock", mock);
     stateSystem.ChangeState("mock");
     stateSystem.Render();
     // State wasn't changed to mock so it shouldn't be 
     // rendered.
     Assert.IsTrue(mock.HasRenderBeenCalled);
 }
        public void TestRenderSelectedState()
        {
            StateSystem stateSystem = new StateSystem();
            MockState   mock        = new MockState();

            stateSystem.AddState("mock", mock);
            stateSystem.ChangeState("mock");
            stateSystem.Render();
            // State wasn't changed to mock so it shouldn't be
            // rendered.
            Assert.IsTrue(mock.HasRenderBeenCalled);
        }
 public void TestProcessSelectedState()
 {
     StateSystem stateSystem = new StateSystem();
     MockState mock = new MockState();
     stateSystem.AddState("mock", mock);
     stateSystem.ChangeState("mock");
     stateSystem.Update(0);
     Assert.IsTrue(mock.HasProcessBeenCalled);
 }
 public void TestChangeStates()
 {
     StateSystem stateSystem = new StateSystem();
     MockState mock1 = new MockState();
     MockState mock2 = new MockState();
     stateSystem.AddState("mock1", mock1);
     stateSystem.AddState("mock2", mock2);
     stateSystem.ChangeState("mock1");
     stateSystem.ChangeState("mock2");
     stateSystem.Render();
     // State wasn't changed to mock so it shouldn't be 
     // rendered.
     Assert.IsFalse(mock1.HasRenderBeenCalled);
     Assert.IsTrue(mock2.HasRenderBeenCalled);
 }