コード例 #1
0
        private void update_palettes(object sender, EventArgs e)
        {
            palette_small plt = sender as palette_small;

            active_palette = plt.active ? plt.id:-1;

            m_sel_clr_ind = plt.get_color_inds()[plt.color_slot];

            update();
        }
コード例 #2
0
        private void check_color(int _x, int _y)
        {
            if (_x < 0 || _y < 0 || _x >= m_pix_box.Width || _y >= m_pix_box.Height)
            {
                return;
            }

#if DEF_NES     // row ordered data
            m_sel_clr_ind = (_x >> 4) + ((_y >> 4) << 4);
#elif DEF_SMS   // column ordered data
            m_sel_clr_ind = ((_x >> 4) << 2) + (_y >> 4);
#elif DEF_PCE   // column ordered data
            m_sel_clr_ind = ((_x >> 2) << 3) + (_y >> 3);
#endif
            update();

            // dispatch an index of a selected color to the active palette
            if (m_active_plt_id >= 0)
            {
                palette_small plt = m_plt_arr[m_active_plt_id];
#if DEF_NES
                if (plt.color_slot == 0)
                {
                    // if active slot is a zero number, fill zero slot of the all palettes by a selected color
                    for (int i = 0; i < utils.CONST_NUM_SMALL_PALETTES; i++)
                    {
                        m_plt_arr[i].update_color(m_sel_clr_ind, 0);
                    }
                }
                else
#endif
                {
                    m_plt_arr[m_active_plt_id].update_color(m_sel_clr_ind);
#if DEF_FIXED_LEN_PALETTE16_ARR
                    palettes_array.Instance.update_color((m_active_plt_id << 2) + m_plt_arr[m_active_plt_id].color_slot, m_sel_clr_ind);
#endif
                }

                dispatch_event_update_color();
            }
        }