LynnaLab.Room.GetTile C# (CSharp) Method

GetTile() public method

public GetTile ( int x, int y ) : int
x int
y int
return int
        public int GetTile(int x, int y)
        {
            tileDataFile.Position = y*fileWidth+x;
            return tileDataFile.ReadByte();
        }

Usage Example

Beispiel #1
0
        public RoomEditor()
        {
            TileWidth  = 16;
            TileHeight = 16;

            this.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args)
            {
                if (client == null)
                {
                    return;
                }
                int x, y;
                Gdk.ModifierType state;
                args.Event.Window.GetPointer(out x, out y, out state);
                UpdateMouse(x, y);
                if (IsInBounds(x, y))
                {
                    if (state.HasFlag(Gdk.ModifierType.Button1Mask))
                    {
                        OnClicked(x, y);
                    }
                    else if (state.HasFlag(Gdk.ModifierType.Button3Mask))
                    {
                        client.SelectedIndex = room.GetTile(x / TileWidth, y / TileWidth);
                    }
                }
            };
            this.ButtonReleaseEvent += delegate(object o, ButtonReleaseEventArgs args) {
                int x, y;
                Gdk.ModifierType state;
                args.Event.Window.GetPointer(out x, out y, out state);
                if (!state.HasFlag(Gdk.ModifierType.Button1Mask))
                {
                    draggingObject = false;
                }
            };
            this.MotionNotifyEvent += delegate(object o, MotionNotifyEventArgs args) {
                if (client == null)
                {
                    return;
                }
                int x, y;
                Gdk.ModifierType state;
                args.Event.Window.GetPointer(out x, out y, out state);
                UpdateMouse(x, y);
                if (IsInBounds(x, y))
                {
                    if (state.HasFlag(Gdk.ModifierType.Button1Mask))
                    {
                        OnDragged(x, y);
                    }
                }
            };
        }
All Usage Examples Of LynnaLab.Room::GetTile