示例#1
0
        /// <summary>
        /// Loads the palette editor.
        /// </summary>
        /// <param name="update">Functiont to execute when updating.</param>
        /// <param name="paletteSet">The palette set to use.</param>
        /// <param name="count">The total number of palettes in the set.</param>
        /// <param name="startRow">The palette row (index) to start at.</param>
        /// <param name="max">The maximum number of palettes to show.</param>
        public PaletteEditor(PaletteUpdater updater, PaletteSet paletteSet, int count, int startRow, int max)
        {
            this.updater           = updater;
            this.paletteSetBackup2 = paletteSet.Copy();
            this.paletteSetBackup  = paletteSet.Copy();
            this.paletteSet        = paletteSet;
            this.count             = count;
            this.startRow          = startRow;
            this.max          = max;
            this.currentColor = startRow * 16;

            //
            InitializeComponent();
            CreateHelperForms();
            CreateShortcuts();
            CreateCheckBoxRows();
            CreateCheckBoxCols();
            SetControlSizes();
            InitializeColor();
            SetColorMapImage();
            SetPaletteImage();

            //
            this.BringToFront();

            //
            this.History = new History(this);
        }
示例#2
0
        /// <summary>
        /// Creates a deep copy of this instance.
        /// </summary>
        /// <returns></returns>
        public PaletteSet Copy()
        {
            PaletteSet copy = new PaletteSet(Buffer, index, offset, count, size, Length);

            copy.Buffer = Bits.Copy(Buffer);
            copy.Reds   = Bits.Copy(Reds);
            copy.Greens = Bits.Copy(Greens);
            copy.Blues  = Bits.Copy(Blues);
            return(copy);
        }
示例#3
0
        public void Reload(PaletteSet paletteSet, int count, int startRow, int max)
        {
            this.paletteSetBackup2 = paletteSet.Copy();
            this.paletteSetBackup  = paletteSet.Copy();
            this.paletteSet        = paletteSet;
            this.count             = count;
            this.startRow          = startRow;
            this.max = max;

            // Create checkbox rows, but only if different number
            if (rows.Count != Math.Min(count - startRow, max))
            {
                foreach (CheckBox checkBox in this.rows)
                {
                    this.Controls.Remove(checkBox);
                }
                List <CheckBox> rows_temp = new List <CheckBox>();
                for (int i = 0; i < count - startRow && i < max; i++)
                {
                    CheckBox checkBox = new CheckBox();
                    checkBox.Appearance = Appearance.Button;
                    checkBox.AutoSize   = false;
                    if (i < this.rows.Count)
                    {
                        checkBox.Checked = this.rows[i].Checked;
                    }
                    else
                    {
                        checkBox.Checked = true;
                    }
                    checkBox.Location        = new Point(12, i * 12 + 43);
                    checkBox.Size            = new Size(12, 12);
                    checkBox.CheckedChanged += new EventHandler(checkBox_CheckedChanged);
                    rows_temp.Add(checkBox);
                    this.Controls.Add(checkBox);
                }
                this.currentColor = 0;
                this.rows         = rows_temp;
            }

            //
            SetControlSizes();
            InitializeColor();
            SetColorMapImage();
            SetPaletteImage();
            CheckAllColors();

            //
            this.BringToFront();
        }
示例#4
0
 // Area
 public Tileset(Areas.Map areaMap, PaletteSet paletteSet)
 {
     this.Type     = TilesetType.Area;
     this.Width    = 16;
     this.Height   = 32;
     this.HeightL3 = 16;
     this.tileSize = 2;
     //
     this.areaMap    = areaMap;
     this.PaletteSet = paletteSet;
     InitializeGraphics();
     InitializeTilesetBytes();
     InitializeTilesetTiles();
     BuildTilesetTiles();
 }
示例#5
0
 // Default
 public Tileset(byte[] tileset_bytes, byte[] graphics, PaletteSet paletteSet, int width, int height, TilesetType type)
 {
     this.Type     = type;
     this.Width    = width;
     this.Height   = height;
     this.tileSize = 2;
     //
     this.Graphics          = graphics;
     this.PaletteSet        = paletteSet;
     this.Tilesets_bytes    = new byte[3][];
     this.Tilesets_bytes[0] = tileset_bytes;
     //
     InitializeTilesetTiles();
     BuildTilesetTiles();
 }
示例#6
0
 // Constructor
 public IOArchitecture(string action, int index, Areas.Map areaMap, PaletteSet paletteSet, Tileset tileset, Tilemap tilemap, Areas.PrioritySet prioritySet)
 {
     this.action      = action;
     this.index       = index;
     this.areaMap     = areaMap;
     this.paletteSet  = paletteSet;
     this.tileset     = tileset;
     this.tilemap     = tilemap;
     this.prioritySet = prioritySet;
     InitializeComponent();
     if (action == "import")
     {
         groupBox1.Text = "Import the following elements from architecture file";
     }
     else
     {
         groupBox1.Text = "Export the following elements to architecture file";
     }
 }
示例#7
0
 // Title screen, Minecart M7
 public Tileset(PaletteSet paletteSet, TilesetType type)
 {
     this.Type = type;
     if (this.Type == TilesetType.Title)
     {
         this.Width    = 16;
         this.Height   = 32;
         this.HeightL3 = 6;
         this.tileSize = 2;
     }
     if (this.Type == TilesetType.Mode7)
     {
         this.Width    = 16;
         this.Height   = 16;
         this.tileSize = 1;
     }
     //
     this.PaletteSet = paletteSet;
     InitializeGraphics();
     InitializeTilesetBytes();
     InitializeTilesetTiles();
     BuildTilesetTiles();
 }
示例#8
0
 /// <summary>
 /// Copies this instance's RGB arrays to the RGB arrays of another instance.
 /// </summary>
 /// <param name="copyTo"></param>
 public void CopyTo(PaletteSet copyTo)
 {
     Reds.CopyTo(copyTo.Reds, 0);
     Greens.CopyTo(copyTo.Greens, 0);
     Blues.CopyTo(copyTo.Blues, 0);
 }