#Jansi Help

1 messages · Page 1 of 1 (latest)

iron ibex
#

I just don’t seem to get jansi, and the documentation is limited, and I can’t really find tutorials. Want to use it to make a roguelike game, but don’t even know where to get started with the library. Any help is much appreciated. Also I apologize to those who helped me yesterday, I don’t mean to be a bother.

cunning gazelleBOT
#

<@&987246399047479336> please have a look, thanks.

inland narwhal
#

just read this

#

jasni does two things

#
  1. Make ansii escape codes work on windows
#
  1. utilities for making strings that use ansii escape code
#

an ansii escape code is just like

#

if you do this

#
public class Main {
    public static void main(String[] args) {
        System.out.println("\u001b[1;31mHello, World");
    }
}
#

it will print red

#

so its that magic incantation on the front

minor lance
#

Are ansi escape codes universal across all OS's?

inland narwhal
#

\u001b[1;31m

inland narwhal
#

but the jasni library will replace System.out and System.err to make them work on windows

#

and to strip them out when you just cant

minor lance
#

sick

inland narwhal
#
        Ansi mapAscii = ansi()
                .eraseScreen();
#

so you can think of jansi's ansi type just like a string builder

#

just with special methods for adding ansi escape codes

#

like the one that tells your terminal to clear the screen

#
                    mapAscii
                            .fg(RED)
                            .a("*");
#

or the one that turns text red

minor lance
#

jansi works on linux too?

inland narwhal
#

yes

#

but it does replace System.out and System.err

#

which is certainly a choice

#

there is probably a way to use the library without doing that but i haven't dug

iron ibex
#

is there a way to use the ansi codes without using jansi? this is for a project, but i do plan to develop it further afterwards. i know for at least the project portion of it it will only be used on windows

inland narwhal
#

yes

#

oh wait only on windows?

#

kinda no?

#

i mean maybe, but its easiest to use jasni to at least do the systemInstall call

#

ansi codes only work in non-windows terminals usually

#

jansi does magic to make it work on windows too

iron ibex
#

ok, i can look into it more, libraries are confusing to me for some reason lol

#

also completely unrelated, but i code on my laptop and play games on my pc, is there a way to also code on my pc without having a separate workspace than my laptop, so all my stuff can carry over? kind of annoying to have to sit at my desk with my pc by it and code with my laptop when my pc is right in front of me

inland narwhal
#

well us professional coders sync our code to github

#

and pull it from whatever device

#

so thats worth learning how to do regardless