MCPcopy Create free account
hub / github.com/The-Powder-Toy/The-Powder-Toy / SetSnapPoints

Method SetSnapPoints

src/gui/interface/DirectionSelector.cpp:48–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48void DirectionSelector::SetSnapPoints(int newSnapPointEffectRadius, int points, float maxMagnitude)
49{
50 snapPointEffectRadius = newSnapPointEffectRadius;
51 snapPoints.clear();
52 snapPoints.push_back(GravityValueToValue(0, 0));
53 for (int i = 1; i < points; i++)
54 {
55 auto dist = i / float(points - 1) * maxMagnitude;
56 snapPoints.push_back(GravityValueToValue( dist, 0));
57 snapPoints.push_back(GravityValueToValue( 0, dist));
58 snapPoints.push_back(GravityValueToValue(-dist, 0));
59 snapPoints.push_back(GravityValueToValue( 0, -dist));
60 }
61 useSnapPoints = true;
62}
63
64void DirectionSelector::ClearSnapPoints()
65{

Callers 1

DirectionSelectorMethod · 0.80

Calls 1

clearMethod · 0.80

Tested by

no test coverage detected