exaV / screeps-kotlin-types

Screep's Kotlin type definitions
MIT License
17 stars 18 forks source link

RoomVisual Styles non-functional? (What is the proper syntax?) #79

Closed 0megaD closed 4 months ago

0megaD commented 4 months ago

Perhaps I'm being an idiot, but I failed to successfully style any of the UI elements using this package. It looks like the options don't actually do anything, I always get a slightly opaque gray/white color.

What is the correct way to pass RoomVisual styles to the roomvisual functions?

Sample snippet:

RoomVisual("").rect(1, 1, 3.0, 3.0, style = object: RoomVisual.ShapeStyle {
        override var fill: String? = "#FF0000"
        override var lineStyle: LineStyleConstant? = LINE_STYLE_SOLID
        override var opacity: Double? = 0.1
        override var stroke: String? = "#0000FF"
        override var strokeWidth: Double? = 1.0
})
0megaD commented 4 months ago

I'm an idiot. 😄 I see I need to create a jsObject / options object and set the variables in there.

eg.:

RoomVisual("").rect(1, 1, 3.0, 3.0, options {
    fill = "#FF0000"
    lineStyle = LINE_STYLE_SOLID
    opacity = 0.1
    stroke = "#0000FF"
    strokeWidth = 1.0
})