• zokier 3 hours ago

    > Embedded-graphics includes bitmap fonts that have a very limited set of characters to save space (ASCII, ISO 8859 or JIS X0201). This makes it impossible to draw most of Ratatui's widgets, which heavily use box-drawing glyphs, Braille, and other special characters

    You have a bitmap display, you can just draw lines and stuff without needing to rely on font-based hacks.

    • weinzierl 2 hours ago

      Sure, but that's beside the point.

      Text based graphics with fancy or custom fonts is just crazy efficient. That is exactly how we got the amazing graphics of The Last Ninja or Turrican on machines with less than 64KiB useable RAM.

      Same for more modern embedded devices. If you constrain yourself to text you increase both runtime performance and your developer productivity.

      • orbital-decay 2 hours ago

        It was crazy efficient on character or tile-based hardware. It makes no difference on bitmap displays, or rather adds some overhead.

        • weinzierl 2 hours ago

          At the end of the day it's always pixels - alway has been [1] - and the efficiency of storing and blitting a small number of fixed size rectangles is hard to beat if you can get away with it.

          [1] Except for the early oscilloscope style vector displays maybe.

          • gmueckl an hour ago

            No, this is technically not fully correct. Early text based display output systems were relying on special character generator hardware to generate the display signals producing the text on screen. Those systems did not have any means of generating arbitrary pixel patterns.

            • weinzierl an hour ago

              Do you have an example? All the 8-bitters I know drew the characters from memory, which was a character ROM per default but could be changed either with a screw driver or by bank switching some RAM in-place.

              EDIT: If you mean they were not copied in a frame buffer first, you are right. I should not have written 'blitting'.

              • awkwardleon an hour ago

                Maybe too old to be applicable here, but the TRS-80 Models I and III (and probably more models) had no way to address pixels. You had to use semigraphic characters to emulate larger blocks at sub-character resolutions. https://bumbershootsoft.wordpress.com/2022/01/28/touring-the...

                • adiabatichottub 11 minutes ago

                  I recommend reading the TV Typewriter Cookbook.

                  https://archive.org/details/tvtcb_doc

                  • direwolf20 40 minutes ago

                    With character RAM you can still only have up to 256 unique 8x8 blocks on screen.

                    • LoganDark an hour ago

                      The character ROM was not read and processed by the CPU. The CPU set some bytes in video RAM, which served as indexes into the character ROM by the video output hardware.

                      I believe on some systems there were some tricks that allowed some bitmap display by redefining glyphs. One example off the top of my head is The 8-Bit Guy's Planet X2, which can use text mode but with glyphs redefined to use for icons, units, terrain, UI, etc.

                  • orbital-decay an hour ago

                    Character-based hardware only stores the characters and the grid instead of the full bitmap for the frame, which is very efficient memory-wise. Tile-based hardware (e.g. most console graphics chips in the 8/16 bit era) also had scrolling and layers, and was extremely memory-efficient as well. With bitmap displays you already store full frames.

                    • weinzierl an hour ago

                      Sure. Maybe I should not have written 'blitting' when the rectangles are not copied from one memory location to another but end up directly on the screen.

                      My original point that putting a fixed number of small and fixed rectangles on a screen is more efficient than line drawing still stands though.

                • zokier 2 hours ago

                  Are you claiming that scrapping together boxes and whatnot with line drawing characters is more efficient than just drawing the lines directly?

                  • LoganDark an hour ago

                    I think they're claiming that having character-based pipelines and algorithms can be more efficient than doing everything on the level of pixels... I can't help but feel there's a middle-ground somewhere, though.

              • Liftyee 22 minutes ago

                Really neat project but - Rust on embedded. Haven't tried it yet - has anyone got experience comparing it to C/C++?

                • nine_k 3 hours ago

                  «Mousefood - a no-std embedded-graphics backend for Ratatui!»

                  Hence 100% Rust. Works on ESP32, RPi2040, and even STM32. Several displays mentioned, including e-ink.

                  • orhunp_ 2 hours ago

                    Hey all, thanks for the interest to the crate!

                    I'm currently live on YouTube (doing some maintenance & testing). Feel free to join if you have any questions!

                    https://www.youtube.com/watch?v=PoYEQJbYNMc

                    • wjholden 3 hours ago

                      Cool! I just recently began learning the Raspberry Pi Pico. Could anyone recommend a specific display that I could use with the Pico 2/2W and Mousefood?

                      • GeertJohan 3 hours ago

                        This is awesome! I love ratatui, having it available on embedded is very cool! I wonder if it will work with async on embedded e.g. embassy..

                        • orhunp_ 2 hours ago

                          absolutely, it will work with any other embedded Rust application. The backend only provides a bridge between the embedded-graphics library and the Ratatui widget renderer.

                        • onjectic 3 hours ago

                          Reminds me a lot of the UI styles in the Minecraft mod ComputerCraft.

                          • LoganDark an hour ago

                            ComputerCraft was part of how I learned to code.

                            I first learned about password hashing when I tried to make the actually most secure door lock program. I first used raw SHA-256, but then someone on the forum introduced me to PBKDF2...

                            Sometimes I miss those days.

                            • orhunp_ 2 hours ago

                              we're bringing back those aesthetics!

                            • dbacar 3 hours ago

                              Hi Orhun, Could it be used with CYD (Cheap yellow display) ?

                              • orhunp_ 2 hours ago

                                Most likely. I just checked and it uses embedded-graphics already which means you can plug in Mousefood directly. The touchscreen might be a bit tricky though, it might need some hacking on the event handler side. But it will most likely work if you map the coordinates to the terminal cells abstraction somehow.

                                • nine_k 3 hours ago

                                  At the bottom of the page there is a mention of "Phone-OS - A modern phone OS for ESP32 CYD", so apparently it must be supported.

                                  • 01HNNWZ0MV43FF 3 hours ago
                                    • 0xbadcafebee an hour ago

                                      fwiw, in my research into this, it looks like there are inconsistencies in the devices available, since there's no one manufacturer and they're clones of clones. one might have been reliable but then it goes out of stock

                                  • IamDaedalus 3 hours ago

                                    aaaaand this how I learn rust I learned go because of bubbletea and mousefood (which combines my work as an embedded systems programmer and love for torminals) is here

                                    • redanddead 3 hours ago

                                      Oh bubbletea is really cool. Is this how most interactive CLIs are made?

                                      • GeertJohan 3 hours ago

                                        I used bubbletea for a while but quit it because of inconsistencies in the design. Went to ratatui and never looked back. Go and Bubbletea are nice, but rust is much more suited for building tuis.