File tree 7 files changed +36
-8
lines changed
7 files changed +36
-8
lines changed Original file line number Diff line number Diff line change
1
+ /* Menu Component
2
+ *
3
+ * The core defining structure is the items property.
4
+ * It defines all menu items and corresponding actions.
5
+ *
6
+ */
1
7
const df = {
2
8
x : 0 ,
3
9
y : 0 ,
@@ -73,7 +79,7 @@ class Menu {
73
79
this . hidden = true
74
80
this . paused = true
75
81
this . disabled = true
76
- lab . control . controller . restoreAll ( )
82
+ // lab.control.controller.restoreAll()
77
83
if ( this . trap . onHide ) this . trap . onHide ( )
78
84
}
79
85
Original file line number Diff line number Diff line change 1
1
function init ( ) {
2
2
// name MUST be removed to avoid augmentation collision
3
3
delete this . name
4
+ delete this . init
4
5
}
5
6
6
7
function hide ( ) {
Original file line number Diff line number Diff line change @@ -2,4 +2,8 @@ const name = 'menu'
2
2
3
3
const DNA = 'hud/Menu'
4
4
5
-
5
+ const items = [
6
+ 'New Game' ,
7
+ 'Options' ,
8
+ 'Credits' ,
9
+ ]
Original file line number Diff line number Diff line change @@ -13,6 +13,11 @@ function evo(dt) {
13
13
}
14
14
15
15
function next ( ) {
16
+ if ( env . config . menu ) {
17
+ trap ( 'menu' )
18
+ return
19
+ }
20
+
16
21
lab . control . screen . transitTo ( 'pond' , {
17
22
next : function ( ) {
18
23
//log('fading out from pond')
Original file line number Diff line number Diff line change 1
1
function screen ( ) {
2
2
extend ( lab . pond , dna . trait . screenTrait )
3
+
4
+ // inject screenTrait into every node of screen if needed
3
5
lab . screen . _ls . forEach ( screen => {
4
- extend ( screen , dna . trait . screenTrait )
6
+ if ( screen . DNA !== 'hud/Menu' ) {
7
+ extend ( screen , dna . trait . screenTrait )
8
+ }
5
9
} )
6
10
}
7
11
screen . Z = 11
Original file line number Diff line number Diff line change
1
+ function menu ( ) {
2
+ lab . control . screen . transitTo ( 'menu' , {
3
+ next : function ( ) {
4
+ //log('fading out from pond')
5
+ //trap('newGame')
6
+ }
7
+ } )
8
+ }
Original file line number Diff line number Diff line change 1
- > stat widget
2
- > winning conditions
3
- > game restart
4
1
> main menu
5
- > zoom in to the mouse position
6
- > credits screen
2
+ > game restart
3
+ V credits
4
+ V zoom in to the mouse position
5
+ V winning conditions
6
+ V stat widget
7
7
V smooth zoom in / out
8
8
V limit zoom
9
9
V limit scroll
You can’t perform that action at this time.
0 commit comments