• 0

Creating Graphical Command Line Interface (from scratch)


Question

Hello all,


I'm trying to create my own version of "ncurses" from scratch because I am bored, also I am trying to learn C# programming. I know that I can very easily create a GUI using Visual Studio, however I like graphical console apps.


Does anybody know of reading material that may help me understand the relations between windows, screens, and form elements. I so far have created a drawing system using box characters, as well as a basic system that holds an array of "Pixels", which is a class that I made that holds the following information:

...    
class Pixel
{
        private Coordinates location;	//a struct of (ushort x, ushort y)
        private char character;			// Holds any single character of "Text"
		private ConsoleColor characterColor;	// Holds the color of the single character of text
        private char backgroundCharacter;	// Holds a box character
        private ConsoleColor backgroundCharacterColor;			// Holds the backgroundCharacter color
....

Here is a quick preview of my window class:

...   
class Window
{
        private ushort windowWidth;
        private ushort windowHeight;
        private Coordinates origin;
        private String windowTitle;
        private BorderType border;
        private ConsoleColor borderColor;
        private ConsoleColor textColor;
        private ConsoleColor titleColor;
        private ConsoleColor backgroundColor;

        private Pixel[][] pixels;

       public Window(ushort _width, ushort _height, ushort originX, ushort originY, ConsoleColor _backgroundColor, ConsoleColor _textColor, String _title, ConsoleColor _titleColor)
        {
            this.windowWidth = _width;
            this.windowHeight = _height;
            origin.X = originX;
            origin.Y = originY;
            this.textColor = _textColor;
            this.titleColor = _titleColor;
            this.windowTitle = _title;
            this.backgroundColor = _backgroundColor;

            for (ushort x = 0; x < windowWidth; x++)
            {
                for (ushort y = 0; y < windowHeight; y++)
                {
                    this.pixels[x][y] = new Pixel(x, y);
                    this.pixels[x][y].setColor(this.backgroundColor);
                }
            }
        }
...

I am trying to find the most effective way to update the Window and currently have a blank screen class that will handle all the drawing. I have searched for a diagram that shows the different layers of a user interface to get an idea of how the events are handled and drawn, but haven't found anything that has helped my understanding. Is there any books that cover developing a graphical user interface or online articles? I don't want to learn how to use existing API's, but rather see one developed from scratch.

 

It would be totally easier if their was a port of ncurses for Windows 10. PDCurses was last updated in 2008, so I do not wish to use that. If anybody has heard of an alternative that works with today that I can use C# to program, I'd love to hear it.

 

Hopefully I didn't completely confuse everybody. Thanks!

1 answer to this question

Recommended Posts

  • 0
  On 24/07/2016 at 01:12, SpeedyTheSnail said:

 am trying to find the most effective way to update the Window and currently have a blank screen class that will handle all the drawing. I have searched for a diagram that shows the different layers of a user interface to get an idea of how the events are handled and drawn, but haven't found anything that has helped my understanding. Is there any books that cover developing a graphical user interface or online articles? I don't want to learn how to use existing API's, but rather see one developed from scratch.

 

It would be totally easier if their was a port of ncurses for Windows 10. PDCurses was last updated in 2008, so I do not wish to use that. If anybody has heard of an alternative that works with today that I can use C# to program, I'd love to hear it.

 

Hopefully I didn't completely confuse everybody. Thanks!

Expand  

https://github.com/search?utf8=✓&q=console+output+language%3Ac%23&type=Repositories&ref=searchresults

 

Also, the new Bash console in Windows 10 is well, Bash using code developed by Ubuntu guys

 

http://www.hanselman.com/blog/DevelopersCanRunBashShellAndUsermodeUbuntuLinuxBinariesOnWindows10.aspx

 

http://www.hanselman.com/blog/InstallingFishShellOnUbuntuOnWindows10.aspx

 

Also, new Windows 10 console in Anniversary Update has the ANSI stuff

 

http://www.hanselman.com/blog/ForgottenButAwesomeWindowsCommandPromptFeatures.aspx

 

Also, ConEmu:

 

http://conemu.github.io/en/Reviews.html

 

And of course we can't forget the REPL thing:

 

http://www.hanselman.com/blog/InteractiveCodingWithCAndFREPLsScriptCSOrTheVisualStudioInteractiveWindow.aspx

 

http://www.hanselman.com/blog/TheJoyOfLiveCodingCodePenREPLsTOPLAPAliveAndMore.aspx

 

 

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Burrrrn. Bought COD WWII last month when it was on sale for PC. Oh well. Excellent game tho, and the PC version plays/looks amazing (and has it's own PC achievements). ...wondering if this is a lesson on waiting on sales. ...also hoping Rise of the Tomb Raider has it's own PC Achievements
    • Google Chrome 137.0.7151.120 (offline installer) by Razvan Serea The web browser is arguably the most important piece of software on your computer. You spend much of your time online inside a browser: when you search, chat, email, shop, bank, read the news, and watch videos online, you often do all this using a browser. Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier. Use one box for everything--type in the address bar and get suggestions for both search and Web pages. Thumbnails of your top sites let you access your favorite pages instantly with lightning speed from any new tab. Desktop shortcuts allow you to launch your favorite Web apps straight from your desktop. Chrome has many useful features built in, including automatic full-page translation and access to thousands of apps, extensions, and themes from the Chrome Web Store. Google Chrome is one of the best solutions for Internet browsing giving you high level of security, speed and great features. Important to know! The offline installer links do not include the automatic update feature. Google Chrome 137.0.7151.120 changelog: [$7000][420697404] High CVE-2025-6191: Integer overflow in V8. Reported by Shaheen Fazim on 2025-05-27 [$4000][421471016] High CVE-2025-6192: Use after free in Profiler. Reported by Chaoyuan Peng (@ret2happy) on 2025-05-31 [425443272] Various fixes from internal audits, fuzzing and other initiatives Download web installer: Google Chrome Web 32-bit | Google Chrome 64-bit | Freeware Download: Google Chrome Offline Installer 64-bit | 128.0 MB Download: Google Chrome Offline Installer 32-bit | 115.0 MB Download page: Google Chrome Portable Download: Google Chrome MSI Installers for Windows (automatic update) View: Chrome Website | Release Notes Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • -Drop the art style, it's cool but doesn't fit the franchise at all. -Make it a gritty single player game, like Halo -Include deathmatch and all that stuff, extraction can be a separate mode If they don't do that, it's dead on arrival IMO.
    • It's a shame because it's one of the best immersive sims ever made, even though it could have used a bit more monster variety IMO.
  • Recent Achievements

    • One Month Later
      Custom Greek Shirts earned a badge
      One Month Later
    • Week One Done
      Custom Greek Shirts earned a badge
      Week One Done
    • One Year In
      Custom Greek Shirts earned a badge
      One Year In
    • Week One Done
      topantidetectbrowser earned a badge
      Week One Done
    • Explorer
      Jdoe25 went up a rank
      Explorer
  • Popular Contributors

    1. 1
      +primortal
      672
    2. 2
      ATLien_0
      281
    3. 3
      Michael Scrip
      223
    4. 4
      +FloatingFatMan
      190
    5. 5
      Steven P.
      146
  • Tell a friend

    Love Neowin? Tell a friend!