SimpleWindow static defaultCamera

This commit is contained in:
2022-08-30 16:04:18 +00:00
parent fc3bf543ec
commit 84dc8c65b3
2 changed files with 7 additions and 8 deletions

View File

@@ -24,6 +24,7 @@
(FlxG.cameras.remove uiCamera false) (FlxG.cameras.remove uiCamera false)
(FlxG.cameras.add uiCamera))) (FlxG.cameras.add uiCamera)))
(set uiCamera (new FlxCamera)) (set uiCamera (new FlxCamera))
(set SimpleWindow.defaultCamera uiCamera)
(set uiCamera.bgColor FlxColor.TRANSPARENT) (set uiCamera.bgColor FlxColor.TRANSPARENT)
(FlxG.cameras.add uiCamera) (FlxG.cameras.add uiCamera)
(FlxG.plugins.add (new FlxMouseControl)) (FlxG.plugins.add (new FlxMouseControl))
@@ -279,8 +280,7 @@
(entryWindow.show) (entryWindow.show)
} }
null null FlxColor.WHITE 0.9 0.9 true)] null null FlxColor.WHITE 0.9 0.9 true)]
(set entryDeletionWindow delWindow) (set entryDeletionWindow delWindow))))
(set delWindow.cameras [uiCamera]))))
(when (= rewardFileIndex (- m.rewardFiles.length 1)) (when (= rewardFileIndex (- m.rewardFiles.length 1))
(_makeText "Abandon this puzzle" 0 (_makeText "Abandon this puzzle" 0
->_ ->_
@@ -707,8 +707,7 @@
(setModel model) (setModel model)
(entryWindow.show))) (entryWindow.show)))
(startPuzzlePackChoice nextStartingPoints)) (startPuzzlePackChoice nextStartingPoints))
null null FlxColor.LIME null 0.9)) null null FlxColor.LIME null 0.9)))
(set puzzlePackChoiceWindow.cameras [uiCamera]))
(var MIN_PUZZLE_SIZE 5) (var MIN_PUZZLE_SIZE 5)
(var MAX_PUZZLE_SIZE 32) (var MAX_PUZZLE_SIZE 32)
@@ -719,8 +718,7 @@
(for size PUZZLE_SIZE_OPTIONS (* size size)) (for size PUZZLE_SIZE_OPTIONS (* size size))
->:Void [:Int size] (startPiecesPerPointChoice (Std.int (Math.sqrt size)) startPuzzle) ->:Void [:Int size] (startPiecesPerPointChoice (Std.int (Math.sqrt size)) startPuzzle)
null null FlxColor.LIME null 0.9)) null null FlxColor.LIME null 0.9)))
(set puzzlePackChoiceWindow.cameras [uiCamera]))
(method :Void startPiecesPerPointChoice [size :StartPuzzleFunc startPuzzle] (method :Void startPiecesPerPointChoice [size :StartPuzzleFunc startPuzzle]
(let [maxPPP (Math.round (/ (* size size) (* MIN_PUZZLE_SIZE MIN_PUZZLE_SIZE)))] (let [maxPPP (Math.round (/ (* size size) (* MIN_PUZZLE_SIZE MIN_PUZZLE_SIZE)))]
@@ -730,8 +728,7 @@
(set puzzlePackChoiceWindow (SimpleWindow.promptForChoice "# of pieces to unlock per habit point:" (set puzzlePackChoiceWindow (SimpleWindow.promptForChoice "# of pieces to unlock per habit point:"
(collect (range 1 maxPPP)) (collect (range 1 maxPPP))
->:Void [:Int points] (startPuzzle size points) ->:Void [:Int points] (startPuzzle size points)
null null FlxColor.LIME null 0.9))) null null FlxColor.LIME null 0.9))))
(set puzzlePackChoiceWindow.cameras [uiCamera]))
(function pointsStr [points] (function pointsStr [points]
(let [&mut str "" tallyUnit 5 symbols ["+" "*" "\$"]] (let [&mut str "" tallyUnit 5 symbols ["+" "*" "\$"]]

View File

@@ -1,6 +1,7 @@
// All windows share the same text size // All windows share the same text size
(var &mut textSize 16) (var &mut textSize 16)
(var :kiss.List<SimpleWindow> windowStack []) (var :kiss.List<SimpleWindow> windowStack [])
(var &mut :flixel.FlxCamera defaultCamera null)
(prop &mut keyboardEnabled true) (prop &mut keyboardEnabled true)
@@ -23,6 +24,7 @@
:FlxKeyShortcutHandler<ShortcutAction> keyHandler (new FlxKeyShortcutHandler)] :FlxKeyShortcutHandler<ShortcutAction> keyHandler (new FlxKeyShortcutHandler)]
(super 0 0) (super 0 0)
(when defaultCamera (set this.cameras [defaultCamera]))
(makeGraphic (makeGraphic
(Std.int (* FlxG.width (or percentWidth 0.5))) (Std.int (* FlxG.width (or percentWidth 0.5)))
(Std.int (* FlxG.height (or percentHeight 0.5))) (Std.int (* FlxG.height (or percentHeight 0.5)))