Exemplo n.º 1
0
        static void Main()
        {
            //--------------------------initializing dxlib--------------------------
            DX.ChangeWindowMode(DX.TRUE);


            DX.SetWindowSizeChangeEnableFlag(DX.TRUE, DX.TRUE);
            DX.SetMainWindowText("");
            DX.SetGraphMode(1600, 900, 32);
            //  DX.SetWindowSizeExtendRate(0.9);
            DX.SetWindowInitPosition(-8, 0);

            if (DX.DxLib_Init() == -1)
            {
                return;
            }
            DX.SetDrawScreen(DX.DX_SCREEN_BACK);
            //++++++++++++++++++++++++++initialized dxlib++++++++++++++++++++++++++++
            var   startscene = new StartScene();
            var   gamescene  = new GameScene();
            var   endscene   = new EndScene();
            Scene scene      = startscene;

            scene.wholeInit();
            while (DX.ScreenFlip() == 0 && DX.ProcessMessage() == 0 && DX.ClearDrawScreen() == 0)
            {
                //-----------------------------mainloop---------------------------
                BasicInput.update();
                scene.wholeUpdate();
                DX.ClearDrawScreen();
                scene.draw();
                if (scene != scene.NextScene)
                {
                    //fade-in
                    for (int i = 255; i >= 0; i -= 20)
                    {
                        DX.SetDrawScreen(DX.DX_SCREEN_BACK);
                        DX.SetDrawBright(i, i, i);
                        scene.draw();
                        DX.ScreenFlip();
                    }
                    //fade-out
                    for (int i = 0; i <= 260; i += 20)
                    {
                        DX.SetDrawScreen(DX.DX_SCREEN_BACK);
                        DX.SetDrawBright(i, i, i);
                        scene.NextScene.draw();
                        DX.ScreenFlip();
                    }
                }
                scene = scene.NextScene;
                //+++++++++++++++++++++++++++++++mainloop+++++++++++++++++++++++++
            }
            DX.DxLib_End();
        }
Exemplo n.º 2
0
        public override void init()
        {
            Time = 0;
            var back = new Graphic();

            back.GraphName  = "resource/img/startback.png";
            click           = new Graphic();
            click.GraphName = "resource/img/click.png";
            click.top       = new Vector2(400, 550);
            var gamescene = new GameScene();
            var endscene  = new EndScene();

            GameScene.instance.wholeInit();
        }