Comments (4)
I wasn't aware of this kind of issue, I originally tried to avoid overdrawing because printing chars is notoriously slow on most terminals (sometimes worse on Windows)
from console_engine.
Yea all I'm doing right now is just filling a full screen (actual screen) with dots which is a lot. I think it takes about 4 ms if I saw correctly (debug mode).
However speed is not my problem right now, I set the frame rate at 1 per second but because it immediately flushes if I draw more than a few rows it's just ignored and flushes instantly. Then whatever is drawn on top either flickers or doesn't show.
The part that I don't understand is that avoiding overdrawing can't be the fix to my problem as the FIRST frame in console_engine already loads the way it should.
In console_engine if you call:
let mut engine = console_engine::ConsoleEngine::init(160, 45, 1).unwrap();
It draws the entire screen (for me anyway) after waiting the full 1 second which is correct.
But my behavior on a simple project is when I draw the full screen this way it just flushes instantly, no waiting unless I draw a tiny area. I think I'll keep looking into this.
https://docs.rs/crossterm/latest/crossterm/macro.queue.html
Queued commands must be flushed to the underlying device to be executed. This generally happens in the following cases:
When flush is called manually on the given type implementing io::Write.
The terminal will flush automatically if the buffer is full.
Each line is flushed in case of stdout, because it is line buffered.
Edit: I see you have another draw function that uses execute!, but not sure about the difference in usage between them.
from console_engine.
Ok some friendly guy in the crossterm discord helped me solve the problem. I had to replace:
let mut stdout = stdout();
with
let mut stdout = BufWriter::with_capacity(640000, stdout());
I guess the reason you didn't need to do this is because you are using screens as the buffer and that magically solves it? Problem solved anyway :D
from console_engine.
Interesting to know though, thank you for reporting back !
from console_engine.
Related Issues (12)
- Code Review Needed !
- How to see errors from console engine? HOT 5
- Emojis causing trouble HOT 14
- Switch to Key/Mouse EventHandlers HOT 4
- Bump crossterm version to 0.25
- in ConsoleEngine::init, a target_fps > 1000 results in a division by 0 error HOT 3
- What about Backslash? HOT 1
- On windows 10 you can't restart snake example if you hit left wall HOT 1
- Bold pixels HOT 3
- `is_key_released` gets triggered when the key isn't being released HOT 1
- Add support for Crossterm's FocusGained, FocusLost and Paste
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from console_engine.