Exemple #1
0
        public MainWindow()
        {
            InitializeComponent();


            WriteableBitmap bitmap = LogoLoader.GetLogo();

            RenderOptions.SetBitmapScalingMode(bitmap, BitmapScalingMode.NearestNeighbor);
            RenderOptions.SetEdgeMode(bitmap, EdgeMode.Aliased);

            Logo = new MovingLogo(
                bitmap,
                new Color[] {
                Color.FromRgb(190, 0, 255),
                Color.FromRgb(255, 0, 139),
                Color.FromRgb(255, 131, 0),
                Color.FromRgb(0, 38, 255),
                Color.FromRgb(255, 250, 0)
            }
                );

            ImageBrush.ImageSource = Logo.Image;

            Logo.OnNewPosition += (MovingLogo logo) => {
                ref var rect = ref logo.Rect;
                Canvas.SetLeft(LogoBox, rect.X);
                Canvas.SetTop(LogoBox, rect.Y);
                LogoBox.Width  = rect.Width;
                LogoBox.Height = rect.Height;
            };
        public override void Present()
        {
            Screen.Clear(Colors.Green);
            C64.Write(17, 12, "F  O  R", Colors.Green);

            var c64Logo = new MovingLogo
            {
                SpriteTL = C64.Sprites.Sprite0,
                SpriteBL = C64.Sprites.Sprite1,
                SpriteTR = C64.Sprites.Sprite2,
                SpriteBR = C64.Sprites.Sprite3,
                MinX     = 220,
                MaxX     = 265,
                MinY     = 50,
                MaxY     = 170,
                X        = 220,
                Y        = 160
            };

            var csharpLogo = new MovingLogo
            {
                SpriteTL = C64.Sprites.Sprite4,
                SpriteBL = C64.Sprites.Sprite5,
                SpriteTR = C64.Sprites.Sprite6,
                SpriteBR = null,
                MinX     = 30,
                MaxX     = 90,
                MinY     = 50,
                MaxY     = 170,
                X        = 50,
                Y        = 50
            };

            c64Logo.Init();
            csharpLogo.Init();
            for (; ;)
            {
                Delay.Wait(100);
                if (C64.IsKeyPressed(Keys.Space) || (C64.Joysticks.Joystick2.Pressed & JoystickButtons.Fire) == JoystickButtons.Fire)
                {
                    break;
                }

                c64Logo.Step();
                csharpLogo.Step();
            }
        }