How to Draw lines in C/C++?

Status
Not open for further replies.

aditya.shevade

Console Junkie
Hi

I was wondering. There is not graphics header file that we have in Windows, under linux.

So What to do, if I want to draw some straight lines in C/C++ under linux or unix?

I want to draw kind of a table. So, what to do? ASCII characters donot work.

Aditya
 

kaustav_geek

1337 |)00|) \m/
ASCII Chars don't work ? Really ? Well... In case what you're telling is true, then I don't think there's any way...
 

Zeeshan Quireshi

C# Be Sharp !
could you post ur bit of code that u wrote for ASCII characters , may then i can help .

also if u could draw a rought sketch of what u wanna do , it would be better :)
 
OP
aditya.shevade

aditya.shevade

Console Junkie
^^ It's for a game of Tic-Tac-Toe. I just want to draw a 3X3 block of squares.

The code I used in windows is as follows :

Code:
printf("\n\n\n");

          printf("\n\t\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c",218,196,196,196,194,196,196,196,194,196,196,196,191);

          printf("\n\t\t\t\t%c ",179);

          printf("%c",game[0][0]);

          printf(" %c ",179);

          printf("%c",game[0][1]);

          printf(" %c ",179);

          printf("%c",game[0][2]);

          printf(" %c ",179);

          printf("\n\t\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c",195,196,196,196,197,196,196,196,197,196,196,196,180);

          printf("\n\t\t\t\t%c ",179);

          printf("%c",game[1][0]);

          printf(" %c ",179);

          printf("%c",game[1][1]);

          printf(" %c ",179);

          printf("%c",game[1][2]);

          printf(" %c ",179);

          printf("\n\t\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c",195,196,196,196,197,196,196,196,197,196,196,196,180);

          printf("\n\t\t\t\t%c ",179);

          printf("%c",game[2][0]);

          printf(" %c ",179);

          printf("%c",game[2][1]);

          printf(" %c ",179);

          printf("%c",game[2][2]);

          printf(" %c ",179);

          printf("\n\t\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c",192,196,196,196,193,196,196,196,193,196,196,196,217);

and when I use the same in linux, all I get is a strange combination of question marks and blanks.

So I wrote a program to find the ASCII values of the respective numbers, I found that lines are not there. The character set ends at 120 or so, there is nothing after that number but question marks.

Aditya
 

Manshahia

Resident Fanatic
to draw line u can use different algorithms like DDA, MID-Point etc etc...
very complicated though...
 

Zeeshan Quireshi

C# Be Sharp !
try rewriting ther Code in C++ n compiling with latest version of GCC ,

coz what i think that the libraries with which you're linking ur application are old n thus don't support extended characters .
 
OP
aditya.shevade

aditya.shevade

Console Junkie
I am using anjuta that came with OpenSuSE 10.2. Version 1.2.4a.
gcc is 4.0.3

Can you please tell me what else might I do? Or provide sample code?

Aditya
 
Status
Not open for further replies.
Top Bottom