Skip to content

Commit 5845dd0

Browse files
committed
Added Windows uiWid/Hei
1 parent 3cf7894 commit 5845dd0

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/game/ui/Window.hx

+13-13
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ class Window extends dn.Process {
1111
public static var ALL : Array<Window> = [];
1212
static var MODAL_COUNT = 0;
1313

14+
var uiWid(get,never) : Int; inline function get_uiWid() return M.ceil( w()/Const.UI_SCALE );
15+
var uiHei(get,never) : Int; inline function get_uiHei() return M.ceil( h()/Const.UI_SCALE );
16+
1417
public var content: h2d.Flow;
1518

1619
var ca : ControllerAccess<GameAction>;
@@ -150,35 +153,32 @@ class Window extends dn.Process {
150153

151154
root.setScale(Const.UI_SCALE);
152155

153-
var wid = M.ceil( w()/Const.UI_SCALE );
154-
var hei = M.ceil( h()/Const.UI_SCALE );
155-
156156
// Horizontal
157157
if( horizontalAlign==Fill )
158-
content.minWidth = content.maxWidth = wid;
158+
content.minWidth = content.maxWidth = uiWid;
159159

160160
switch horizontalAlign {
161161
case Start: content.x = 0;
162-
case End: content.x = wid-content.outerWidth;
163-
case Center: content.x = Std.int( wid*0.5 - content.outerWidth*0.5 + modalIdx*8 );
164-
case Fill: content.x = 0; content.minWidth = content.maxWidth = wid;
162+
case End: content.x = uiWid-content.outerWidth;
163+
case Center: content.x = Std.int( uiWid*0.5 - content.outerWidth*0.5 + modalIdx*8 );
164+
case Fill: content.x = 0; content.minWidth = content.maxWidth = uiWid;
165165
}
166166

167167
// Vertical
168168
if( verticalAlign==Fill )
169-
content.minHeight = content.maxHeight = hei;
169+
content.minHeight = content.maxHeight = uiHei;
170170

171171
switch verticalAlign {
172172
case Start: content.y = 0;
173-
case End: content.y = hei-content.outerHeight;
174-
case Center: content.y = Std.int( hei*0.5 - content.outerHeight*0.5 + modalIdx*4 );
175-
case Fill: content.y = 0; content.minHeight = content.maxHeight = hei;
173+
case End: content.y = uiHei-content.outerHeight;
174+
case Center: content.y = Std.int( uiHei*0.5 - content.outerHeight*0.5 + modalIdx*4 );
175+
case Fill: content.y = 0; content.minHeight = content.maxHeight = uiHei;
176176
}
177177

178178
// Mask
179179
if( mask!=null ) {
180-
mask.minWidth = wid;
181-
mask.minHeight = hei;
180+
mask.minWidth = uiWid;
181+
mask.minHeight = uiHei;
182182
}
183183
}
184184

0 commit comments

Comments
 (0)