package whiteout;
import javafx.scene.paint.Color;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.Stop;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
public class Env {
public-init var screenWidth: Number;
public-init var screenHeight: Number;
public def smallFont =
if (screenWidth < 320)
Font {size: 15}
else
Font {size: 20}
public def mediumFont =
if (screenHeight >= 240)
Font {size: 40}
else
Font {size: 20}
public def bigFont =
if (screenWidth < 320)
Font {size: 30}
else
Font {size: 60}
def resetSize = Text {
content: "Reset"
font: smallFont
};
public def blueButtonHeight = resetSize.layoutBounds.height + 8;
public def blueButtonWidth = resetSize.layoutBounds.width + 10;
public def nButtons = 5;
def gameButtonGapPercent = .1;
def nButtonsPlusGaps = nButtons * (1 + gameButtonGapPercent);
def countSize = Text {
content: "222"
font: mediumFont
}
def controlSize = if (blueButtonWidth > countSize.layoutBounds.width)
blueButtonWidth
else
countSize.layoutBounds.width;
def gameButtonMaxX = if (screenWidth - 1.3 * controlSize < screenHeight)
screenWidth - 1.3 * controlSize
else
screenHeight;
public def gameButtonSize = gameButtonMaxX / (nButtonsPlusGaps + gameButtonGapPercent);
public def gameButtonGap = gameButtonSize * gameButtonGapPercent;
public def buttonX = gameButtonMaxX + (screenWidth - gameButtonMaxX - blueButtonWidth) / 2;
public def topMargin = (screenHeight - ((gameButtonSize * nButtonsPlusGaps) - gameButtonGap)) / 2;
public def slateGrad = LinearGradient{
startX: 0
startY: 0
endX: 0
endY: 1
stops: [
Stop {offset: 0.0, color: Color.rgb(0x34, 0x34, 0x34)}
Stop {offset: 0.5, color: Color.rgb(0x55, 0x55, 0x55)}
Stop {offset: 1.0, color: Color.rgb(0x43, 0x43, 0x43)}
]
}
public def blueGrad = LinearGradient{
startX: 0
startY: 0
endX: 0
endY: 1
stops: [
Stop {offset: 0.0, color:Color.rgb(0, 0x33, 0xff)}
Stop {offset: 0.5, color:Color.rgb(0, 0x55, 0xff)}
Stop {offset: 1.0, color:Color.BLUE}
]
}
}