Jump to content

  • Log In with Google      Sign In   
  • Create Account

linux ncurses


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 hit   Members   -  Reputation: 113

Like
0Likes
Like

Posted 02 November 2012 - 11:13 PM

what is underneath ncurses?
what is the 'win32' eqivalent in linux?

i want to program at the OS level in linux

any help, thanks

Sponsor:

#2 frob   Moderators   -  Reputation: 22791

Like
0Likes
Like

Posted 02 November 2012 - 11:25 PM

>> what is underneath ncurses?
What is underneath is a rather complex library that handles hundreds of different raw terminal types.

>>what is the 'win32' eqivalent in linux?
The Unix world is fundamentally different from the Windows world. The Unix world revolves around networking, connections, terminals, and connectivity sessions. The Windows world generally revolves around a single graphical desktop per session.

There is ncurses for Windows if you are interested in providing the same text-based experience on the platform.

>> i want to program at the OS level in linux
The OS level -- the operating system level -- is the level for operating the hardware systems. Sure, you can do it. The kernel source and nearly every major driver source is available to you. What hardware do you want to operate? Or did you mean something else with that?

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I write about assorted stuff.


#3 hit   Members   -  Reputation: 113

Like
0Likes
Like

Posted 02 November 2012 - 11:54 PM

so the kernel has console fuctions like, setconsolecursorposition, etc?

i dont want to learn any libraries,wraps,etc, i want to be able to develop them.
I was originially learning win32, but it isnt open source

#4 frob   Moderators   -  Reputation: 22791

Like
0Likes
Like

Posted 03 November 2012 - 12:12 AM

No, the Linux kernel does not have quite that kind of functionality.

Think more in terms of escape codes across serial connections and writing directly to video memory.

The kernel talks to hardware. It provides an abstraction so programmers don't need to know about every video card's memory layout or every TTY's escape codes, they can simply have a virtual terminal with a cursor position and text color and such.

If you are really interested in it, the source isn't too hard to find. Go to kernel.org and download the source tree.

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I write about assorted stuff.


#5 SiCrane   Moderators   -  Reputation: 9675

Like
0Likes
Like

Posted 03 November 2012 - 07:55 AM

There is a level somewhat between curses and the kernel which is occupied by termcap and terminfo if you want to implement your own curses like library without drilling all the way down to the kernel.

#6 Katie   Members   -  Reputation: 1375

Like
1Likes
Like

Posted 03 November 2012 - 10:49 AM

Please don't do this. You're about to get sucked into a disaster of tears and pain.

"i want to program at the OS level in linux"

No you don't. Really, really, really, you don't. The only people who do this are people who are working on the OS. Everyone else uses the abstraction layers so they don't go insane and they do actually get some work done.

ncurses is good enough for people who implement shells, terminal media players, rogue-likes, interactive fiction games, tetris clones and a hundred others. It means their software runs reliably on thousands of configurations. It has had decades of development and debugging work by hundreds if not thousands of people.

Why would you give up all that? Because you imagine a performance gain? Painting a 1000 character display? Every screen refresh perhaps? On modern machines which are quite capable of repainting million-pixel displays at 50 or 60hz?

Why is this place so full of people who want to spend their time re-implementing these sorts of layers? Is it really just misguided masochism? Why do people want to faff about doing things like this instead of writing actual games?

#7 BitMaster   Crossbones+   -  Reputation: 4442

Like
0Likes
Like

Posted 05 November 2012 - 03:42 AM

Why is this place so full of people who want to spend their time re-implementing these sorts of layers? Is it really just misguided masochism? Why do people want to faff about doing things like this instead of writing actual games?


I don't think it's masochism. It's a combination of being new (to programming) and being young. Quite a few of the people starting like that will get shell-shocked and give up programming. Others will learn when to pick their battles and not try to reinvent every wheel and tiny cock and gear in the future. Some will decide that they like the fiddly engineering bits more than the game programming and we get people to work with the fiddly engineering bits. It's win-win for everyone. Well, except for the people completely giving it up.

I think it's fair to give people warning what they are about to get into, but if they want to dive head-first into the water, I'm not going to stand in their way. I did so too when I was much younger. It makes you appreciate having a mature and well-tested library for a boring task that still needs to be done.

Edited by BitMaster, 05 November 2012 - 03:47 AM.


#8 Bregma   Crossbones+   -  Reputation: 5499

Like
2Likes
Like

Posted 05 November 2012 - 06:01 AM

so the kernel has console fuctions like, setconsolecursorposition, etc?

The kernel does not support concepts like consoles or cursor positions, at least not directly.

The way it works in a POSIX system like Linux is a display (whether it's a physical terminal connected over an RS-232C serial port or a virtual terminal rendered on a video card, what Windows parlance calls a 'console') is represented by a special file called a 'device,' and more particularly a 'character special device.' You open the device, read from it, write to it, close it, and sometimes perform out-of-band control functions on it (the ioctl() system call).

The specifics of which device you use and what control codes you send vary from target device to target device (and OS to OS, but assuming you're using a recent Linux kernel, you're probably targeting a /dev/tty* device).

There are libraries (man termcap) that help hide some of the device-specific peculiarities. You can also read the source of the built-in TTY driver in the kernel itself if you want to do fun things with the 'system console'. Read the manual on ioctl() for some addition hints, and hardware manuals for the various hardware or emulated hardware of a terminal window.
Stephen M. Webb
Professional Free Software Developer

#9 Álvaro   Crossbones+   -  Reputation: 13934

Like
0Likes
Like

Posted 05 November 2012 - 11:08 AM

Bregma's post above is probably the most relevant. I wanted to add that, if you don't want to use ncurses, you can get some of its functionality by using ANSI escape codes.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS