Files
42_INT_14_transcendence/src/client/draw.ts
LuckyLaszlo 3474d54a2b drawing now seperate from gameLoop
+ refactoring
+ added soundMutedFlag
2022-11-24 13:56:51 +01:00

46 lines
634 B
TypeScript

import { pong, gc } from "./global.js"
import { gridDisplay } from "./handleInput.js";
function drawLoop()
{
pong.clear();
drawStatic();
if (gridDisplay) {
drawGrid();
}
drawDynamic();
}
function drawDynamic()
{
gc.scoreLeft.update();
gc.scoreRight.update();
gc.playerLeft.update();
gc.playerRight.update();
gc.ball.update();
}
function drawStatic()
{
gc.wallTop.update();
gc.wallBottom.update();
gc.midLine.update();
}
function drawGrid()
{
gc.w_grid_mid.update();
gc.w_grid_u1.update();
gc.w_grid_d1.update();
gc.h_grid_mid.update();
gc.h_grid_u1.update();
gc.h_grid_d1.update();
}
export {drawLoop}