Automatic deploy 29000827

This commit is contained in:
Renan LE CARO 2025-02-20 12:07:42 +01:00
parent 8e258d77a3
commit 75f231015d
3 changed files with 35 additions and 17 deletions

View file

@ -11,8 +11,8 @@ android {
applicationId = "me.lecaro.breakout" applicationId = "me.lecaro.breakout"
minSdk = 21 minSdk = 21
targetSdk = 34 targetSdk = 34
versionCode = 29000798 versionCode = 29000827
versionName = "29000798" versionName = "29000827"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables { vectorDrawables {
useSupportLibrary = true useSupportLibrary = true

View file

@ -2334,9 +2334,11 @@ document.getElementById("menu").addEventListener("click", (e) => {
openSettingsPanel(); openSettingsPanel();
}); });
const options = { const options = {
sound: { sound: {
default: true, name: `Game sounds`, help: `Can slow down some phones.`, default: true, name: `Game sounds`, help: `Can slow down some phones.`,
disabled:()=>false
}, "mobile-mode": { }, "mobile-mode": {
default: window.innerHeight > window.innerWidth, default: window.innerHeight > window.innerWidth,
name: `Mobile mode`, name: `Mobile mode`,
@ -2344,29 +2346,43 @@ const options = {
afterChange() { afterChange() {
fitSize(); fitSize();
}, },
disabled:()=>false
}, },
basic: { basic: {
default: false, name: `Fast mode`, help: `Simpler graphics for older devices.`, default: false, name: `Fast mode`, help: `Simpler graphics for older devices.`,
disabled:()=>false
}, },
"easy": { "easy": {
default: false, name: `Easy mode`, help: `Slower ball as starting perk.`, restart: true, default: false, name: `Easy mode`, help: `Slower ball as starting perk.`, restart: true,
disabled:()=>false
}, "color_blind": { }, "color_blind": {
default: false, name: `Color blind mode`, help: `Removes mechanics about colors.`, restart: true, default: false, name: `Color blind mode`, help: `Removes mechanics about colors.`, restart: true,
disabled:()=>false
}, },
// Could not get the sharing to work without loading androidx and all the modern android things so for now i'll just disable sharing in the android app // Could not get the sharing to work without loading androidx and all the modern android things so for now i'll just disable sharing in the android app
"record": !window.location.search.includes('isInWebView=true') && { "record": {
default: false, name: `Record games`, help: `Get a video at the end of the run.`, restart: true, default: false, name: `Record gameplay videos`, help: `Get a video of each level.`,
disabled(){
return window.location.search.includes('isInWebView=true')
}
}, },
gif: {
default: false, name: `Make a gif too`, help: `3x heavier, 2x smaller, 7s max`,
disabled(){
return window.location.protocol === "file:" ||! isSettingOn('record')
}
}
}; };
async function openSettingsPanel() { async function openSettingsPanel() {
pause() pause()
const optionsList = []; const optionsList = [];
for (const key in options) { for (const key in options) {
if (options[key]) if (options[key] )
optionsList.push({ optionsList.push({
disabled:options[key].disabled(),
checked: isSettingOn(key) ? 1 : 0, checked: isSettingOn(key) ? 1 : 0,
max: 1, text: options[key].name, help: options[key].help, value: () => { max: 1, text: options[key].name, help: options[key].help, value: () => {
toggleSetting(key) toggleSetting(key)
@ -2653,8 +2669,6 @@ function recordOneFrame() {
} else { } else {
captureStream.getVideoTracks()[0].requestFrame() captureStream.getVideoTracks()[0].requestFrame()
} }
} }
@ -2669,19 +2683,20 @@ function drawMainCanvasOnSmallCanvas() {
recordCanvasCtx.fillText((currentLevel + 1) + '/' + max_levels(), 12, 12) recordCanvasCtx.fillText((currentLevel + 1) + '/' + max_levels(), 12, 12)
} }
let nthFrame = 0, gifFrameReduction = 2 let nthGifFrame = 0, gifFrameReduction = 2
function recordGifFrame() { function recordGifFrame() {
if(nthGifFrame/60>7) return
gifCtx.globalCompositeOperation = 'screen' gifCtx.globalCompositeOperation = 'screen'
gifCtx.globalAlpha = 1 / gifFrameReduction gifCtx.globalAlpha = 1 / gifFrameReduction
gifCtx?.drawImage(canvas, offsetXRoundedDown, 0, gameZoneWidthRoundedUp, gameZoneHeight, 0, 0, gifCanvas.width, gifCanvas.height) gifCtx?.drawImage(canvas, offsetXRoundedDown, 0, gameZoneWidthRoundedUp, gameZoneHeight, 0, 0, gifCanvas.width, gifCanvas.height)
nthFrame++ nthGifFrame++
if (nthFrame === gifFrameReduction) { if (!(nthGifFrame % gifFrameReduction)) {
levelGif.addFrame(gifCtx, {delay: Math.round(gifFrameReduction * 1000 / 60), copy: true}); levelGif.addFrame(gifCtx, {delay: Math.round(gifFrameReduction * 1000 / 60), copy: true});
gifCtx.globalCompositeOperation = 'source-over' gifCtx.globalCompositeOperation = 'source-over'
gifCtx.fillStyle = 'black' gifCtx.fillStyle = 'black'
gifCtx.fillRect(0, 0, gifCanvas.width, gifCanvas.height) gifCtx.fillRect(0, 0, gifCanvas.width, gifCanvas.height)
nthFrame = 0
} }
} }
@ -2709,7 +2724,8 @@ function startRecordingGame() {
gifCanvas.height = Math.floor(gameZoneHeight * scale / 2) gifCanvas.height = Math.floor(gameZoneHeight * scale / 2)
// Gif worker won't work there // Gif worker won't work there
if (window.location.protocol !== "file:") { if (window.location.protocol !== "file:" && isSettingOn('gif')) {
nthGifFrame = 0
levelGif = new GIF({ levelGif = new GIF({
workers: 2, workers: 2,
quality: 10, quality: 10,
@ -2719,6 +2735,8 @@ function startRecordingGame() {
height: gifCanvas.height, height: gifCanvas.height,
dither: false, dither: false,
}); });
}else{
levelGif=null
} }
// drawMainCanvasOnSmallCanvas() // drawMainCanvasOnSmallCanvas()

View file

@ -8,16 +8,16 @@
/> />
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Breakout 71</title> <title>Breakout 71</title>
<link rel="stylesheet" href="style.css?v=29000798" /> <link rel="stylesheet" href="style.css?v=29000827" />
<link rel="icon" href="./icon.svg" /> <link rel="icon" href="./icon.svg" />
</head> </head>
<body> <body>
<button id="menu"><span> menu</span></button> <button id="menu"><span> menu</span></button>
<button id="score"></button> <button id="score"></button>
<canvas id="game"></canvas> <canvas id="game"></canvas>
<script>window.appVersion="?v=29000798".slice(3)</script> <script>window.appVersion="?v=29000827".slice(3)</script>
<script src="gif.js"></script> <script src="gif.js"></script>
<script src="levels.js?v=29000798"></script> <script src="levels.js?v=29000827"></script>
<script src="game.js?v=29000798"></script> <script src="game.js?v=29000827"></script>
</body> </body>
</html> </html>