Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 347
  • Last Modified:

Using Curses to on Console

Hi experts,

Need help on using curses (or whatever it is that you are ment to use) to make boarders on a unix console.

something that looks like:

XXXXXXXX
X
X
X
XXXXXXXX

its a basis for a game. But I dont know how to implement this.

Thanks.
0
Omer_85
Asked:
Omer_85
1 Solution
 
Kent OlsenData Warehouse Architect / DBACommented:
Hi Omer_85,

You can always download a linux distribution and extract the curses source.

If you want to do it the "hard way" you'll have to map out each character and build a bitmap for them.  It's a lot of tedious work.


Good Luck!
Kent
0
 
brettmjohnsonCommented:
Use getmaxyx() [or the LINES and COLUMNS global variables] to determine the number of lines and columns on the console window.  [Remember that the coordindates are 0-relative.]

Use move() to position the cursor for writing.

Use addch() or addstr() to write a character or string at the current cursor position.

Use refresh() to flush the output to the screen.

For more information, see this tutorial:
http://www.apmaths.uwo.ca/~xli/ncurses.html
0
 
Omer_85Author Commented:
Thanks for the comments guys..

Kent I've got no idea about Linux..

Brett I think your way sounds like the way to do it.. Just because I can use a UNIX library..

I'll try this method and get back to you.

Like I said its a basis for a pong game, for which I have most of the code for. I need to make the walls and paddle..

http://www.experts-exchange.com/Programming/Q_21846448.html

Any help on that question would be great too.

Omer..
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Omer_85Author Commented:
Hey brettmjohnson,

Ive tried making a window using the examples.

However all I get are errors..

The examples given dont actually help.

Could u provide any help.

Thanks
0
 
Omer_85Author Commented:
I've already done the research and found those sites plus many more.

They dont give any simple examples.

I just need to draw a border, but they show how to resize, move, etc. And cutting up the code is hard as I've never delt with curses before.

Thanks anyways.
0
 
lwulfersCommented:
Pong on a unix console... I remember the days....  Do yo uactually have access to the Curses lirary function. Your previuos comment "However all I get are errors.." doesn't tell us if these are complile errors or runtime errors....  What version of Unix are you running under?  Send some source code examples of what you are doing.
0
 
Omer_85Author Commented:
I got it working using standout() - reverse video.

Main tutorials I used were those provided by user 'brettmjohnson'.

Plus other curses tutorials and man pages...

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now