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); } } }; }
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); } }; }