Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualcr88192

Posted 12 August 2013 - 09:24 AM

If stdout supports ANSI escape codes (e.g. the terminals on *nix or DOS with ANSI.SYS) you could use the escape codes for even more interesting stuff without moving away from the standard library. Colors everywhere!

 

ANSI codes are nifty...

 

FWIW, the console in my engine also supports them to some extent, though not to the level that allows a full UI (this currently requires hooking console events and drawing directly into the console buffer), thus leading to the funkiness of doing a DOS-style UI inside of a 3D engine (I actually have an in-engine text editor with a vaguely similar color scheme and style to QBasic and MS Edit, though actually a little worse as it partly handles most non-trivial commands VI-style...).

 

as-is, it would require some tweaks to the console, and probably something analogous to stdout/stdin, such as to allow "programs" the ability to receive user-input (beyond generally being one-off console commands). at that rate, it would almost be worthwhile to throw together a little logic to allow console-commands to trigger loading/executing self-contained script files.

 

say something like:

function main(argv:string[]):void
{
    var s:string;
    var a:string[];
    stdout.printf("Greets!\n");
    while(!stdin.feof())
    {
        s=stdin.gets();
        a=s.split();
        if(a[0]=="north")
            { ... }
        ...
    }
}

I once considered possibly supporting render-to-texture with consoles, say to allow consoles to be textured onto in-game objects, but never did much with this.


#1cr88192

Posted 12 August 2013 - 09:23 AM

If stdout supports ANSI escape codes (e.g. the terminals on *nix or DOS with ANSI.SYS) you could use the escape codes for even more interesting stuff without moving away from the standard library. Colors everywhere!

 

ANSI codes are nifty...

 

FWIW, the console in my engine also supports them to some extent, though not to the level that allows a full UI (this currently requires hooking console events and drawing directly into the console buffer), thus leading to the funkiness of doing a DOS-style UI inside of a 3D engine (I actually have an in-engine text editor with a vaguely similar color scheme and style to QBasic and MS Edit, though actually a little worse as it partly handles most non-trivial commands VI-style...).

 

as-is, it would require some tweaks to the console, and probably something analogous to stdout/stdin, such as to allow "programs" the ability to receive user-input (beyond generally being on-off console commands). at that rate, it would almost be worthwhile to throw together a little logic to allow console-commands to trigger loading/executing self-contained script files.

 

say something like:

function main(argv:string[]):void
{
    var s:string;
    var a:string[];
    stdout.printf("Greets!\n");
    while(!stdin.feof())
    {
        s=stdin.gets();
        a=s.split();
        if(a[0]=="north")
            { ... }
        ...
    }
}

I once considered possibly supporting render-to-texture with consoles, say to allow consoles to be textured onto in-game objects, but never did much with this.


PARTNERS