Example #1
0
        private void Gpu_MouseMove(object sender, MouseEventArgs e)
        {
            Point  size   = gpu.GetScreenSize();
            double ratioW = gpu.Width / (double)size.X;
            double ratioH = gpu.Height / (double)size.Y;

            if (gpu.TileEditorMode)
            {
                if ((e.X / ratioW > 32 && e.X / ratioW < size.X - 32) && (e.Y / ratioH > 32 && e.Y / ratioH < size.Y - 32))
                {
                    this.Cursor = Cursors.Hand;
                    if (e.Button == MouseButtons.Left)
                    {
                        TileClicked?.Invoke(new Point((int)(e.X / ratioW / 16), (int)(e.Y / ratioH / 16)));
                    }
                }
                else
                {
                    this.Cursor = Cursors.No;
                }
            }
            else if (kernel.MemMgr != null)
            {
                GenerateMouseInterrupt(e);
            }
        }
Example #2
0
 private void Gpu_MouseClick(object sender, MouseEventArgs e)
 {
     if (system.GPU.TileEditorMode && system.GPU.Cursor != Cursors.No)
     {
         double ratioW = system.GPU.Width / 640d;
         double ratioH = system.GPU.Height / 480d;
         TileClicked?.Invoke(new Point((int)(e.X / ratioW / 16), (int)(e.Y / ratioH / 16)));
     }
 }
Example #3
0
        private void Gpu_MouseMove(object sender, MouseEventArgs e)
        {
            double ratioW = gpu.Width / 640d;
            double ratioH = gpu.Height / 480d;

            if (gpu.TileEditorMode)
            {
                if ((e.X / ratioW > 32 && e.X / ratioW < 608) && (e.Y / ratioH > 32 && e.Y / ratioH < 448))
                {
                    this.Cursor = Cursors.Hand;
                    if (e.Button == MouseButtons.Left)
                    {
                        TileClicked?.Invoke(new Point((int)(e.X / ratioW / 16), (int)(e.Y / ratioH / 16)));
                    }
                }
                else
                {
                    this.Cursor = Cursors.No;
                }
            }
            else if (kernel.MemMgr != null)
            {
                // Read the mouse pointer register
                byte mouseReg = kernel.MemMgr.VICKY.ReadByte(0x700);
                if ((mouseReg & 1) == 1)
                {
                    int X = (int)(e.X / ratioW);
                    int Y = (int)(e.Y / ratioH);
                    kernel.MemMgr.VICKY.WriteWord(0x702, X);
                    kernel.MemMgr.VICKY.WriteWord(0x704, Y);
                }
                else
                {
                    this.Cursor = Cursors.Default;
                }
            }
        }