private void update_bank_GFX() { tiles_data data = m_data_manager.get_tiles_data(ListBoxCHRBanks.SelectedIndex); int img_size = utils.CONST_BLOCKS_IMG_SIZE; int half_img_size = img_size >> 1; int side = 5; int size = side * side; Bitmap bmp = new Bitmap(img_size, img_size); Graphics gfx = Graphics.FromImage(bmp); gfx.SmoothingMode = SmoothingMode.HighSpeed; gfx.InterpolationMode = InterpolationMode.NearestNeighbor; // gfx.PixelOffsetMode = PixelOffsetMode.HighQuality; for (int i = 0; i < size; i++) { utils.update_block_gfx(i, data, gfx, half_img_size, half_img_size, 0, 0, 0); m_blocks_preview.update(bmp, img_size, img_size, (i % side) * img_size, (i / side) * img_size, i == (size - 1), i == 0); } gfx.Dispose(); bmp.Dispose(); // update info { LabelCHRs.Text = data.get_first_free_spr8x8_id(false).ToString(); LabelBlocks2x2.Text = data.get_first_free_block_id(false).ToString(); LabelTiles4x4.Text = data.get_first_free_tile_id(false).ToString(); LabelScreens.Text = data.screen_data_cnt().ToString(); LabelPalettes.Text = data.palettes_arr.Count.ToString(); } }
public void update() { if (this.Visible) { if (TreeViewPatterns.SelectedNode == null) { // redraw a current selected pattern m_pattern_preview.update(null, -1, -1, -1, -1, -1, false, false); m_pattern_preview.draw_string("Patterns are often-used combinations of tiles.\nHere you can create and manage them.\n\n- Click the 'Add' pattern button to add a new one.\n\n- Click the 'Add' button again to cancel operation.\n\n- Select a pattern in the tree view to put it on\na game screen.\n\n- Scale a selected pattern using a mouse wheel.", 0, 0); } else { if (CheckBoxAddPattern.Checked) { // redraw a current selected pattern m_pattern_preview.update(null, -1, -1, -1, -1, -1, false, false); m_pattern_preview.draw_string("Select a rectangle area in the screen editor\nto create a pattern.\nClick the 'Add' button again to cancel operation.", 0, 0); } else { TreeNode node = TreeViewPatterns.SelectedNode; if (node == null || node.Parent == null) { m_pattern_preview.update(null, -1, -1, -1, -1, -1, false, false); m_pattern_preview.draw_string("Select a pattern.", 0, 0); } else { // draw a pattern update_pattern_image(node.Name); m_pattern_preview.update(m_pattern_image, m_pattern_image.Width, m_pattern_image.Height, 0, 0, ( int )Math.Pow(2.0, ( double )m_scale_pow), false, false); m_pattern_preview.draw_string("Put the <" + node.Name + "> on a game screen.\nRMB - cancel.", 0, 0); } } } m_pattern_preview.invalidate(); } }