Esempio n. 1
0
        private pattern_data update_pattern_image(string _name)
        {
            pattern_data pattern = m_data.get_pattern_by_name(_name);

            if (pattern != null)
            {
                m_gfx.Clear(Color.FromArgb(0));

                int       scr_tile_size = utils.CONST_SCREEN_TILES_SIZE >> 1;
                ImageList img_list;

                if (m_screen_data_type == data_sets_manager.EScreenDataType.sdt_Tiles4x4)
                {
                    img_list = m_tiles_image_list;
                }
                else
                {
                    img_list        = m_blocks_image_list;
                    scr_tile_size >>= 1;
                }

                int start_pos_x = (m_pattern_image.Width >> 1) - ((pattern.width * scr_tile_size) >> 1);
                int start_pos_y = (m_pattern_image.Height >> 1) - ((pattern.height * scr_tile_size) >> 1);

                for (int tile_y = 0; tile_y < pattern.height; tile_y++)
                {
                    for (int tile_x = 0; tile_x < pattern.width; tile_x++)
                    {
                        m_gfx.DrawImage(img_list.Images[pattern.data.get_tile(tile_y * pattern.width + tile_x)], start_pos_x + tile_x * scr_tile_size, start_pos_y + tile_y * scr_tile_size, scr_tile_size, scr_tile_size);
                    }
                }

                return(pattern);
            }

            MainForm.message_box("UNEXPECTED ERROR!\n\nCan't find the pattern <" + _name + ">!", "Pattern Image Update", MessageBoxButtons.OK, MessageBoxIcon.Error);

            return(null);
        }