Пример #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.get_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_ZX
#if DEF_NES
            // row ordered data
            int sel_clr_ind = (_x >> 4) + ((_y >> 4) << 4);
#elif DEF_SMS
            // column ordered data
            int sel_clr_ind = ((_x >> 4) << 2) + (_y >> 4);
#elif DEF_PCE || DEF_SMD
            // column ordered data
            int sel_clr_ind = ((_x >> 2) << 3) + (_y >> 3);
#endif
            MainForm.set_status_msg(utils.hex("Selected color: #", sel_clr_ind));

            if (m_sel_clr_ind >= 0 && sel_clr_ind != m_sel_clr_ind && m_plt_arr[0].get_color_inds() != null)
            {
                dispatch_event_need_gfx_update();
            }

            m_sel_clr_ind = sel_clr_ind;

            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.get_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);
                }
                dispatch_event_update_color();
            }
#endif //!DEF_ZX
        }