Oh my glorious code!

Started by
20 comments, last by cr88192 10 years, 8 months ago

Not necessarily. What I meant was doing some minimal coloring of whatever you're outputting, without taking over the entire console

That's exactly what I meant... =P

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.
Advertisement

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.

This topic is closed to new replies.

Advertisement