コード例 #1
0
        public void Core_LoadValues()
        {
            AlphaCheckBox.CheckedChanged -= AlphaCheckBox_CheckedChanged;
            NumBox_16bit.ValueChanged    -= NumBox_16bit_ValueChanged;
            NumBox_32bit.ValueChanged    -= NumBox_32bit_ValueChanged;
            NumBox_R.ValueChanged        -= NumBox_R_ValueChanged;
            NumBox_G.ValueChanged        -= NumBox_G_ValueChanged;
            NumBox_B.ValueChanged        -= NumBox_B_ValueChanged;
            TrackBar_R.Scroll            -= TrackBar_R_Scroll;
            TrackBar_G.Scroll            -= TrackBar_G_Scroll;
            TrackBar_B.Scroll            -= TrackBar_B_Scroll;

            if (Current == null || CurrentIndex >= Current.Count)
            {
                AlphaCheckBox.Checked = false;
                NumBox_16bit.Value    = 0;
                NumBox_32bit.Value    = 0;
                TrackBar_R.Value      = 0;
                TrackBar_G.Value      = 0;
                TrackBar_B.Value      = 0;
                NumBox_R.Value        = 0;
                NumBox_G.Value        = 0;
                NumBox_B.Value        = 0;
            }
            else
            {
                GBA.Color color = Current[CurrentIndex];

                AlphaCheckBox.Checked = color.GetAlpha();
                NumBox_16bit.Value    = color.To16bit();
                NumBox_32bit.Value    = color.To32bit();
                TrackBar_R.Value      = color.GetValueR();
                TrackBar_G.Value      = color.GetValueG();
                TrackBar_B.Value      = color.GetValueB();
                NumBox_R.Value        = TrackBar_R.Value;
                NumBox_G.Value        = TrackBar_G.Value;
                NumBox_B.Value        = TrackBar_B.Value;
            }

            AlphaCheckBox.CheckedChanged += AlphaCheckBox_CheckedChanged;
            NumBox_16bit.ValueChanged    += NumBox_16bit_ValueChanged;
            NumBox_32bit.ValueChanged    += NumBox_32bit_ValueChanged;
            NumBox_R.ValueChanged        += NumBox_R_ValueChanged;
            NumBox_G.ValueChanged        += NumBox_G_ValueChanged;
            NumBox_B.ValueChanged        += NumBox_B_ValueChanged;
            TrackBar_R.Scroll            += TrackBar_R_Scroll;
            TrackBar_G.Scroll            += TrackBar_G_Scroll;
            TrackBar_B.Scroll            += TrackBar_B_Scroll;
        }
コード例 #2
0
        public Font(GBA.Bitmap image)
        {
            GBA.Color[] colors = new GBA.Color[4]
            {
                image.Colors[0],
                image.Colors[1],
                image.Colors[2],
                image.Colors[3]
            };
            Glyphs = new Glyph[256];
            int x = 1;
            int y = 0;

            for (int i = 1; i < Glyphs.Length; i++)
            {
                Glyphs[i] = new Glyph(new GBA.Bitmap(image,
                                                     new Rectangle(x * 16, y * 16, 16, 16)), colors);

                if (Glyphs[i].IsEmpty())
                {
                    Glyphs[i] = null;
                }

                /*
                 * for (int j = 0; j < i; j++)
                 * {
                 *  if (Glyphs[i].Equals(Glyphs[j]))
                 *      Glyphs[i] = Glyphs[j];
                 * }
                 */
                x++;
                if (x % 16 == 0)
                {
                    x = 0;
                    y++;
                }
            }
        }
コード例 #3
0
        public void Core_SwapColors(int index1, int index2)
        {
            if (index1 < 0 || index1 >= PaletteAmount * 16 ||
                index2 < 0 || index2 >= PaletteAmount * 16)
            {
                throw new Exception("Invalid index given.");
            }

            GBA.Color color1 = Current[index1];
            GBA.Color color2 = Current[index2];

            Core.SuspendUpdate();

            if (IsCompressed)
            {
                Current.Swap(index1, index2);

                Core.WriteData(Owner ?? this,
                               Address,
                               Current.ToBytes(true),
                               Entry + "Palette changed");
            }
            else
            {
                Core.WriteData(Owner ?? this,
                               Address + index2 * 2,
                               color1.ToBytes(true),
                               Entry + "Palette color " + index1 + " swapped");

                Core.WriteData(Owner ?? this,
                               Address + index1 * 2,
                               color2.ToBytes(true),
                               Entry + "Palette color " + index2 + " swapped");
            }

            Core.ResumeUpdate();
            Core.PerformUpdate();
        }