jjant / runty8

A Pico8 clone in Rust.
MIT License
225 stars 17 forks source link

Following camera doesn't clear screen outside of the 128x128 area #63

Closed lesleyrs closed 1 year ago

lesleyrs commented 1 year ago

Was just trying to do pico8.camera(self.x - 56, self.y - 56); which works in pico8 but here it stops clearing screen when you're outside of the 128x128 coordinates.

Btw what is append_camera for?

lesleyrs commented 1 year ago

On top of that I'm not sure why the 2nd sprite on the spritesheet is being drawn 3 times on the map, it's supposed to be just the latter half of the spritesheet?

jjant commented 1 year ago

Can you provide a fully reproducible example?

Btw what is append_camera for?

It's a convenience function I use in the editor, it adds a camera offset to the current one. https://github.com/jjant/runty8/blob/cbb1d15a497afffe3930512b183b38cc4cf980ce/src/runty8-core/src/draw_data.rs#L39-L41

lesleyrs commented 1 year ago

https://github.com/lesleyrs/runty8-game-template

This is just the template game with following camera added to center the "character". If you move left/north of the 0, 0 coordinates it won't redraw correctly.

I guess the only way to fix this is to increase the screen buffer size? Having the render area be relative to the camera alone doesn't fix it because the camera doesn't need to be centered in a game.

jjant commented 1 year ago

Thank you! Your repro helped me find the issue, this will be fixed by #66 😄