Skip to content

Commit

Permalink
Fix queue drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanjermakov committed Nov 4, 2024
1 parent dbf8023 commit 4f7fc39
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/component/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export const App: Component = () => {
truePieceY: undefined,
frameDropped: undefined,
lockResets: 0,
queue: generateQueue(piecesDescription, piecesDescription.length * 64),
queue: generateQueue(piecesDescription, piecesDescription.length),
queueIndex: 0,
holdAvailable: true
}
Expand Down Expand Up @@ -317,8 +317,9 @@ export const App: Component = () => {
const drawQueue = (state: State): void => {
const { colors } = config.visual
const offset = vec(2.5, 0)
// TODO: won't show pieces when wrapping queue around
state.queue.slice(state.queueIndex, state.queueIndex + config.visual.visibleQueuePieces).forEach(pieceId => {
for (let i = state.queueIndex; i < state.queueIndex + config.visual.visibleQueuePieces; i++) {
const idx = i % state.queue.length
const pieceId = state.queue[idx]
const height = Math.max(...piecesDescription[pieceId].blocks.map(b => b.y)) + 1
offset.y -= height
const rotationModeOffset = vec(piecesDescription[pieceId].rotationMode === 'normal' ? 0 : -0.5, 0)
Expand All @@ -327,7 +328,7 @@ export const App: Component = () => {
{ fill: colors[pieceId + 3], stroke: colors[1] }
)
offset.y -= 1
})
}
}

const drawHold = (state: State): void => {
Expand Down

0 comments on commit 4f7fc39

Please sign in to comment.