Skip to content

Commit

Permalink
Converted frametracker.js to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
Naviary2 committed Jan 3, 2025
1 parent 9fe5e01 commit 8999254
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/client/scripts/esm/game/gui/gui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import guipromotion from './guipromotion.js';
import style from './style.js';
// @ts-ignore
import statustext from './statustext.js';
// @ts-ignore
import frametracker from '../rendering/frametracker.js';
// @ts-ignore
import movement from '../rendering/movement.js';
Expand All @@ -23,7 +22,7 @@ import movement from '../rendering/movement.js';
// Variables ------------------------------------------------------------------------------


const element_overlay = document.getElementById('overlay')!;
const element_overlay: HTMLElement = document.getElementById('overlay')!;


// Functions ------------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion src/client/scripts/esm/game/gui/guinavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import stats from './stats.js';
import movepiece from '../../chess/logic/movepiece.js';
// @ts-ignore
import selection from '../chess/selection.js';
// @ts-ignore
import frametracker from '../rendering/frametracker.js';
// @ts-ignore
import guigameinfo from './guigameinfo.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

/** Whether there has been a visual change on-screen the past frame. */
let hasBeenVisualChange = true;
let hasBeenVisualChange: boolean = true;


/** The next frame will be rendered. Compute can be saved if nothing has visibly changed on-screen. */
Expand All @@ -21,12 +21,16 @@ function doWeRenderNextFrame() {
return hasBeenVisualChange;
}

/** Resets {@link hasBeenVisualChange} to false, to prepare for next frame. */
/**
* Resets {@link hasBeenVisualChange} to false, to prepare for next frame.
* Call right after we finish a render frame.
*/
function onFrameRender() {
hasBeenVisualChange = false;
}



export default {
onVisualChange,
doWeRenderNextFrame,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import camera from '../camera.js';
import board from '../board.js';
// @ts-ignore
import math, { BoundingBox } from '../../../util/math.js';
// @ts-ignore
import frametracker from '../frametracker.js';
// @ts-ignore
import preferences from '../../../components/header/preferences.js';
Expand Down

0 comments on commit 8999254

Please sign in to comment.