public void DrawOnBitmap() { checksize = true; Draw(); checksize = false; bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); GFX.begin_draw(bitmap, width, height); Draw(); GFX.end_draw(bitmap); }
public virtual void drawSprites() { GFX.begin_draw(scene_bitmap); room.drawSprites(showLayer1, showLayer2); GFX.end_draw(scene_bitmap); if (showSpriteText) { DrawSpritesTexts(); need_refresh = true; } }
//TODO : Change that to use bitlock instead of drawimage public Bitmap createTile16(Tile16 t16) { Bitmap t16bitmap = new Bitmap(16, 16); GFX.begin_draw(t16bitmap, 16, 16); drawTile16(0, t16); drawTile16(1, t16); drawTile16(2, t16); drawTile16(3, t16); GFX.end_draw(t16bitmap); return(t16bitmap); }
public void initChestGfx() { int length = 75; if (Constants.Rando == true) { length = 175; } for (int i = 0; i < length; i++) { GFX.chestitems_bitmap[i] = new Bitmap(16, 16, PixelFormat.Format32bppArgb); GFX.begin_draw(GFX.chestitems_bitmap[i], 16, 16); new Chest(0, 0, (byte)i, false, true).ItemsDraw((byte)i, 0, 0); GFX.end_draw(GFX.chestitems_bitmap[i]); chestpicker.listView1.Items.Add(ChestItems_Name.name[i]); chestpicker.listView1.Items[i].ImageIndex = i; chestpicker.chestItemsImagesList.Images.Add(GFX.chestitems_bitmap[i]); } Console.WriteLine("???"); chestpicker.listView1.LargeImageList = chestpicker.chestItemsImagesList; }
public virtual void drawRoom() { if (room == null) { //Console.WriteLine("Problem!"); //need_refresh = false; return; } if (room.needGfxRefresh) { room.reloadGfx(); room.needGfxRefresh = false; } if (need_refresh) { //updateSelectionObject(); addSpecialErasedDraw(); drawLayout(); drawLayer1and3plusDoors(); drawLayer2(); drawLayersOnBgr(); drawChests(); drawSprites(); GFX.begin_draw(scene_bitmap); room.drawPotsItems(); GFX.end_draw(scene_bitmap); drawWarp(); drawGrid(); drawSelection(); drawEntrancePosition(); drawDoorsPosition(); this.Image = scene_bitmap; this.Refresh(); need_refresh = false; } }
private void pictureBox1_MouseDoubleClick(object sender, MouseEventArgs e) { if (spritemodeButton.Checked) { if (room.selectedObject.Count > 0) { if (room.selectedObject[0] is Sprite) { PickSprite spritepicker = new PickSprite(); for (int i = 0; i < 0xF3; i++) { sprites_bitmap[i] = new Bitmap(32, 32, System.Drawing.Imaging.PixelFormat.Format32bppArgb); GFX.begin_draw(sprites_bitmap[i], 32, 32); new Sprite(room, (byte)i, 0, 0, Sprites_Names.name[i], 0, 0, 0).Draw(true); GFX.end_draw(sprites_bitmap[i]); spritepicker.listView1.Items.Add(Sprites_Names.name[i]); spritepicker.listView1.Items[i].ImageIndex = i; } //spritepicker.listView1.LargeImageList = new ImageList(); // spritepicker.listView1.LargeImageList spriteImageList.Images.Clear(); spriteImageList.Images.AddRange(sprites_bitmap); spritepicker.listView1.LargeImageList = spriteImageList; //recreate all sprites images if (spritepicker.ShowDialog() == DialogResult.OK) { List <Object> parameters = new List <Object>(); List <Sprite> changed_sprites = new List <Sprite>(); List <int> old_id = new List <int>(); foreach (Object o in room.selectedObject) { changed_sprites.Add((o as Sprite)); old_id.Add((o as Sprite).id); (o as Sprite).id = (byte)spritepicker.listView1.SelectedIndices[0]; (o as Sprite).updateBBox(); } parameters.Add(changed_sprites.ToArray()); parameters.Add(old_id.ToArray()); actionsListbox.Items.Add(new DoAction(ActionType.Change, parameters.ToArray())); room.update(); drawRoom(); } } } else { PickSprite spritepicker = new PickSprite(); for (int i = 0; i < 0xF3; i++) { sprites_bitmap[i] = new Bitmap(32, 32, System.Drawing.Imaging.PixelFormat.Format32bppArgb); GFX.begin_draw(sprites_bitmap[i], 32, 32); new Sprite(room, (byte)i, 0, 0, Sprites_Names.name[i], 0, 0, 0).Draw(true); GFX.end_draw(sprites_bitmap[i]); spritepicker.listView1.Items.Add(Sprites_Names.name[i]); spritepicker.listView1.Items[i].ImageIndex = i; } //spritepicker.listView1.LargeImageList = new ImageList(); // spritepicker.listView1.LargeImageList spriteImageList.Images.Clear(); spriteImageList.Images.AddRange(sprites_bitmap); spritepicker.listView1.LargeImageList = spriteImageList; if (spritepicker.ShowDialog() == DialogResult.OK) { List <Object> parameters = new List <Object>(); List <Sprite> new_sprite = new List <Sprite>(); List <int> old_id = new List <int>(); Sprite o = new Sprite(room, (byte)spritepicker.listView1.SelectedIndices[0], (byte)mx, (byte)my, Sprites_Names.name[spritepicker.listView1.SelectedIndices[0]], 0, 0, 0); new_sprite.Add((o as Sprite)); parameters.Add(new_sprite.ToArray()); room.sprites.Add(o); actionsListbox.Items.Add(new DoAction(ActionType.Add, parameters.ToArray())); room.update(); drawRoom(); } } } else if (chestmodeButton.Checked) { foreach (Chest c in room.chest_list) { Console.WriteLine((c.x * 16) + "," + (c.y * 16)); Console.WriteLine("Mouse:" + e.X + "," + e.Y); if (e.X >= (c.x * 8) && e.X <= (c.x * 8) + 16 && e.Y >= (c.y * 8) && e.Y <= (c.y * 8) + 16) { PickChestItem chestpicker = new PickChestItem(); for (int i = 0; i < 176; i++) { chest_items_bitmap[i] = new Bitmap(16, 16, System.Drawing.Imaging.PixelFormat.Format32bppArgb); GFX.begin_draw(chest_items_bitmap[i], 16, 16); new Chest(0, 0, (byte)i, true).ItemsDraw((byte)i, 0, 0);; GFX.end_draw(chest_items_bitmap[i]); chestpicker.listView1.Items.Add(ChestItems_Name.name[i]); chestpicker.listView1.Items[i].ImageIndex = i; } chestpicker.chestItemsImagesList.Images.AddRange(chest_items_bitmap); chestpicker.listView1.LargeImageList = chestpicker.chestItemsImagesList; if (chestpicker.ShowDialog() == DialogResult.OK) { //change chest item c.item = (byte)chestpicker.listView1.SelectedIndices[0]; room.update(); drawRoom(); anychange = true; } break; } } } }
public void drawRoom() { Bitmap roomBitmap = new Bitmap(512, 512); using (Graphics g = Graphics.FromImage(roomBitmap)) { drawRectangles.Clear(); g.DrawImage(room.room_bitmap, 0, 0); if (room.selectedObject.Count > 0) { GFX.begin_draw(roomBitmap); foreach (Object o in room.selectedObject) { if (o is Sprite) { if (moved == true) { (o as Sprite).nx = (byte)((o as Sprite).x + move_x); (o as Sprite).ny = (byte)((o as Sprite).y + move_y); } (o as Sprite).Draw(); drawRectangles.Add((o as Sprite).boundingbox); } } GFX.end_draw(roomBitmap); if (mouse_down) { foreach (Rectangle r in drawRectangles) { g.DrawRectangle(new Pen(Brushes.LightGreen), r); } } else { foreach (Rectangle r in drawRectangles) { g.DrawRectangle(new Pen(Brushes.Green), r); } } } else { if (mouse_down) { int rx = dragx; int ry = dragy; if (move_x < 0) { Math.Abs(rx = dragx + move_x); } if (move_y < 0) { Math.Abs(ry = dragy + move_y); } g.DrawRectangle(new Pen(Brushes.White), new Rectangle(rx * 16, ry * 16, Math.Abs(move_x) * 16, Math.Abs(move_y) * 16)); } } } pictureBox1.Image = roomBitmap; }