samizdatco / skia-canvas

A GPU-accelerated 2D graphics environment for Node.js
MIT License
1.73k stars 69 forks source link

Windows not appearing #159

Open kevinJ045 opened 4 months ago

kevinJ045 commented 4 months ago

No windows appear. i tried most examples. but nothing appears. i tried this code:

const { Window, Canvas } = require('skia-canvas')

let canvas = new Canvas(32, 32),
    colors = ['orange', 'yellow', 'green', 'skyblue', 'purple']

for (var c of colors){
  ctx = canvas.newPage(canvas.width * 2, canvas.height * 2)
  ctx.fillStyle = c
  ctx.fillRect(0,0, canvas.width, canvas.height)
  ctx.fillStyle = 'white'
  ctx.arc(canvas.width/2, canvas.height/2, 40, 0, 2 * Math.PI)
  ctx.fill()
}

let win = new Window({canvas, page:-2})
win.on('keydown', e => {
  if (e.key=='Left') win.page--
  if (e.key=='Right') win.page++
  console.log(`page ${win.page}/${canvas.pages.length}: ${canvas.width} × ${canvas.height}`)
})

It just logs this:

warning: queue 0x2b392ad0 destroyed while proxies still attached:
  wl_keyboard@16 still attached
  wl_output@13 still attached
  xdg_activation_v1@12 still attached
  zwp_pointer_constraints_v1@11 still attached
  zwp_text_input_manager_v3@10 still attached
  zxdg_decoration_manager_v1@9 still attached
  zwp_relative_pointer_manager_v1@8 still attached
  wl_shm@7 still attached
  wl_subcompositor@6 still attached
  wl_compositor@5 still attached
  wl_seat@4 still attached
  wl_registry@2 still attached

and quits, i am on nixos with wayland.