Exemplo n.º 1
0
        public void RenderApplication(DoomApplication app)
        {
            if (app.State == ApplicationState.Opening)
            {
                openingSequence.Render(app.Opening);
            }
            else if (app.State == ApplicationState.DemoPlayback)
            {
                RenderGame(app.DemoPlayback.Game);
            }
            else if (app.State == ApplicationState.Game)
            {
                RenderGame(app.Game);
            }

            if (!app.Menu.Active)
            {
                if (app.State == ApplicationState.Game &&
                    app.Game.State == GameState.Level &&
                    app.Game.Paused)
                {
                    var scale = screen.Width / 320;
                    screen.DrawPatch(
                        pause,
                        (screen.Width - scale * pause.Width) / 2,
                        4 * scale,
                        scale);
                }
            }
        }
Exemplo n.º 2
0
        public void RenderApplication(DoomApplication app)
        {
            //var watch = System.Diagnostics.Stopwatch.StartNew();
            if (app.State == ApplicationState.Opening)
            {
                openingSequence.Render(app.Opening);
            }
            else if (app.State == ApplicationState.DemoPlayback)
            {
                RenderGame(app.DemoPlayback.Game);
            }
            else if (app.State == ApplicationState.Game)
            {
                RenderGame(app.Game);
            }
            //Console.WriteLine("RenderApplication 1st part: {0} s", (float)(watch.ElapsedMilliseconds) / 1000);
            //watch.Restart();

            if (!app.Menu.Active)
            {
                if (app.State == ApplicationState.Game &&
                    app.Game.State == GameState.Level &&
                    app.Game.Paused)
                {
                    var scale = screen.Width / 320;
                    screen.DrawPatch(
                        pause,
                        (screen.Width - scale * pause.Width) / 2,
                        4 * scale,
                        scale);
                }
            }
            //Console.WriteLine("RenderApplication 2nd part: {0} s", (float)(watch.ElapsedMilliseconds) / 1000);
            //watch.Restart();
        }
Exemplo n.º 3
0
        public void Render(DoomApplication app)
        {
            if (app.State == ApplicationState.Opening)
            {
                openingSequence.Render(app.Opening);
            }
            else if (app.State == ApplicationState.Game)
            {
                RenderGame(app.Game);
            }

            if (app.Menu.Active)
            {
                menu.Render(app.Menu);
            }

            var screenData = screen.Data;
            var p          = MemoryMarshal.Cast <byte, uint>(sfmlTextureData);

            for (var i = 0; i < p.Length; i++)
            {
                p[i] = colors[screenData[i]];
            }

            sfmlTexture.Update(sfmlTextureData, (uint)screen.Height, (uint)screen.Width, 0, 0);

            sfmlWindow.Draw(sfmlSprite, sfmlStates);

            sfmlWindow.Display();
        }