Build 29085573

This commit is contained in:
Renan LE CARO 2025-04-20 09:33:55 +02:00
parent a386c5f3d2
commit 66952cb1ca
6 changed files with 30 additions and 29 deletions

View file

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

File diff suppressed because one or more lines are too long

7
dist/index.html vendored

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
// The version of the cache. // The version of the cache.
const VERSION = "29084606"; const VERSION = "29085573";
// The name of the cache // The name of the cache
const CACHE_NAME = `breakout-71-${VERSION}`; const CACHE_NAME = `breakout-71-${VERSION}`;

View file

@ -1 +1 @@
"29084606" "29085573"

View file

@ -55,9 +55,9 @@ export function getHaloScale() {
return 16 * (isOptionOn("precise_lighting") ? 1 : 2); return 16 * (isOptionOn("precise_lighting") ? 1 : 2);
} }
let framesCounter=0 let framesCounter = 0;
export function render(gameState: GameState) { export function render(gameState: GameState) {
framesCounter++ framesCounter++;
startWork("render:init"); startWork("render:init");
const level = currentLevelInfo(gameState); const level = currentLevelInfo(gameState);
@ -111,15 +111,18 @@ export function render(gameState: GameState) {
""; "";
// Clear // Clear
if (!isOptionOn("basic") && level.svg && level.color === "#000000") { if (!isOptionOn("basic") && level.svg && level.color === "#000000") {
// TODO only if many coins on screen const skipN =
const skipN = isOptionOn('probabilistic_lighting') && liveCount(gameState.coins)> 150? 3 : 0 isOptionOn("probabilistic_lighting") && liveCount(gameState.coins) > 150
const shouldSkip = index=> skipN ? (framesCounter + index) % (skipN+1) !==0 : false ? 3
: 0;
const shouldSkip = (index) =>
skipN ? (framesCounter + index) % (skipN + 1) !== 0 : false;
const haloScale = getHaloScale(); const haloScale = getHaloScale();
startWork("render:halo:clear"); startWork("render:halo:clear");
haloCanvasCtx.globalCompositeOperation = "source-over"; haloCanvasCtx.globalCompositeOperation = "source-over";
haloCanvasCtx.globalAlpha = skipN ? 0.1:0.99 haloCanvasCtx.globalAlpha = skipN ? 0.1 : 0.99;
haloCanvasCtx.fillStyle = level.color; haloCanvasCtx.fillStyle = level.color;
haloCanvasCtx.fillRect(0, 0, width / haloScale, height / haloScale); haloCanvasCtx.fillRect(0, 0, width / haloScale, height / haloScale);
@ -129,7 +132,7 @@ export function render(gameState: GameState) {
0.1 + (0.5 * 10) / (liveCount(gameState.coins) + 10); 0.1 + (0.5 * 10) / (liveCount(gameState.coins) + 10);
startWork("render:halo:coins"); startWork("render:halo:coins");
forEachLiveOne(gameState.coins, (coin, index) => { forEachLiveOne(gameState.coins, (coin, index) => {
if(shouldSkip(index)) return if (shouldSkip(index)) return;
const color = getCoinRenderColor(gameState, coin); const color = getCoinRenderColor(gameState, coin);
drawFuzzyBall( drawFuzzyBall(
haloCanvasCtx, haloCanvasCtx,
@ -142,7 +145,7 @@ export function render(gameState: GameState) {
startWork("render:halo:balls"); startWork("render:halo:balls");
gameState.balls.forEach((ball, index) => { gameState.balls.forEach((ball, index) => {
if(shouldSkip(index)) return if (shouldSkip(index)) return;
haloCanvasCtx.globalAlpha = 0.3 * (1 - ballTransparency(ball, gameState)); haloCanvasCtx.globalAlpha = 0.3 * (1 - ballTransparency(ball, gameState));
drawFuzzyBall( drawFuzzyBall(
haloCanvasCtx, haloCanvasCtx,
@ -157,7 +160,7 @@ export function render(gameState: GameState) {
haloCanvasCtx.globalAlpha = 0.05; haloCanvasCtx.globalAlpha = 0.05;
gameState.bricks.forEach((color, index) => { gameState.bricks.forEach((color, index) => {
if (!color) return; if (!color) return;
if(shouldSkip(index)) return if (shouldSkip(index)) return;
const x = brickCenterX(gameState, index), const x = brickCenterX(gameState, index),
y = brickCenterY(gameState, index); y = brickCenterY(gameState, index);
drawFuzzyBall( drawFuzzyBall(
@ -173,7 +176,7 @@ export function render(gameState: GameState) {
startWork("render:halo:particles"); startWork("render:halo:particles");
haloCanvasCtx.globalCompositeOperation = "screen"; haloCanvasCtx.globalCompositeOperation = "screen";
forEachLiveOne(gameState.particles, (flash, index) => { forEachLiveOne(gameState.particles, (flash, index) => {
if(shouldSkip(index)) return if (shouldSkip(index)) return;
const { x, y, time, color, size, duration } = flash; const { x, y, time, color, size, duration } = flash;
const elapsed = gameState.levelTime - time; const elapsed = gameState.levelTime - time;
haloCanvasCtx.globalAlpha = haloCanvasCtx.globalAlpha =
@ -577,11 +580,10 @@ export function render(gameState: GameState) {
) { ) {
ctx.imageSmoothingEnabled = isOptionOn("smooth_lighting") || false; ctx.imageSmoothingEnabled = isOptionOn("smooth_lighting") || false;
if(isOptionOn('probabilistic_lighting')) { if (isOptionOn("probabilistic_lighting")) {
ctx.globalAlpha = 1; ctx.globalAlpha = 1;
ctx.globalCompositeOperation = "soft-light"; ctx.globalCompositeOperation = "soft-light";
} else { } else {
haloCanvasCtx.fillStyle = "#FFFFFF"; haloCanvasCtx.fillStyle = "#FFFFFF";
haloCanvasCtx.globalAlpha = 0.25; haloCanvasCtx.globalAlpha = 0.25;
haloCanvasCtx.globalCompositeOperation = "screen"; haloCanvasCtx.globalCompositeOperation = "screen";
@ -968,7 +970,7 @@ export function drawFuzzyBall(
x: number, x: number,
y: number, y: number,
) { ) {
width=Math.max(width,2) width = Math.max(width, 2);
const key = "fuzzy-circle" + color + "_" + width; const key = "fuzzy-circle" + color + "_" + width;
if (!color?.startsWith("#")) debugger; if (!color?.startsWith("#")) debugger;