Skip to content

Commit 8bb79ba

Browse files
committed
skip to next page from cartridges
1 parent 227d685 commit 8bb79ba

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Aanpassingen in de typescript `dev` map moet je publiceren naar de `docs` map me
5555
## TODO
5656

5757
- Vertical flex layout (of css grid)
58+
- Rewrite the whole pagination spaghetti code
5859

5960
## Credits
6061

dev/gridmenu.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,23 +83,22 @@ class GridMenu {
8383
}
8484

8585
public selectRow(dir: number) {
86-
8786
if (this.position.y == 2 && dir == -1) {
8887
// als we van paging naar games gaan, dan altijd column 4 selecteren
8988
this.position.x = 4
9089
this.position.y = 1
9190
} else if (this.position.y == 1 && this.position.x < 4 && dir == 1) {
9291
// the game grid really has 8 columns - but they are displayed as two rows with 4 columns in a grid
9392
// this if statement adds the ability to switch vertically between columns
94-
this.position.x += 4
93+
this.position.x += 4
9594
} else if (this.position.y == 1 && this.position.x > 3 && dir == -1) {
96-
this.position.x -= 4
95+
this.position.x -= 4
9796
} else {
9897
// selecteer nieuwe row binnen min en max aantal rows
9998
this.position.x = 0
10099
this.position.y = Math.min(Math.max(this.position.y + dir, 0), this.menu.length - 1)
101100
}
102-
// als we naar de paging row zijn gegaan, dan is de column de huidige page
101+
// // als we naar de paging row zijn gegaan, dan is de column de huidige page
103102
if (this.position.y == 2) {
104103
this.position.x = this.page
105104
}
@@ -108,19 +107,23 @@ class GridMenu {
108107
}
109108

110109
public selectColumn(dir: number) {
111-
// als we in de games row zijn, dan kan je met links/rechts ook naar een nieuwe page gaan
110+
// todo rewrite the whole paging / row selection
111+
112+
// links - vorige pagina
112113
if (this.position.y == 1 && this.position.x == 0 && dir == -1 && this.page > 0) {
113114
this.generateGamePage(dir)
114115
this.showPageNumber()
115116
this.position.x = 8
116-
} else if (this.position.y == 1 && this.position.x == 7 && dir == 1 && this.page < this.numpages - 1) {
117+
}
118+
119+
// rechts - volgende pagina
120+
if (this.position.y == 1 && this.position.x == 7 && dir == 1 && this.page < this.numpages - 1) {
117121
this.generateGamePage(dir)
118122
this.showPageNumber()
119123
this.position.x = -1
120124
}
121125

122126

123-
124127
let maxColumn = this.menu[this.position.y].length - 1
125128
this.position.x = Math.min(Math.max(this.position.x + dir, 0), maxColumn)
126129

docs/js/main.js

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

0 commit comments

Comments
 (0)