greenfork / nimraylib_now

The Ultimate Raylib gaming library wrapper for Nim
MIT License
151 stars 17 forks source link

Bouncing balls example doesn't runs - isKeyPressed expects a cint instead of KeyboardKey #76

Open rishavs opened 2 years ago

rishavs commented 2 years ago

The Bouncing Balls example does not compile successsfully and throws an error at isKeyPressed.

    if isKeyPressed(SPACE): pause = not pause

throws

C:\Users\risharan\Documents\Dev\nim\nimRaylibNow-starter-template\src\game.nim(56, 20) Error: type mismatch: got <KeyboardKey>
but expected one of:
proc isKeyPressed(key: cint): bool
  first type mismatch at position: 1
  required type for key: cint
  but expression 'SPACE' is of type: KeyboardKey

The error goes away if I add converters to the imports. In the discord discussion @greenfork said "examples usually load nimraylib_now which re-exports other files including converters. that's strange, maybe I forgot to put it somewhere https://github.com/greenfork/nimraylib_now/blob/master/src/nimraylib_now.nim"

greenfork commented 2 years ago
cd examples/shapes
nim r shapes_bouncing_ball.nim

compiles and runs for me alright. I see that you have it in your own file game.nim. I think that maybe you could take a look at the example and see what's different in your file?