コード例 #1
0
        private void select_CHR(object sender, EventArgs e)
        {
            sprite_layout_viewer spr_layout = sender as sprite_layout_viewer;

            m_selected_ind = spr_layout.get_selected_CHR_ind();

            update();
        }
コード例 #2
0
        public sprite_processor(PictureBox _spr_layout,
                                Label _spr_layout_label,
                                GroupBox _spr_layout_grp_box,
                                PictureBox _chr_bank,
                                Label _chr_bank_label,
                                PictureBox _plt_main,
                                PictureBox _plt0,
                                PictureBox _plt1,
                                PictureBox _plt2,
                                PictureBox _plt3)
        {
            m_sprite_layout_viewer = new sprite_layout_viewer(_spr_layout, _spr_layout_label, _spr_layout_grp_box);
            m_CHR_bank_viewer      = new CHR_bank_viewer(_chr_bank, _chr_bank_label);
            m_CHR_data_storage     = new CHR_data_storage();
            m_palette_grp          = new palette_group(_plt_main, _plt0, _plt1, _plt2, _plt3);

            m_CHR_bank_viewer.subscribe_event(m_palette_grp);
            m_CHR_bank_viewer.subscribe_event(m_sprite_layout_viewer);
            m_sprite_layout_viewer.subscribe_event(m_palette_grp);
            m_sprite_layout_viewer.subscribe_event(m_CHR_bank_viewer);
        }
コード例 #3
0
        private void update_pixel(object sender, EventArgs e)
        {
            sprite_layout_viewer spr_viewer = sender as sprite_layout_viewer;

            if (m_selected_ind >= 0)
            {
                if (m_palette_group.active_palette != -1)
                {
#if DEF_NES
                    byte color_slot = ( byte )m_palette_group.get_palettes_arr()[m_palette_group.active_palette].color_slot;
#elif DEF_SMS || DEF_PCE
                    byte color_slot = ( byte )(m_palette_group.active_palette * utils.CONST_NUM_SMALL_PALETTES + m_palette_group.get_palettes_arr()[m_palette_group.active_palette].color_slot);
#endif
                    if (m_mode8x16 && (spr_viewer.changed_pix_y > utils.CONST_CHR_SIDE_PIXELS_CNT - 1))
                    {
                        if ((m_selected_ind + 1) < m_data_list.Count)
                        {
                            m_data_list[m_selected_ind + 1].get_data()[spr_viewer.changed_pix_x + (spr_viewer.changed_pix_y - utils.CONST_CHR_SIDE_PIXELS_CNT) * utils.CONST_CHR_SIDE_PIXELS_CNT] = color_slot;
                        }
                    }
                    else
                    {
                        m_data_list[m_selected_ind].get_data()[spr_viewer.changed_pix_x + spr_viewer.changed_pix_y * utils.CONST_CHR_SIDE_PIXELS_CNT] = color_slot;
                    }

                    update();

                    if (UpdatePixel != null)
                    {
                        UpdatePixel(this, null);
                    }
                }
                else
                {
                    MainForm.message_box("Please, select an active palette!", "WARNING!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                }
            }
        }
コード例 #4
0
 public void subscribe_event(sprite_layout_viewer _sprite_layout_viewer)
 {
     _sprite_layout_viewer.SetSelectedCHR += new EventHandler(select_CHR);
     _sprite_layout_viewer.UpdatePixel    += new EventHandler(update_pixel);
 }