btco / qx82

Tiny Javascript engine for retro games
MIT License
425 stars 20 forks source link

Render canvas on provided container #4

Closed pedroalmeida415 closed 9 months ago

pedroalmeida415 commented 1 year ago

It'd be nice if we could give an ID or an element itself to the initializer to tell it where to render the canvas, instead of just creating and appending a new canvas to the body

btco commented 1 year ago

Good idea!

btco commented 1 year ago

Thinking about this, but it's non-trivial because the canvas needs to have a pretty specific configuration in terms of width, height, etc to match the config...

photonstorm commented 1 year ago

I think the request is just asking to pass an id where the canvas will be appended (it's parent element) as opposed to adding it directly in the body.

I agree there's no point adding a feature to pass in a canvas element to actually use, but a parent makes sense.

btco commented 1 year ago

Ahh yes, that makes sense, but still the code is currently hard-coded to have the canvas the same size as window.innerWidth x window.innerHeight (cropped to aspect). If I refactor that a bit, I think I can then accept a parent element.

I will look into it. Thanks!

Le sam. 21 oct. 2023 à 10:58, Richard Davey @.***> a écrit :

I think the request is just asking to pass an id where the canvas will be appended (it's parent element) as opposed to adding it directly in the body.

I agree there's no point adding a feature to pass in a canvas element to actually use, but a parent makes sense.

— Reply to this email directly, view it on GitHub https://github.com/btco/qx82/issues/4#issuecomment-1773724060, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBXHTGCJL64SEVCWJ4RP63YAOFD5AVCNFSM6AAAAAA6DH2XFWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZTG4ZDIMBWGA . You are receiving this because you commented.Message ID: @.***>

btco commented 9 months ago

Just a note that I'm currently working on this and expect to have a solution soon-ish.

btco commented 9 months ago

There is now also a way to specify: