GetTile() public method

public GetTile ( int x, int y ) : int
x int
y int
return int
コード例 #1
0
ファイル: RoomEditor.cs プロジェクト: Alan-Baylis/LynnaLab
        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);
                    }
                }
            };
        }
コード例 #2
0
ファイル: RoomEditor.cs プロジェクト: turbo3001/LynnaLab
        public RoomEditor()
        {
            TileWidth  = 16;
            TileHeight = 16;
            XOffset    = 8;
            YOffset    = 8;

            ViewObjectBoxes = true;

            this.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args)
            {
                if (client == null)
                {
                    return;
                }
                int x, y;
                args.Event.Window.GetPointer(out x, out y, out gdkState);
                UpdateMouse(x, y);
                if (gdkState.HasFlag(Gdk.ModifierType.Button1Mask))
                {
                    OnClicked(x, y);
                }
                if (IsInBounds(x, y))
                {
                    if (gdkState.HasFlag(Gdk.ModifierType.Button3Mask))
                    {
                        client.SelectedIndex = room.GetTile(HoveringX, HoveringY);
                    }
                }
            };
            this.ButtonReleaseEvent += delegate(object o, ButtonReleaseEventArgs args) {
                int x, y;
                args.Event.Window.GetPointer(out x, out y, out gdkState);
                if (!gdkState.HasFlag(Gdk.ModifierType.Button1Mask))
                {
                    draggingObject = false;
                }
            };
            this.MotionNotifyEvent += delegate(object o, MotionNotifyEventArgs args) {
                if (client == null)
                {
                    return;
                }
                int x, y;
                args.Event.Window.GetPointer(out x, out y, out gdkState);
                UpdateMouse(x, y);
                if (gdkState.HasFlag(Gdk.ModifierType.Button1Mask))
                {
                    OnDragged(x, y);
                }
            };
        }