[view] add fullscreen button
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 _:
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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<ImageListSource> = [];
|
||||
data.push({title: "Assets", source: storage.sources.get(AssetSource.ID)});
|
||||
data.push({title: "Files", source: storage.sources.get(FileSource.ID)});
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user