|
|
@ -257,24 +257,24 @@ public class CropTool : ITool { |
|
|
|
public class StraightenTool : ITool { |
|
|
|
|
|
|
|
Photo photo; |
|
|
|
float initialRotation; |
|
|
|
int initialRotation; |
|
|
|
|
|
|
|
public StraightenTool(Photo photo) { |
|
|
|
this.photo = photo; |
|
|
|
initialRotation = photo.RotationDegrees; |
|
|
|
initialRotation = photo.RotationDegreeHundredths; |
|
|
|
} |
|
|
|
|
|
|
|
public ToolStatus HandleInput(KeyboardState input, MouseState mouse, Transform transform, Game game, Photo photo, UiGeometry geometry) { |
|
|
|
if (input.IsKeyPressed(Keys.D0)) { |
|
|
|
photo.RotationDegrees = 0; |
|
|
|
photo.RotationDegreeHundredths = 0; |
|
|
|
} |
|
|
|
|
|
|
|
if (input.IsKeyPressed(Keys.Left)) { |
|
|
|
photo.RotationDegrees += .1f; |
|
|
|
photo.RotationDegreeHundredths += 10; |
|
|
|
} |
|
|
|
|
|
|
|
if (input.IsKeyPressed(Keys.Right)) { |
|
|
|
photo.RotationDegrees -= .1f; |
|
|
|
photo.RotationDegreeHundredths -= 10; |
|
|
|
} |
|
|
|
|
|
|
|
if (input.IsKeyPressed(Keys.Enter)) { |
|
|
@ -282,7 +282,7 @@ public class StraightenTool : ITool { |
|
|
|
} |
|
|
|
|
|
|
|
if (input.IsKeyPressed(Keys.Escape)) { |
|
|
|
photo.RotationDegrees = initialRotation; |
|
|
|
photo.RotationDegreeHundredths = initialRotation; |
|
|
|
return ToolStatus.Canceled; |
|
|
|
} |
|
|
|
|
|
|
@ -290,7 +290,7 @@ public class StraightenTool : ITool { |
|
|
|
} |
|
|
|
|
|
|
|
public string Status() { |
|
|
|
return String.Format("[straighten] {0:F2}", photo.RotationDegrees); |
|
|
|
return String.Format("[straighten] {0:F2}", photo.RotationDegreeHundredths / 100f); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -983,7 +983,7 @@ public class Game : GameWindow { |
|
|
|
renderSize.X, renderSize.Y); |
|
|
|
activeOffset = new(photoBox.Min.X, photoBox.Min.Y); |
|
|
|
transform = new Transform(activeScale, activeOffset, activePhoto.Size); |
|
|
|
DrawTexture(active, photoBox, Color4.White, activePhoto.RotationDegrees); |
|
|
|
DrawTexture(active, photoBox, Color4.White, activePhoto.RotationDegreeHundredths / 100f); |
|
|
|
for (int i = 0; i < 5; i++) { |
|
|
|
Texture star = (activePhoto.Rating > i) ? STAR_FILLED : STAR_EMPTY; |
|
|
|
DrawTexture(star, geometry.StarBoxes[i].Min.X, geometry.StarBoxes[i].Min.Y); |
|
|
|