Example #1
0
        /// <summary>
        /// Constructs a new export to binary form.
        /// </summary>
        /// <param name="room">The initial room.</param>
        public ExportBinaryForm(GMareRoom room)
        {
            InitializeComponent();

            // Add the initial room.
            clb_Rooms.Items.Add(room);

            // Set information.
            SetTotalSize();
        }
Example #2
0
        /// <summary>
        /// Constructs a new room form with a room to edit.
        /// </summary>
        public RoomForm(GMareRoom room)
        {
            InitializeComponent();

            // Set new room.
            _room = room.Clone();

            // Update the GUI with room data.
            SetupGUI();
        }
Example #3
0
        private GMareRoom _room = null; // Room to edit.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructs a new room form.
        /// </summary>
        public RoomForm()
        {
            InitializeComponent();

            // Set new room.
            _room = new GMareRoom();

            // A new room, no need for change checks.
            _new = true;

            // Update the GUI with room data.
            SetupGUI();
        }
Example #4
0
        private GMareRoom _newRoom = null; // The newly created room.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructs a new import room from image form.
        /// </summary>
        /// <param name="image">The image used as a room.</param>
        public ImportImageForm(Bitmap image)
        {
            InitializeComponent();

            // Create a new room.
            _newRoom = new GMareRoom();

            // Set target room image.
            pnl_Image.BackgroundImage = image;

            // Disable cancel tile compile button.
            tsb_CancelCompile.Enabled = false;
            tsb_Undo.Enabled = false;
            tsb_Redo.Enabled = false;

            // Create new undo/redo history.
            _history = new UndoRedoHistory<ITilesOwner>(this, 10);

            // Check for ok button enable.
            CheckAccept();
        }
Example #5
0
        /// <summary>
        /// Makes a shallow copy of this room.
        /// </summary>
        /// <returns>A shallow copy of this room.</returns>
        public GMareRoom Clone()
        {
            // Create a new room.
            GMareRoom room = new GMareRoom(_columns, _rows, _tileWidth, _tileHeight);

            // Clone this room.
            room.Layers.Clear();

            // Iterate through layers.
            foreach (GMareLayer layer in _layers)
                room._layers.Add(layer.Clone());

            // Iterate through instances.
            foreach (GMareInstance inst in _instances)
                room.Instances.Add(inst.Clone());

            // TODO: Clone this.
            room.Shapes.AddRange(_shapes.ToArray());

            if (_nodes != null)
                room.Nodes = (GMNode[])_nodes.Clone();

            if (_background != null)
                room.Background = _background.Clone();

            room.BackColor = _backColor;
            room.Name = (string)_name.Clone();
            room.Columns = _columns;
            room.Rows = _rows;
            room.TileWidth = _tileWidth;
            room.TileHeight = _tileHeight;
            room.SeparationX = _seperationX;
            room.SeparationY = _seperationY;
            room.OffsetX = _offsetX;
            room.OffsetY = _offsetY;

            // Return copy.
            return room;
        }
Example #6
0
        /// <summary>
        /// Converts an Ore room to a GMare room.
        /// </summary>
        /// <param name="oreRoom">The Ore room to convert.</param>
        /// <returns>A converted Ore room.</returns>
        public static GMareRoom OreRoomToGMareRoom(OcarinaRoomEditor.Room oreRoom)
        {
            // Create a new GMare room.
            GMareRoom room = new GMareRoom();

            // Convert parts of Ore room to GMare room.
            room.BackColor = oreRoom.RoomColor;
            room.Background = new PixelMap(oreRoom.Tileset);
            room.Columns = oreRoom.Width / 16;
            room.Rows = oreRoom.Height / 16;
            room.Layers.Add(new GMareLayer("Upper Layer", -1, OreTilesToGMareTiles(oreRoom.TilesUpper, room.Columns, room.Rows)));
            room.Layers.Add(new GMareLayer("Lower Layer", 0, OreTilesToGMareTiles(oreRoom.TilesLower, room.Columns, room.Rows)));

            // TODO: Convert shapes to collisions.

            // Return converted GMare room.
            return room;
        }