Skip to content

Commit

Permalink
Changed canvas name
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkauzh committed Oct 10, 2023
1 parent 16934db commit f5c0666
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/webzen/draw/pixel.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func SetPixel(x, y float64, color [4]int) {
canvas := document.GetElementById("canvas")
canvas := document.GetElementById("webzen")
context := canvas.GetContext("2d")

rgba := colors.GetRGBA(color)
Expand Down
4 changes: 2 additions & 2 deletions src/webzen/draw/rect.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func DrawRect(width, height, x, y float64, color [4]int) {
canvas := document.GetElementById("canvas")
canvas := document.GetElementById("webzen")
context := canvas.GetContext("2d")

rgba := colors.GetRGBA(color)
Expand All @@ -18,7 +18,7 @@ func DrawRect(width, height, x, y float64, color [4]int) {
}

func FillBackground(color [4]int) {
canvas := document.GetElementById("canvas")
canvas := document.GetElementById("webzen")
context := canvas.GetContext("2d")

rgba := colors.GetRGBA(color)
Expand Down
2 changes: 1 addition & 1 deletion src/webzen/draw/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func DrawText(text string, size, x, y int) {
canvas := document.GetElementById("canvas")
canvas := document.GetElementById("webzen")
context := canvas.GetContext("2d")

context.Set("font", strconv.Itoa(size)+"px Arial")
Expand Down
2 changes: 1 addition & 1 deletion src/webzen/image/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (i *Image) Draw() {
}

func DrawImage(imagePath string, width, height, x, y float64) {
canvas := document.GetElementById("canvas")
canvas := document.GetElementById("webzen")
context := canvas.GetContext("2d")

img := document.CreateElement("img")
Expand Down
4 changes: 2 additions & 2 deletions src/webzen/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ func SetFps(fps int) {
}

func clearCanvas() {
canvas := document.GetElementById("canvas")
canvas := document.GetElementById("webzen")
context := canvas.GetContext("2d")
context.ClearRect(0, 0, canvas.Get("width").Float(), canvas.Get("height").Float())
}

func Init() {
canvas := document.GetElementById("canvas")
canvas := document.GetElementById("webzen")
if canvas.IsNull() {
canvas = document.CreateCanvasElement()
canvas.Set("id", "canvas")
Expand Down
2 changes: 1 addition & 1 deletion src/webzen/shape/rect.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func NewRect(x, y, width, height float64, color [4]int) Rect {
}

func (r *Rect) Draw() {
canvas := document.GetElementById("canvas")
canvas := document.GetElementById("webzen")
context := canvas.GetContext("2d")

rgba := colors.GetRGBA(r.color)
Expand Down

0 comments on commit f5c0666

Please sign in to comment.