Skip to content

Commit 8181312

Browse files
committed
fix(sdk): remove method that tried to keep all lines at least 1 pixel wide
1 parent d2ecb79 commit 8181312

File tree

8 files changed

+8
-13
lines changed

8 files changed

+8
-13
lines changed

engine/modules/entities/src/main/resources/view/entity-module/Circle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class Circle extends Shape {
3232
if (state.fillColor !== null) {
3333
this.graphics.beginFill(state.fillColor, state.fillAlpha)
3434
}
35-
this.graphics.lineStyle(globalData.atLeastOnePixel(state.lineWidth), state.lineColor)
35+
this.graphics.lineStyle(state.lineWidth, state.lineColor)
3636
this.graphics.drawCircle(0, 0, state.radius * globalData.toWorldUnits)
3737
if (state.fillColor !== null) {
3838
this.graphics.endFill()

engine/modules/entities/src/main/resources/view/entity-module/GraphicEntityModule.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@ export class GraphicEntityModule {
1919
maskUpdates: {},
2020
updatedBuffers: [],
2121
players: [],
22-
instanceCount: 0,
23-
atLeastOnePixel: function (width) {
24-
if (width > 0 && width < this.toPixel) {
25-
return this.toPixel
26-
}
27-
return width
28-
}
22+
instanceCount: 0
2923
}
3024

3125
api.entities = this.entities

engine/modules/entities/src/main/resources/view/entity-module/Line.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default class Line extends Shape {
2424
changed.x2 ||
2525
changed.y2) {
2626
this.graphics.clear()
27-
this.graphics.lineStyle(globalData.atLeastOnePixel(state.lineWidth), state.lineColor, state.lineAlpha)
27+
this.graphics.lineStyle(state.lineWidth, state.lineColor, state.lineAlpha)
2828
this.graphics.moveTo(0, 0)
2929
this.graphics.lineTo(-this.container.x + state.x2 * globalData.toWorldUnits, -this.container.y + state.y2 * globalData.toWorldUnits)
3030
}

engine/modules/entities/src/main/resources/view/entity-module/Polygon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class Polygon extends Shape {
2525
this.graphics.beginFill(state.fillColor, state.fillAlpha)
2626
}
2727

28-
this.graphics.lineStyle(globalData.atLeastOnePixel(state.lineWidth), state.lineColor, state.lineAlpha)
28+
this.graphics.lineStyle(state.lineWidth, state.lineColor, state.lineAlpha)
2929
this.graphics.drawPolygon(state.points.map(coord => coord * globalData.toWorldUnits))
3030
if (state.fillColor !== null) {
3131
this.graphics.endFill()

engine/modules/entities/src/main/resources/view/entity-module/Rectangle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class Rectangle extends Shape {
3232
this.graphics.beginFill(state.fillColor, state.fillAlpha)
3333
}
3434

35-
this.graphics.lineStyle(globalData.atLeastOnePixel(state.lineWidth), state.lineColor, state.lineAlpha)
35+
this.graphics.lineStyle(state.lineWidth, state.lineColor, state.lineAlpha)
3636
this.graphics.drawRect(0, 0, state.width * globalData.toWorldUnits, state.height * globalData.toWorldUnits)
3737
if (state.fillColor !== null) {
3838
this.graphics.endFill()

engine/modules/entities/src/main/resources/view/entity-module/RoundedRectangle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class RoundedRectangle extends Shape {
3838
this.graphics.beginFill(state.fillColor, state.fillAlpha)
3939
}
4040

41-
this.graphics.lineStyle(globalData.atLeastOnePixel(state.lineWidth), state.lineColor, state.lineAlpha)
41+
this.graphics.lineStyle(state.lineWidth, state.lineColor, state.lineAlpha)
4242
this.graphics.drawRoundedRect(0, 0,
4343
state.width * globalData.toWorldUnits,
4444
state.height * globalData.toWorldUnits,

engine/modules/entities/src/main/resources/view/entity-module/Text.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class Text extends TextureBasedEntity {
3333
this.graphics.text = state.text
3434
this.graphics.style.align = state.textAlign
3535
this.graphics.style.stroke = state.strokeColor
36-
this.graphics.style.strokeThickness = globalData.atLeastOnePixel(state.strokeThickness)
36+
this.graphics.style.strokeThickness = state.strokeThickness
3737
this.graphics.style.fill = state.fillColor
3838
this.graphics.style.fontSize = state.fontSize || 1
3939
this.graphics.style.fontFamily = state.fontFamily

playground/misc/misc-3-release-notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The CodinGame SDK is regularly updated and improved. This document lets you know
88

99
- Fixed choppy animation when launching games with a `stepByStepAnimateSpeed`
1010
- Fixed situations in which stepping through a game with a `stepByStepAnimateSpeed` would not be animated.
11+
- Remove faulty code that was supposed to ensure all lines were at least 1 pixel thick. User now has greater control over line thickness.
1112

1213
## 3.11.0
1314

0 commit comments

Comments
 (0)