diff --git a/src/haxe/ru/m/Device.hx b/src/haxe/ru/m/Device.hx index c9a1660..563ab3c 100644 --- a/src/haxe/ru/m/Device.hx +++ b/src/haxe/ru/m/Device.hx @@ -1,5 +1,8 @@ package ru.m; +import flash.display.StageDisplayState; +import flash.Lib; + enum abstract Platform(String) from String to String { var ANDROID = "android"; var LINUX = "linux"; @@ -48,4 +51,15 @@ class Device { return false; #end } + + public static var fullScreenSupport(get, never):Bool; + + public static function get_fullScreenSupport():Bool { + return Lib.current.stage.allowsFullScreenInteractive; + } + + public static function toggleFullScreen():Void { + Lib.current.stage.displayState = Lib.current.stage.displayState == StageDisplayState.NORMAL ? + StageDisplayState.FULL_SCREEN_INTERACTIVE : StageDisplayState.NORMAL; + } } diff --git a/src/haxe/ru/m/puzzlez/view/PuzzlezAppView.hx b/src/haxe/ru/m/puzzlez/view/PuzzlezAppView.hx index be0bbfa..a1d0626 100644 --- a/src/haxe/ru/m/puzzlez/view/PuzzlezAppView.hx +++ b/src/haxe/ru/m/puzzlez/view/PuzzlezAppView.hx @@ -26,6 +26,8 @@ import haxework.view.group.VGroupView; switch event.keyCode { case Keyboard.ESCAPE: switcher.change(StartFrame.ID); + case Keyboard.F: + Device.toggleFullScreen(); case _: } }); diff --git a/src/haxe/ru/m/puzzlez/view/StartFrame.hx b/src/haxe/ru/m/puzzlez/view/StartFrame.hx index fc952a9..9f019b4 100644 --- a/src/haxe/ru/m/puzzlez/view/StartFrame.hx +++ b/src/haxe/ru/m/puzzlez/view/StartFrame.hx @@ -1,5 +1,7 @@ package ru.m.puzzlez.view; +import openfl.display.StageDisplayState; +import flash.Lib; import haxework.view.data.DataView; import haxework.view.form.ButtonView; import haxework.view.frame.FrameSwitcher; @@ -22,6 +24,7 @@ import ru.m.update.Updater; @:view("load") var loadButton:ButtonView; @:view("complete") var completeButton:ButtonView; @:view("update") var updateButton:ButtonView; + @:view("fullscreen") var fullscreenButton:ButtonView; @:provide var storage:ImageStorage; @:provide var switcher:FrameSwitcher; @@ -30,6 +33,7 @@ import ru.m.update.Updater; public function new() { super(ID); + fullscreenButton.visible = Device.fullScreenSupport; var data:Array = []; data.push({title: "Assets", source: storage.sources.get(AssetSource.ID)}); data.push({title: "Files", source: storage.sources.get(FileSource.ID)}); diff --git a/src/haxe/ru/m/puzzlez/view/StartFrame.yaml b/src/haxe/ru/m/puzzlez/view/StartFrame.yaml index c4c16ff..275797f 100644 --- a/src/haxe/ru/m/puzzlez/view/StartFrame.yaml +++ b/src/haxe/ru/m/puzzlez/view/StartFrame.yaml @@ -47,6 +47,11 @@ views: style: button.active +onPress: ~appUpdater.download() visible: false + - id: fullscreen + $type: haxework.view.form.ButtonView + text: Fullscreen + +onPress: ~Device.toggleFullScreen() + visible: false - $type: haxework.view.form.LabelView text: $r:text:version geometry.position: absolute