AAAAAAAAAAAAAAAAAAAAAAAAH
This commit is contained in:
@ -79,23 +79,33 @@ class Player
|
||||
*/
|
||||
draw(ctx)
|
||||
{
|
||||
if (this.is_connected === false)
|
||||
{
|
||||
ctx.moveTo(this.rail.start.x, this.rail.start.y);
|
||||
ctx.lineTo(this.rail.stop.x, this.rail.stop.y);
|
||||
return;
|
||||
}
|
||||
let paddle_pos = new Point(this.rail.start.x + this.diff_x * this.position,
|
||||
this.rail.start.y + this.diff_y * this.position);
|
||||
if(ctx instanceof CanvasRenderingContext2D)
|
||||
{
|
||||
if (this.is_connected === false)
|
||||
{
|
||||
ctx.moveTo(this.rail.start.x, this.rail.start.y);
|
||||
ctx.lineTo(this.rail.stop.x, this.rail.stop.y);
|
||||
return;
|
||||
}
|
||||
let paddle_pos = new Point(this.rail.start.x + this.diff_x * this.position,
|
||||
this.rail.start.y + this.diff_y * this.position);
|
||||
|
||||
let start_x = paddle_pos.x - (this.diff_x * (this.paddle_size / 2 / this.rail_size)),
|
||||
start_y = paddle_pos.y - (this.diff_y * (this.paddle_size / 2 / this.rail_size)),
|
||||
stop_x = paddle_pos.x + (this.diff_x * (this.paddle_size / 2 / this.rail_size)),
|
||||
stop_y = paddle_pos.y + (this.diff_y * (this.paddle_size / 2 / this.rail_size));
|
||||
|
||||
|
||||
let start_x = paddle_pos.x - (this.diff_x * (this.paddle_size / 2 / this.rail_size)),
|
||||
start_y = paddle_pos.y - (this.diff_y * (this.paddle_size / 2 / this.rail_size)),
|
||||
stop_x = paddle_pos.x + (this.diff_x * (this.paddle_size / 2 / this.rail_size)),
|
||||
stop_y = paddle_pos.y + (this.diff_y * (this.paddle_size / 2 / this.rail_size));
|
||||
ctx.moveTo(start_x, start_y);
|
||||
ctx.lineTo(stop_x, stop_y);
|
||||
}
|
||||
else if(ctx instanceof WebGLRenderingContext)
|
||||
{
|
||||
|
||||
ctx.moveTo(start_x, start_y);
|
||||
ctx.lineTo(stop_x, stop_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
alert('Unknown rendering context type (wtf)');
|
||||
}
|
||||
}
|
||||
|
||||
from_json(data)
|
||||
@ -149,4 +159,4 @@ class Player
|
||||
}
|
||||
}
|
||||
|
||||
export { Player }
|
||||
export { Player }
|
||||
|
Reference in New Issue
Block a user