[client] icon button size for mobile devices

This commit is contained in:
2019-10-31 17:58:58 +03:00
parent 70e6565e1f
commit 6240846f0c
4 changed files with 8 additions and 12 deletions

View File

@@ -165,14 +165,16 @@ class AppTheme extends Theme {
}
private function registerButton(name:String, resource:String, solid:Bool = false):Void {
var size = Device.isMobile() ? 64 : 42;
var smallSize = Device.isMobile() ? 42 : 32;
register(new Style('button.$name', [
"geometry.width" => SizeValue.fromInt(42),
"geometry.height" => SizeValue.fromInt(42),
"geometry.width" => SizeValue.fromInt(size),
"geometry.height" => SizeValue.fromInt(size),
"skin" => function() return new ButtonSVGSkin(Assets.getText('resources/image/icon/$resource'), colors.light, solid),
]));
register(new Style('button.$name.small', [
"geometry.width" => SizeValue.fromInt(32),
"geometry.height" => SizeValue.fromInt(32),
"geometry.width" => SizeValue.fromInt(smallSize),
"geometry.height" => SizeValue.fromInt(smallSize),
"skin" => function() return new ButtonSVGSkin(Assets.getText('resources/image/icon/$resource'), colors.light, solid),
]));
}

View File

@@ -26,6 +26,7 @@ class Client {
L.d(TAG, 'Debug: ${Const.DEBUG}');
L.i(TAG, 'Version: ${Const.VERSION}');
L.i(TAG, 'Build: ${Const.BUILD}');
L.i(TAG, 'Mobile: ${Device.isMobile()}');
#if linux
LinuxIcon.apply();
#end

View File

@@ -64,13 +64,6 @@ using ru.m.tankz.view.ViewUtil;
}
}
private function packButtonFactory(index:Int, packId:PackId):ButtonView {
var result = new ButtonView();
result.style = "button.menu";
result.text = packId.toPackLabel();
return result;
}
private function startGame(packId:PackId):Void {
gameInit = LOCAL({state: new GameState(packId.type), level: null});
switcher.change(LevelFrame.ID, packId);

View File

@@ -1,7 +1,7 @@
---
style: button.menu
geometry.width: 200
geometry.height: 150
geometry.height: 130
geometry.padding: 5
layout.hAlign: center
layout.vAlign: middle