46 lines
634 B
TypeScript
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}
|