private void Window_MouseButtonPressed(object sender, MouseButtonEventArgs e) { if (Program.window.HasFocus() && !Program.placingMode && !parent.GetEditingMode() && e.Button == Mouse.Button.Right) { Vector2f pos = Program.window.MapPixelToCoords(Mouse.GetPosition(Program.window)); float distance = (float)Math.Sqrt((pos.X - GetGlobalPos().X) * (pos.X - GetGlobalPos().X) + (pos.Y - GetGlobalPos().Y) * (pos.Y - GetGlobalPos().Y)); if (distance <= 7) { if (selected == this) { selected = null; } else { selected = this; if (OutPort.selected != null) { if (selected.connexion == OutPort.selected) { selected.connexion = null; } else { connexion = OutPort.selected; } selected = null; OutPort.selected = null; } } } } }
public Lamp() : base(1, 0) { inPorts[0] = new InPort(new Vector2f(-25, 0), this); FillColor = Color.Black; Texture = Textures.gatesTextures[6]; }
public NotGate() : base(1, 1) { inPorts[0] = new InPort(new Vector2f(-25, 0), this); outPorts[0] = new OutPort(new Vector2f(25, 0), this); Texture = Textures.gatesTextures[1]; }