Skip to content

Commit b815ebb

Browse files
committed
[+] menu transition
1 parent 98ef363 commit b815ebb

File tree

7 files changed

+36
-8
lines changed

7 files changed

+36
-8
lines changed

mod/dna/hud/Menu.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/* Menu Component
2+
*
3+
* The core defining structure is the items property.
4+
* It defines all menu items and corresponding actions.
5+
*
6+
*/
17
const df = {
28
x: 0,
39
y: 0,
@@ -73,7 +79,7 @@ class Menu {
7379
this.hidden = true
7480
this.paused = true
7581
this.disabled = true
76-
lab.control.controller.restoreAll()
82+
//lab.control.controller.restoreAll()
7783
if (this.trap.onHide) this.trap.onHide()
7884
}
7985

mod/dna/trait/screenTrait.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
function init() {
22
// name MUST be removed to avoid augmentation collision
33
delete this.name
4+
delete this.init
45
}
56

67
function hide() {

mod/lab/screen/menu/_menu.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@ const name = 'menu'
22

33
const DNA = 'hud/Menu'
44

5-
5+
const items = [
6+
'New Game',
7+
'Options',
8+
'Credits',
9+
]

mod/lab/screen/title/control.js

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ function evo(dt) {
1313
}
1414

1515
function next() {
16+
if (env.config.menu) {
17+
trap('menu')
18+
return
19+
}
20+
1621
lab.control.screen.transitTo('pond', {
1722
next: function() {
1823
//log('fading out from pond')

mod/setup/screen.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
function screen() {
22
extend(lab.pond, dna.trait.screenTrait)
3+
4+
// inject screenTrait into every node of screen if needed
35
lab.screen._ls.forEach(screen => {
4-
extend(screen, dna.trait.screenTrait)
6+
if (screen.DNA !== 'hud/Menu') {
7+
extend(screen, dna.trait.screenTrait)
8+
}
59
})
610
}
711
screen.Z = 11

mod/trap/menu.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function menu() {
2+
lab.control.screen.transitTo('menu', {
3+
next: function() {
4+
//log('fading out from pond')
5+
//trap('newGame')
6+
}
7+
})
8+
}

todo.ml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
> stat widget
2-
> winning conditions
3-
> game restart
41
> 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
77
V smooth zoom in/out
88
V limit zoom
99
V limit scroll

0 commit comments

Comments
 (0)