Skip to content

Commit 1eacbef

Browse files
committed
add nested menus
1 parent 05fdfb9 commit 1eacbef

File tree

31 files changed

+550
-35
lines changed

31 files changed

+550
-35
lines changed
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
for (var i=0; i<num_items; i++) {
2-
items[| i].destroy();
3-
delete items[| i];
4-
}
1+
if (ds_exists(items, ds_type_list)) {
2+
for (var i=0; i<num_items; i++) {
3+
items[| i].destroy();
4+
delete items[| i];
5+
}
56

6-
ds_list_destroy(items);
7+
ds_list_destroy(items);
8+
}
9+
710
delete control_state;

current-scripts/Demos/useful-scripts/objects/obj_column_menu/Draw_0.gml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ for (var i=0; i<num_items; i++) {
2626
}
2727
}
2828

29-
draw_sprite(cursor_spr, 0, x, y + (item_height + line_spacing) * pos + item_height / 2);
29+
if (enabled) {
30+
draw_sprite(cursor_spr, 0, x, y + (item_height + line_spacing) * pos + item_height / 2);
31+
}

current-scripts/Demos/useful-scripts/objects/obj_column_menu/obj_column_menu.yy

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

current-scripts/Demos/useful-scripts/objects/obj_column_menu_demo/Create_0.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
menu = instance_create_layer(32, 32, layer, obj_column_menu);
1+
menu = instance_create_layer(32, 64, layer, obj_column_menu);
22
menu.column_menu_init({
33
font: fnt_demo,
44
cursor_spr: spr_arrow,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
draw_set_font(fnt_title);
2+
draw_set_valign(fa_top);
3+
draw_set_halign(fa_center);
4+
draw_set_colour(c_white);
5+
draw_text(room_width/2, 16, "Column Menu Demo");

current-scripts/Demos/useful-scripts/objects/obj_column_menu_demo/obj_column_menu_demo.yy

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

current-scripts/Demos/useful-scripts/objects/obj_demo_title/Create_0.gml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ rooms = [
99
room_math_demo,
1010
room_column_menu_demo,
1111
room_grid_menu_demo,
12+
room_nested_menu_demo,
1213
room_strings_demo,
1314
room_web_demo
1415
];
@@ -25,6 +26,7 @@ room_names = [
2526
"Math",
2627
"Column Menu",
2728
"Grid Menu",
29+
"Nested Menu",
2830
"Strings",
2931
"Web"
3032
];
@@ -37,7 +39,7 @@ menu.column_menu_init({
3739
cursor_change_sfx: -1,
3840
cursor_confirm_sfx: -1,
3941
});
40-
menu.line_spacing = 16;
42+
menu.line_spacing = 8;
4143

4244
for (var i=0; i<num_rooms; i++) {
4345
menu.column_menu_add_selectable({
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
for (var i=0; i<ds_grid_width(items); i++) {
2-
for (var j=0; j<ds_grid_height(items); j++) {
3-
if (!is_struct(items[# i, j])) continue;
4-
items[# i, j].destroy();
5-
delete items[# i, j];
1+
if (ds_exists(items, ds_type_grid)) {
2+
for (var i=0; i<ds_grid_width(items); i++) {
3+
for (var j=0; j<ds_grid_height(items); j++) {
4+
if (!is_struct(items[# i, j])) continue;
5+
items[# i, j].destroy();
6+
delete items[# i, j];
7+
}
68
}
7-
}
89

9-
ds_grid_destroy(items);
10+
ds_grid_destroy(items);
11+
}
12+
1013
delete control_state;

current-scripts/Demos/useful-scripts/objects/obj_grid_menu/Draw_0.gml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ for (var i=0; i<ds_grid_width(items); i++) {
3030
}
3131
}
3232

33-
draw_sprite(cursor_spr, 0,
34-
x + (cursor_padding + column_width) * pos.x,
35-
y + (item_height + line_spacing) * pos.y + item_height / 2
36-
);
33+
if (enabled) {
34+
draw_sprite(cursor_spr, 0,
35+
x + (cursor_padding + column_width) * pos.x,
36+
y + (item_height + line_spacing) * pos.y + item_height / 2
37+
);
38+
}

current-scripts/Demos/useful-scripts/objects/obj_grid_menu/obj_grid_menu.yy

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)