code-battles 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -239,6 +239,33 @@ class GameCanvas:
|
|
|
239
239
|
self.context.lineTo(end_x, end_y)
|
|
240
240
|
self.context.stroke()
|
|
241
241
|
|
|
242
|
+
def draw_rectangle(
|
|
243
|
+
self,
|
|
244
|
+
start_x: int,
|
|
245
|
+
start_y: int,
|
|
246
|
+
width: int,
|
|
247
|
+
height: int,
|
|
248
|
+
fill="black",
|
|
249
|
+
stroke="transparent",
|
|
250
|
+
stroke_width=2,
|
|
251
|
+
board_index=0,
|
|
252
|
+
):
|
|
253
|
+
"""
|
|
254
|
+
Draws the given rectangle with the top-left corner at `(start_x, start_y)` (in map pixels) and with the specified `width` and `height` (in map pixels) with the given stroke and fill.
|
|
255
|
+
"""
|
|
256
|
+
|
|
257
|
+
start_x, start_y = self._translate_position(board_index, start_x, start_y)
|
|
258
|
+
width *= self._scale
|
|
259
|
+
height *= self._scale
|
|
260
|
+
|
|
261
|
+
self.context.fillStyle = fill
|
|
262
|
+
self.context.strokeStyle = stroke
|
|
263
|
+
self.context.lineWidth = stroke_width * self._scale
|
|
264
|
+
self.context.beginPath()
|
|
265
|
+
self.context.rect(start_x, start_y, width, height)
|
|
266
|
+
self.context.stroke()
|
|
267
|
+
self.context.fill()
|
|
268
|
+
|
|
242
269
|
def draw_circle(
|
|
243
270
|
self,
|
|
244
271
|
x: int,
|
package/package.json
CHANGED