How to make COSMOS console scrollable in C#? #2592
Replies: 2 comments
-
If you want to make the default VGA console scroll up and down, you'll need to make a console buffer that will hold previous lines. This would be a ring buffer, with its length being equal to the amount of lines you want to store. You can implement this in a multitude of ways, but the most obvious way is a fixed size linked list of character arrays (with their lengths being equal to the text mode width). Please keep in mind you'll need to handle things such as line wrapping yourself. Whenever you'll want to print a character, just get the last linked list element and set the element at the next character index to the character you want to print. You'll need to redraw the whole console screen to scroll up or down. Cosmos's console implementation is a simple wrapper over the VGA console, and I'm not sure if there are any facilities to help you with this specific task. The most obvious problem with this approach is that linked lists do not permit random access, and thus if you'd want to print something on specific (x, y) coordinates, you'd need to iterate over each element until you find the suitable line. |
Beta Was this translation helpful? Give feedback.
-
I have the same question too. |
Beta Was this translation helpful? Give feedback.
-
I've recently been playing around with COSMOS (the operating system builder). I sometimes like to print many lines of text to the console, and was wondering if it is possible to make the COSMOS console scroll.
Do I need to make a GUI and a window for a Terminal inside the GUI, or is there some other way? And if I have to make a GUI with a Terminal window inside it, how might I do that?
I'm relatively new to C# and COSMOS development, so sorry if this is an obvious question.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions