Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SparkedJs (Beta 2) :: "Draw/Draw UI.js"
- window.onresize = function() {
- resizeWindow();
- };
- function resizeWindow ( ) {
- flipBuffers ( ) ;
- }
- function drawUI ( ) {
- console.log(`Map: ${player.map + 1}/${Maps.length}`);
- BackBuffer.context.clearRect(
- 0,
- 0,
- BackBuffer.canvas.width,
- BackBuffer.canvas.height
- );
- BackBuffer.context.fillStyle = `argb( 0, 0, 0, 1.0 )`;
- BackBuffer.context.fillRect(
- 0,
- 0,
- BackBuffer.canvas.width,
- BackBuffer.canvas.height
- );
- BackBuffer.context.drawImage(
- Maps[player.map].canvas,
- 0,
- 0,
- Maps[player.map].canvas.width,
- Maps[player.map].canvas.height,
- 0,
- 0,
- BackBuffer.canvas.width,
- BackBuffer.canvas.height
- );
- BackBuffer.context.drawImage( // Dest Context
- Sprites[player.sprite].canvas, // Source Canavas
- 0, // Source X
- 0, // Source Y
- Sprites[player.sprite].xspan, // Source W
- Sprites[player.sprite].yspan, // Source H
- player.x * Sprites[player.sprite].xspan, // Dest X
- player.y * Sprites[player.sprite].yspan, // Dest Y
- Sprites[player.sprite].xspan, // Dest W
- Sprites[player.sprite].yspan // Dest H
- );
- BackBuffer.context.fillStyle = `argb( 255, 255, 255, 1.0 )`;
- BackBuffer.context.fillText(`Life: ` + player.tank, 10, 20);
- BackBuffer.context.fillText(`Bombs: ` + player.bomb, 10, 40);
- BackBuffer.context.fillText(`Shield: ` + player.shield, 10, 60);
- flipBuffers ( ) ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement