Example #1
0
 public HDMAControl()
 {
     hdma = new HDMA(new Effect(EffectType.Brightness, EffectOptions.Option0Static));
     InitializeComponent();
     Resize    += resize;
     add.Click += addClick;
 }
Example #2
0
 public HDMAControl(HDMA HDMA)
 {
     hdma = HDMA;
     InitializeComponent();
     Resize    += resize;
     add.Click += addClick;
 }
        public static DialogResult Show(IWin32Window owner, HDMA hdma)
        {
            LineOptionsDialog lod = new LineOptionsDialog();

            lod.hdmas = hdma;
            lod.build(hdma);

            return(lod.ShowDialog(owner));
        }
Example #4
0
        public HDMAWindow(HDMA hdma)
        {
            HDMA = hdma;
            InitializeComponent();
            l2pb = new PictureBox
            {
                Width     = 256 * Zoom,
                Height    = 224 * Zoom,
                Parent    = this,
                Margin    = new Padding(0, 0, 0, 0),
                Padding   = new Padding(0, 0, 0, 0),
                Location  = new Point(0, 0),
                BackColor = Color.FromArgb(0, 0, 0, 0)
            };
            l1pb = new PictureBox
            {
                Width     = 256 * Zoom,
                Height    = 224 * Zoom,
                Parent    = l2pb,
                Margin    = new Padding(0, 0, 0, 0),
                Padding   = new Padding(0, 0, 0, 0),
                Location  = new Point(0, 0),
                BackColor = Color.FromArgb(0, 0, 0, 0)
            };
            sppb = new PictureBox
            {
                Width     = 256 * Zoom,
                Height    = 224 * Zoom,
                Parent    = l1pb,
                Margin    = new Padding(0, 0, 0, 0),
                Padding   = new Padding(0, 0, 0, 0),
                Location  = new Point(0, 0),
                BackColor = Color.FromArgb(0, 0, 0, 0)
            };
            l3pb = new PictureBox
            {
                Width     = 256 * Zoom,
                Height    = 224 * Zoom,
                Parent    = sppb,
                Margin    = new Padding(0, 0, 0, 0),
                Padding   = new Padding(0, 0, 0, 0),
                Location  = new Point(0, 0),
                BackColor = Color.FromArgb(0, 0, 0, 0)
            };

            try
            {
                layer1  = loadImage(@"Images\Layer1\0.png");
                layer2  = loadImage(@"Images\Layer2\0.png");
                layer3  = loadImage(@"Images\Layer3\0.png");
                sprites = loadImage(@"Images\Sprites\0.png");

                l1buffer = updateBuffer(layer1);
                l2buffer = updateBuffer(layer2);
                l3buffer = updateBuffer(layer3);
                spbuffer = updateBuffer(sprites);

                updatePicture(l1pb, l1buffer);
                updatePicture(l2pb, l2buffer);
                updatePicture(l3pb, l3buffer);
                updatePicture(sppb, spbuffer);
            }
            catch { }
        }
        private void build(HDMA hdma)
        {
            ValueControl v = new NumericValueDialog()
            {
                MaxValue     = 224,
                MinValue     = 0,
                Parent       = panel1,
                Dock         = DockStyle.Top,
                Name         = "Height",
                Description  = "Number of pixels used by the line.",
                ValueID      = -1,
                RegID        = -1,
                AffectedBits = new int[8]
            };

            v.AffectedBits[0] = 0;
            v.AffectedBits[1] = 1;
            v.AffectedBits[2] = 2;
            v.AffectedBits[3] = 3;
            v.AffectedBits[4] = 4;
            v.AffectedBits[5] = 5;
            v.AffectedBits[6] = 6;
            v.AffectedBits[7] = 7;
            v.BringToFront();
            values.Add(v);

            EffectType et = hdma.Effect.Type;

            foreach (int k in et.Values.Keys)
            {
                foreach (HDMAValue[] t
                         in et.Values.Values)
                {
                    for (int i = 0; i < t.Length; i++)
                    {
                        switch (t[i].Type)
                        {
                        case SMWControlibBackend.Logic.HDMA.ValueType.Boolean:
                            v = new BooleanValueControl();
                            break;

                        case SMWControlibBackend.Logic.HDMA.ValueType.Bright:
                            v = new BrightValueControl
                            {
                                MinValue = t[i].MinValue,
                                MaxValue = t[i].MaxValue
                            };
                            break;

                        default:
                            v = new ValueControl();
                            break;
                        }
                        v.ValueID      = k;
                        v.RegID        = t[i].RegisterID;
                        v.Name         = t[i].Name;
                        v.Description  = t[i].Description;
                        v.Parent       = panel1;
                        v.Dock         = DockStyle.Top;
                        v.AffectedBits = new int[t[i].AffectedBits.Length];
                        for (int j = 0; j < v.AffectedBits.Length; j++)
                        {
                            v.AffectedBits[j] =
                                (int)Char.GetNumericValue(t[i].AffectedBits[j]);
                        }
                        v.BringToFront();
                        values.Add(v);
                    }
                }
            }
        }