Beispiel #1
0
        internal void Frame(int RenderMultiplier, SpeccyScreen Screen, Graphics G)
        {
            sw.Restart();

            if (clear)
            {
                Screen.Clear(fg, bg);
            }

            Update();

            foreach (var spr in sprites)
            {
                spr.Render(Screen);
            }

            if (RenderMultiplier == 1)
            {
                Screen.Render(G);
            }
            else
            {
                Screen.Render(Screen.Width * 8 * RenderMultiplier, Screen.Height * 8 * RenderMultiplier, G);
            }

            sw.Stop();

            if (sw.ElapsedMilliseconds < delay)
            {
                Thread.Sleep(delay - (int)sw.ElapsedMilliseconds);
            }
        }
Beispiel #2
0
        public Speccy(int ScreenWidth, int ScreenHeight, int RenderMultiplier, Control RenderTarget)
        {
            c = RenderTarget;

            RenderTarget.GetType().InvokeMember("SetStyle",
                                                BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance,
                                                null, RenderTarget,
                                                new object[] { ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true });

            RenderTarget.ClientSize = new Size(ScreenWidth * 8 * RenderMultiplier, ScreenHeight * 8 * RenderMultiplier);

            g      = RenderTarget.CreateGraphics();
            screen = new SpeccyScreen(ScreenWidth, ScreenHeight, g);
            mult   = Math.Max(1, RenderMultiplier);
        }
Beispiel #3
0
        public void Dispose()
        {
            Stop();

            SetScene(null);

            if (screen != null)
            {
                screen.Dispose();
                screen = null;
            }

            if (g != null)
            {
                g.Dispose();
                g = null;
            }
        }
Beispiel #4
0
        public override void Render(SpeccyScreen Screen)
        {
            if (Flash)
            {
                flashCount++;
                if (flashCount >= FlashInterval)
                {
                    flashCount = 0;
                    invert     = !invert;
                }
            }
            else
            {
                invert     = false;
                flashCount = 0;
            }

            if (!Visible)
            {
                return;
            }

            if (0 <= pos.X + pos.W &&
                pos.X <= Screen.Width &&
                0 <= pos.Y + pos.H &&
                pos.Y <= Screen.Height)
            {
                int minX = Math.Max(0, pos.X);
                int maxX = Math.Min(Screen.Width, pos.X + pos.W);

                int minY = Math.Max(0, pos.Y);
                int maxY = Math.Min(Screen.Height, pos.Y + pos.H);

                for (int x = minX; x < maxX; x++)
                {
                    for (int y = minY; y < maxY; y++)
                    {
                        var cA = this[x, y];

                        if (invert)
                        {
                            if (xShift != 0 || yShift != 0)
                            {
                                Screen.PrintChar(Font[cA.CurrentChar], BackColor, ForeColor, x, y, mode, xShift, yShift, expands);
                            }
                            else
                            {
                                Screen.PrintChar(Font[cA.CurrentChar], BackColor, ForeColor, x, y, mode);
                            }
                        }
                        else
                        {
                            if (xShift != 0 || yShift != 0)
                            {
                                Screen.PrintChar(Font[cA.CurrentChar], ForeColor, BackColor, x, y, mode, xShift, yShift, expands);
                            }
                            else
                            {
                                Screen.PrintChar(Font[cA.CurrentChar], ForeColor, BackColor, x, y, mode);
                            }
                        }
                    }
                }
            }
        }