Example #1
0
        private void tilesetPicturebox_MouseDown(object sender, MouseEventArgs e)
        {
            int    y   = (e.Y / 16);
            int    x   = (e.X / 16);
            ushort tid = (ushort)(x + (y * 8));

            if (e.Button == MouseButtons.Left)
            {
                selectedtileUpDown.Value = tid;
            }
            else if (e.Button == MouseButtons.Right)
            {
                selectedtileUpDown.Value = tid;
                Tile16EditorForm tile16Editor = new Tile16EditorForm();
                tile16Editor.setGfxData(jsonData.tilesetBitmaps, jsonData, overworldDisplay.selectedMap, tid);

                if (tile16Editor.ShowDialog() == DialogResult.OK)
                {
                    jsonData.alltiles16[tid] = tile16Editor.editingTile;
                    overworldDisplay.selectedMap.UpdateMap(allgfx16Ptr);
                }
            }

            tilesetPicturebox.Refresh();
        }
Example #2
0
        public void mouseUp(MouseEventArgs e, Map16 map)
        {
            if (sceneMode == SceneMode.tiles)
            {
                int mx          = (mouse_tile_x / 32);
                int my          = (mouse_tile_y / 32);
                int mouse_x_map = mouse_tile_x - (mx * 32);
                int mouse_y_map = mouse_tile_y - (my * 32);
                if (e.Button == MouseButtons.Right)
                {
                    if (allowCopy)
                    {
                        int sizeX = 0;
                        int sizeY = 0;
                        if (mouse_tile_x_down < mouse_x_map)
                        {
                            sizeX = (mouse_x_map - mouse_tile_x_down) + 1;
                        }
                        else
                        {
                            int oldmdownx = mouse_tile_x_down;
                            mouse_tile_x_down = mouse_x_map;
                            mouse_x_map       = oldmdownx;
                            sizeX             = (mouse_x_map - mouse_tile_x_down) + 1;
                        }
                        if (mouse_tile_y_down < mouse_y_map)
                        {
                            sizeY = (mouse_y_map - mouse_tile_y_down) + 1;
                        }
                        else
                        {
                            int oldmdowny = mouse_tile_y_down;
                            mouse_tile_y_down = mouse_y_map;
                            mouse_y_map       = oldmdowny;
                            sizeY             = (mouse_y_map - mouse_tile_y_down) + 1;
                        }

                        //selectedTiles = new ushort[sizeX, sizeY];

                        /*for (int x = 0; x < sizeX; x++)
                         * {
                         *  for (int y = 0; y < sizeY; y++)
                         *  {
                         *
                         *  }
                         * }*/
                        selectionSize = new Rectangle(mouse_tile_x_down * 16, mouse_tile_y_down * 16, (sizeX * 16), (sizeY * 16));
                        selectedTiles = map.getTiles(mouse_tile_x_down, mouse_tile_y_down, sizeX, sizeY);
                        setOverlaytiles(allgfx16Ptr);
                    }
                }
                else if (e.Button == MouseButtons.Middle)
                {
                    selectionSize = new Rectangle(mouse_tile_x_down * 16, mouse_tile_y_down * 16, (1 * 16), (1 * 16));
                    selectedTiles = map.getTiles(mouse_tile_x_down, mouse_tile_y_down, 1, 1);
                    Tile16EditorForm tile16Editor = new Tile16EditorForm();
                    tile16Editor.setGfxData(allbitmaps, jsonData, map, selectedTiles[0, 0]);
                    if (tile16Editor.ShowDialog() == DialogResult.OK)
                    {
                        jsonData.alltiles16[selectedTiles[0, 0]] = tile16Editor.editingTile;
                        map.UpdateMap(allgfx16Ptr);
                        refresh = true;
                    }
                }
            }
            else if (sceneMode == SceneMode.entrances)
            {
                entrancesHandler.onMouseUp(e, mouse_x, mouse_y, mouse_down, (short)mouseOverMap, map);
            }
            else if (sceneMode == SceneMode.holes)
            {
                holesHandler.onMouseUp(e, mouse_x, mouse_y, mouse_down, (short)mouseOverMap, map);
            }
            else if (sceneMode == SceneMode.exits)
            {
                exitsHandler.onMouseUp(e, mouse_x, mouse_y, (short)mouseOverMap, map);
            }
            else if (sceneMode == SceneMode.sprites)
            {
                spritesHandler.onMouseUp(e, mouse_x, mouse_y, mouse_down, (short)mouseOverMap, map);
            }
            else if (sceneMode == SceneMode.items)
            {
                itemsHandler.onMouseUp(e, mouse_x, mouse_y, mouse_down, (short)mouseOverMap, map);
            }
            refresh = true;
            //refresh = true;
            mouse_down = false;
        }