public void Translate(Vector2f offset) { Vector2 spriteUpDirection = Matht.NormalAngleToVector(rotation); //Kierunek do góry sprite Vector2 spriteRightDirection = Matht.NormalAngleToVector(rotation + 90); //Kierunek do prawej sprite spriteUpDirection.y = -spriteUpDirection.y; // spriteRightDirection.y = -spriteRightDirection.y; //Trzeba to robić ze względu na to że y ma odwrotny kierunek w sfml: rośnie ku dołu spriteUpDirection.Round(5); spriteRightDirection.Round(5); if (offset.Y != 0) { //Console.WriteLine(-spriteUpDirection * ((Vector2)offset).y); position += -spriteUpDirection * ((Vector2)offset).y; } if (offset.X != 0) { //Console.WriteLine(spriteRightDirection * ((Vector2)offset).x); position += spriteRightDirection * ((Vector2)offset).x; } //Console.WriteLine(offset); }
public VolumeForm(float level, Coord?location = null) { InitializeComponent(); Level = Matht.Clamp(level, 0, 1); Location = location != null ? (Coord)location : new Coord(10, 10); ClientSize = volSize; BackColor = baseColor; Shown += (o, e) => { ClientSize = volSize; new Window(Handle).SetOpacity(0.9).SetAlwaysOnTop(true); }; }
public void SetLevel(float level) { Level = Matht.Clamp(level, 0, 1); Refresh(); }
public void SetValue(int value) { progressBar1.Value = Matht.Clamp(value, 0, Max); }