-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fancy console is not cleared if .cls() is the only operation #278
Comments
I think this is fixed in the current Github version; there is a "set dirty" call (indicating that it needs redrawing) in place. Would you mind switching your project to try the current build? In bracket-lib = "0.8" with bracket-lib = { git = "https://github.com/amethyst/bracket-lib.git" } In the interim, I'll see if I can cook up a test case to be sure. |
@thebracket The problem still exists in the current master branch. I patched this locally by changing the fn cls(&mut self) {
self.is_dirty = true;
for tile in &mut self.tiles {
tile.glyph = 32;
tile.fg = RGBA::from_u8(255, 255, 255, 255);
tile.bg = RGBA::from_u8(0, 0, 0, 255);
}
} This effectively replicates the behaviour of a simple console. I didn't open a PR as I was following the related thread #255 Hope this helps! |
Sorry for the delay. Anyway, @patchfx is right and his workaround works |
I've applied this patch, it looks like it worked from here - thank you! |
Yeah I think this poses an issue when Flexiconsole is not the bottom layer, it will leave permanent black bg on tiles that cover consoles under it. Changing the alpha values from 255 to 0 in those .cls() methods fixed that for me, but not sure if that's the correct fix or just happens to bandaid my specific issue. Edit: Both FlexiConsole and SparseConsole only store tiles that actively have a glyph in them, so this change to the cls() function would mean tiles are only ever added or replaced with 'blanked out' tiles, slowly filling up the Vec? |
Following the Hands On Rust's first chapter, I implemented the "Flappy Dragon" game. After that I followed this post https://hands-on-rust.com/2021/02/08/from-flappy-dragon-to-flappy-bonus/ to improve it, obtaining this: https://gist.github.com/nicolaracco/18d6ed34571f8f4cf4a42b39457f38a1
But I noticed that when the player hits an obstacle, it is still rendered on screen, so I added a ctx.cls() call on the dead function: https://gist.github.com/nicolaracco/18d6ed34571f8f4cf4a42b39457f38a1#file-flappy_dragon-rs-L135
But even with this call, when the "You are dead" screen is shown, the dragon sprite stays on screen. If I add any other draw call (like another ctx.set_fancy call), the problem disappears (but I would not to draw anything in this case :))
The text was updated successfully, but these errors were encountered: