Beispiel #1
0
        public void Set(int w, int h)
        {
            GL.ClearColor(System.Drawing.Color.AliceBlue);
            GL.Enable(EnableCap.DepthTest);
            AppInfo.W    = w;
            AppInfo.H    = h;
            AppInfo.RW   = w;
            AppInfo.RH   = h;
            AppInfo.Full = false;
            AppInfo.App  = "GLApp";
            Import.Import.RegDefaults();

            GL.Viewport(0, 0, w, h);
            GL.Scissor(0, 0, w, h);
            GL.Disable(EnableCap.Blend);
            GL.Disable(EnableCap.Texture2D);
            GL.Enable(EnableCap.CullFace);
            GL.CullFace(CullFaceMode.Back);
            GL.Disable(EnableCap.StencilTest);
            GL.Disable(EnableCap.ScissorTest);
            GL.Enable(EnableCap.DepthTest);
            GL.DepthRange(0, 1);

            GL.ClearDepth(1.0f);
            GL.DepthFunc(DepthFunction.Less);
            // UI.UISys.ActiveUI.OnResize(Width, Height);
            VPen.SetProj(0, 0, w, h);
        }
Beispiel #2
0
 protected override void OnLoad(EventArgs e)
 {
     CursorVisible = true;
     VPen.SetProj(0, 0, Width, Height);
     SetGL();
     InitApp();
     PushState(InitState);
 }
Beispiel #3
0
 public void SetSize(int w, int h)
 {
     AppInfo.W  = w;
     AppInfo.H  = h;
     AppInfo.RW = w;
     AppInfo.RH = h;
     GL.Viewport(0, 0, w, h);
     GL.Scissor(0, 0, w, h);
     VPen.SetProj(0, 0, w, h);
 }
Beispiel #4
0
 protected override void OnLoad(EventArgs e)
 {
     CursorVisible = true;
     VPen.SetProj(0, 0, Width, Height);
 }
Beispiel #5
0
        public override void InitState()
        {
            Console.WriteLine("Loading logo tex.");
            LogoTex = new StarEngine.Texture.VTex2D("Data\\2D\\Logo\\DarkArtLogo.png", LoadMethod.Single);
            PresTex = new VTex2D("Data\\2D\\Logo\\Presents.png", LoadMethod.Single);
            GameTex = new VTex2D("Data\\2D\\Logo\\ArenaLogo.png", LoadMethod.Single);
            Console.WriteLine("Loaded.");

            ms = StarSoundSys.Play2DFile("Data\\Music\\Logo\\LogoTheme1.wav");

            VPen.SetProj(0, 0, StarApp.W, StarApp.H);

            bool AlphaUp()
            {
                LogoAlpha = LogoAlpha + 0.015f;
                if (LogoAlpha > 1.0f)
                {
                    return(true);
                }
                return(false);
            }

            int waitStart = 0;

            void WaitInit()
            {
                waitStart = Environment.TickCount;
            }

            bool WaitABit()
            {
                if (Environment.TickCount > waitStart + 2000)
                {
                    return(true);
                }
                return(false);
            }

            bool logoDone = false;

            bool AlphaDown()
            {
                LogoAlpha -= 0.01f;
                if (LogoAlpha < 0.0f)
                {
                    logoDone  = true;
                    LogoAlpha = 0.0f;
                    return(true);
                }
                return(false);
            }

            void TestDo()
            {
            }

            void DoPresent()
            {
                LogoAlpha   = 0.0f;
                PresentLogo = true;
            }

            void DoGame()
            {
                LogoAlpha = 0.0f;
                GameLogo  = true;
            }

            void Done()
            {
                ms.Stop();
                ToMenu = true;
            }

            Logics.Flow(null, AlphaUp);
            Logics.Flow(WaitInit, WaitABit);
            Logics.Flow(null, AlphaDown, DoPresent);
            Logics.Flow(null, AlphaUp);
            Logics.Flow(WaitInit, WaitABit);
            Logics.Flow(null, AlphaDown, DoGame);
            Logics.Flow(null, AlphaUp);
            Logics.Flow(WaitInit, WaitABit);
            Logics.Flow(null, AlphaDown, Done);


            bool StateDone()
            {
                return(logoDone);
            }

            void NextState()
            {
                ms.Stop();
                PresentLogo = true;
            }

            bool UnlessMusic()
            {
                return(ms.Playing);
            }

            Logics.When(StateDone, NextState, UnlessMusic);
        }