ftsf / nico

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

`nico.nim(2227, 19) Error: type mismatch: got '(int, int, int32, int32)' for '(int(x), int(y), src.w * scale, src.h * scale)' but expected 'Rect = tuple[x: int, y: int, w: int, h: int]'` #121

Open arkanoid87 opened 10 months ago

arkanoid87 commented 10 months ago
choosenim stable
nimble install nico
nicoboot test test test
cd test
nimble webd
arkanoid87 commented 10 months ago

nim 1.6.14 + rund = works nim 1.6.14 + webd = works nim 2.0.0 + rund = works nim 2.0.0 + webd = error

HVukman commented 10 months ago

Have the same problem with Nim2.0

Angluca commented 6 months ago

Fix it

let dst: Rect = (x.int, y.int, src.w * scale.int, src.h * scale.int)
HVukman commented 5 months ago

Can build now with webr on Ubuntu, but I cannot run it in the browser (this is the basic example):

registerOrRemoveHandler: the target element for event handler registration does not exist, when processing the following event handler registration:Object allowsDeferredCalls: true callbackfunc: 609 eventTypeString: "touchstart" handlerFunc: e=> {…} target: null useCapture: 0

and then:

Aborted(Runtime error: The application has corrupted its heap memory area (address zero)!) abort @ niconim.js:1 Uncaught RuntimeError: Aborted(Runtime error: The application has corrupted its heap memory area (address zero)!) at abort (niconim.js:1:20947) at checkStackCookie (niconim.js:1:17381) at handleException (niconim.js:1:99085) at callUserCallback (niconim.js:1:118954) at Object.runIter (niconim.js:1:129885) at Browser_mainLoop_runner (niconim.js:1:128289)

Angluca commented 5 months ago

@HVukman Sorry I haven't use nico in linux so don't know .

But you can test it.

  1. Install sdl2 and emscripten
  2. Use this nimble (nimble webr and runweb) or bash input command test https://github.com/Angluca/nico/blob/main/exampleApp/exampleApp.nimble
    nim c -d:emscripten -o:exampleApp.html src/main.nim
    emrun exampleApp.html
HVukman commented 5 months ago

^ This works under WIndows, thanks. Edit: if anybody stumbles upon this and uploads their game on itch.io: You need to enable SharedBufferSupport https://itch.io/t/2025776/experimental-sharedarraybuffer-support