AAAAAAAAAAAAAAAAAAAAAAAAH
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { Game } from "./Game.js";
|
||||
import { Point } from "./Point.js";
|
||||
|
||||
import { renderCube } from "../../3D/cube.js"
|
||||
|
||||
class Ball
|
||||
{
|
||||
@ -42,12 +42,23 @@ class Ball
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {CanvasRenderingContext2D} ctx
|
||||
* @param {CanvasRenderingContext2D} ctx ou pas ptdr
|
||||
*/
|
||||
draw(ctx)
|
||||
{
|
||||
ctx.rect(this.position.x - this.size / 2, this.position.y - this.size / 2, this.size, this.size);
|
||||
}
|
||||
if(ctx instanceof CanvasRenderingContext2D)
|
||||
{
|
||||
ctx.rect(this.position_x, this.position_y, this.game.config.ball_size, this.game.config.ball_size);
|
||||
}
|
||||
else if(ctx instanceof WebGLRenderingContext)
|
||||
{
|
||||
renderCube(ctx, this.position_x, 0, this.position_y, 0, this.game.config.ball_size, this.game.config.ball_size, this.game.config.ball_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
alert('Unknown rendering context type (wtf)');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@ -74,4 +85,4 @@ class Ball
|
||||
}
|
||||
}
|
||||
|
||||
export { Ball };
|
||||
export { Ball }
|
||||
|
Reference in New Issue
Block a user