ftsf / nico

a Game Framework in Nim inspired by Pico-8.
MIT License
624 stars 35 forks source link

Nico uses one core to the max? #105

Closed matkuki closed 1 year ago

matkuki commented 1 year ago

Hi,

My specs:

Running any example uses one CPU core to the max. I tried setVSync both true/false, no difference. The code I test with is:

import nico

proc gameInit() =
  nico.loadFont(0, "font.png")

proc gameUpdate(dt: Pfloat) =
  discard

proc gameDraw() =
  cls()
  setColor(7)
  line(64,64,128,64)
  setColor(8)
  line(64,0,64,64)

  circ(70,70,10)

  print("something", 20, 80)

# initialization
nico.init("nico", "test")

# we want a fixed sized screen with perfect square pixels
nico.fixedSize(true)
nico.integerScale(true)

# Framerate
nico.fps(30)
nico.setVSync(true)

# create the window
nico.createWindow("nico", 128, 128, 4)

# start, say which functions to use for init, update and draw
nico.run(gameInit, gameUpdate, gameDraw)

Any ideas? Thanks

matkuki commented 1 year ago

Found that @markusgritsch 's pull-request fixes this: https://github.com/ftsf/nico/pull/90

aquova commented 10 months ago

I'd like to reopen this, I also am experiencing the same issue.