2
* This file is part of the dis-Emi-A HaXe Library. Copyright © edA-qa mort-ora-y
3
* For full copyright and license information please refer to doc/license.txt.
12
* In such a Main class is where you put the title screen and
13
* main menu for a game.
15
* In this game however we don't have much of a main panel
16
* so we just add it alongside the in game menu. This panel
17
* is nonetheless setup and controlled here, the GameLayout
18
* simply needs to stick it somewhere.
20
class Main extends ui.StageLayout
22
var gameLayout : GameLayout;
24
var mainPanel : ui.LinearLayout;
25
var tfDifficulty : ui.StaticText;
32
mainPanel = ui.LinearLayout.vertical();
33
mainPanel.add( ui.StaticText.singleLine( "Game Options", 1.3 ) );
34
mainPanel.add( Button.plain( Action.bind( newGame ), "New Game" ) );
36
tfDifficulty = ui.StaticText.singleLine( "" );
37
mainPanel.add( tfDifficulty );
38
mainPanel.add( Button.plain( Action.bind1( alterDiff, 5 ), "Harder" ) );
39
mainPanel.add( Button.plain( Action.bind1( alterDiff, -5 ), "Easier" ) );
41
gameLayout = new GameLayout( mainPanel );
42
layout.add( gameLayout, ui.SizeType.Fill( 0 ) );
49
gameLayout.startNew( Options.difficulty );
52
function alterDiff( step : Int )
54
Options.difficulty += step;
55
if( Options.difficulty < 1 )
56
Options.difficulty = 1;
57
if( Options.difficulty > (GConst.numCells-GConst.boardSize) )
58
Options.difficulty = GConst.numCells - GConst.boardSize;
60
tfDifficulty.text = "Difficulty: " + Options.difficulty;
64
public static function main()
66
ui.StageLayout.setup( Main );
69
define(`IsVerticalLayout',true)
70
include(`ui/MixinLayout.ihx')
b'\\ No newline at end of file'