ACTUALLY approximate square pieces for any puzzle aspect ratio
This commit is contained in:
@@ -455,6 +455,7 @@
|
|||||||
|
|
||||||
(prop &mut :FlxGroup nextPuzzleChoiceGroup null)
|
(prop &mut :FlxGroup nextPuzzleChoiceGroup null)
|
||||||
|
|
||||||
|
(var BASE_PUZZLE_SIZE 5)
|
||||||
(method startPuzzlePackChoice [nextStartingPoints]
|
(method startPuzzlePackChoice [nextStartingPoints]
|
||||||
(unless nextPuzzleChoiceGroup
|
(unless nextPuzzleChoiceGroup
|
||||||
(set nextPuzzleChoiceGroup (new FlxGroup))
|
(set nextPuzzleChoiceGroup (new FlxGroup))
|
||||||
@@ -472,8 +473,14 @@
|
|||||||
(nextPuzzleChoiceGroup.add (new FlxButton (+ x text.width) y "CHOOSE" ->:Void {
|
(nextPuzzleChoiceGroup.add (new FlxButton (+ x text.width) y "CHOOSE" ->:Void {
|
||||||
(remove nextPuzzleChoiceGroup)
|
(remove nextPuzzleChoiceGroup)
|
||||||
(set nextPuzzleChoiceGroup null)
|
(set nextPuzzleChoiceGroup null)
|
||||||
// TODO generate a good width and height while respecting user settings
|
(let [bmd (BitmapData.fromFile np.path)
|
||||||
(model.addRewardFile np.path nextStartingPoints 6 5)
|
aspectRatioX (/ bmd.width bmd.height)
|
||||||
|
aspectRatioY (/ bmd.height bmd.width)
|
||||||
|
w (max 1 (Math.round (* aspectRatioX BASE_PUZZLE_SIZE)))
|
||||||
|
h (max 1 (Math.round (* aspectRatioY BASE_PUZZLE_SIZE)))]
|
||||||
|
(model.addRewardFile np.path nextStartingPoints w h 1))
|
||||||
|
|
||||||
|
|
||||||
(setModel model)
|
(setModel model)
|
||||||
|
|
||||||
}))))
|
}))))
|
||||||
|
Reference in New Issue
Block a user