feat(achievements): implement achievements screen
This commit is contained in:
30
app/utils/achievements.ts
Normal file
30
app/utils/achievements.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
export const ACHIEVEMENTS_LINE_HEIGHT = 14;
|
||||
export const ACHIEVEMENTS_HEADER_Y = 20;
|
||||
export const ACHIEVEMENTS_LIST_START_Y = ACHIEVEMENTS_HEADER_Y + 55;
|
||||
export const ACHIEVEMENTS_BOTTOM_START_Y = 10;
|
||||
export const ACHIEVEMENTS_TOP_SCREEN_COUNT = Math.floor(
|
||||
(LOGICAL_HEIGHT - ACHIEVEMENTS_LIST_START_Y) / ACHIEVEMENTS_LINE_HEIGHT,
|
||||
);
|
||||
|
||||
export const CHECKBOX_SIZE = 7;
|
||||
export const CHECKBOX_TEXT_GAP = 5;
|
||||
export const ACHIEVEMENTS_X = 55;
|
||||
|
||||
export const drawCheckbox = (
|
||||
ctx: CanvasRenderingContext2D,
|
||||
x: number,
|
||||
y: number,
|
||||
checked: boolean,
|
||||
) => {
|
||||
ctx.fillRect(x, y, CHECKBOX_SIZE, 1);
|
||||
ctx.fillRect(x, y + CHECKBOX_SIZE - 1, CHECKBOX_SIZE, 1);
|
||||
ctx.fillRect(x, y + 1, 1, CHECKBOX_SIZE - 2);
|
||||
ctx.fillRect(x + CHECKBOX_SIZE - 1, y + 1, 1, CHECKBOX_SIZE - 2);
|
||||
|
||||
if (checked) {
|
||||
for (let i = 2; i < CHECKBOX_SIZE - 2; i++) {
|
||||
ctx.fillRect(x + i, y + i, 1, 1);
|
||||
ctx.fillRect(x + CHECKBOX_SIZE - 1 - i, y + i, 1, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user