mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-26 04:07:24 +00:00
Scale mobile UI
This commit is contained in:
15
birb.js
15
birb.js
@@ -2,7 +2,8 @@
|
||||
|
||||
// @ts-ignore
|
||||
const SHARED_CONFIG = {
|
||||
cssScale: 1,
|
||||
birbCssScale: 1,
|
||||
uiCssScale: 1,
|
||||
canvasPixelSize: 1,
|
||||
hopSpeed: 0.07,
|
||||
hopDistance: 45,
|
||||
@@ -14,6 +15,7 @@ const DESKTOP_CONFIG = {
|
||||
};
|
||||
|
||||
const MOBILE_CONFIG = {
|
||||
uiCssScale: 0.9,
|
||||
flySpeed: 0.125,
|
||||
};
|
||||
|
||||
@@ -21,9 +23,10 @@ const CONFIG = { ...SHARED_CONFIG, ...isMobile() ? MOBILE_CONFIG : DESKTOP_CONFI
|
||||
|
||||
let debugMode = location.hostname === "127.0.0.1";
|
||||
|
||||
const CSS_SCALE = CONFIG.cssScale;
|
||||
const BIRB_CSS_SCALE = CONFIG.birbCssScale;
|
||||
const UI_CSS_SCALE = CONFIG.uiCssScale;
|
||||
const CANVAS_PIXEL_SIZE = CONFIG.canvasPixelSize;
|
||||
const WINDOW_PIXEL_SIZE = CANVAS_PIXEL_SIZE * CSS_SCALE;
|
||||
const WINDOW_PIXEL_SIZE = CANVAS_PIXEL_SIZE * BIRB_CSS_SCALE;
|
||||
const HOP_SPEED = CONFIG.hopSpeed;
|
||||
const FLY_SPEED = CONFIG.flySpeed;
|
||||
const HOP_DISTANCE = CONFIG.hopDistance;
|
||||
@@ -586,6 +589,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI
|
||||
new MenuItem("Field Guide", insertFieldGuide),
|
||||
// new MenuItem("Decorations", insertDecoration),
|
||||
new DebugMenuItem("Applications", () => switchMenuItems(otherItems), false),
|
||||
new MenuItem("Sticky Note", newStickyNote),
|
||||
new MenuItem(`Hide ${birdBirb()}`, hideBirb),
|
||||
new DebugMenuItem("Reset Data", resetSaveData),
|
||||
new DebugMenuItem("Unlock All", () => {
|
||||
@@ -596,7 +600,6 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI
|
||||
new DebugMenuItem("Disable Debug", () => {
|
||||
debugMode = false;
|
||||
}),
|
||||
new MenuItem("Add Sticky Note", newStickyNote),
|
||||
new Separator(),
|
||||
new MenuItem("Settings", () => switchMenuItems(settingsItems), false),
|
||||
];
|
||||
@@ -1637,11 +1640,11 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI
|
||||
}
|
||||
|
||||
function getCanvasWidth() {
|
||||
return canvas.width * CSS_SCALE
|
||||
return canvas.width * BIRB_CSS_SCALE
|
||||
}
|
||||
|
||||
function getCanvasHeight() {
|
||||
return canvas.height * CSS_SCALE
|
||||
return canvas.height * BIRB_CSS_SCALE
|
||||
}
|
||||
|
||||
function hop() {
|
||||
|
||||
Reference in New Issue
Block a user