LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 03-17-2011, 01:37 PM   #16
Samael
Member
 
Registered: Oct 2008
Location: England
Distribution: Ubuntu and Fedora (64-bit)
Posts: 81

Rep: Reputation: 16

This may help:
http://stackoverflow.com/questions/2...latform-manner
 
Old 03-17-2011, 02:19 PM   #17
SigTerm
Member
 
Registered: Dec 2009
Distribution: Slackware 12.2
Posts: 379

Rep: Reputation: 233Reputation: 233Reputation: 233
Is this("Linux console color and other tricks") or this("Prompt Magic") what you were looking for?
 
Old 03-17-2011, 03:32 PM   #18
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Quote:
Originally Posted by Samael View Post
But, if you do that, you will end up back here asking essentially the same question next time your code needs to run on a different terminal type. That's one of the problems that ncurses solves.

--- rod.
 
1 members found this post helpful.
Old 03-19-2011, 02:03 PM   #19
shivi91
LQ Newbie
 
Registered: Mar 2011
Location: india
Posts: 24

Original Poster
Rep: Reputation: 0
thanks but i still don't get the code in lang c++...
 
Old 03-19-2011, 02:11 PM   #20
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714
Quote:
Originally Posted by shivi91 View Post
thanks but i still don't get the code in lang c++...
Do you really expect us to write your code for you?

And you never really said what you want. Do you want to:

Be able to draw stuff (not limited to text) in a graphical window

--- OR ---

Be able to change the color of text printed to a terminal?


Those are very different, unrelated things and require completely different answers.
 
Old 03-19-2011, 02:23 PM   #21
dugan
Senior Member
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 4,987

Rep: Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555
Quote:
Originally Posted by shivi91 View Post
i have no clue abt the high tech terms that every1 is using...
So look up the words you don't understand.

Last edited by dugan; 03-19-2011 at 02:39 PM.
 
Old 03-19-2011, 02:44 PM   #22
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Lots of people have tried to help you. We need more information, and we have asked you specific questions that you can answer to give us that information. You gave us
Quote:
i still don't get the code in lang c++
When you help us help you, maybe that code will start to happen.
--- rod.
 
Old 03-19-2011, 02:48 PM   #23
dugan
Senior Member
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 4,987

Rep: Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555
You've already been given enough resources that you can write the code yourself. You use ncurses or s-lang for the cursor position and stuff, and ANSI escape sequences for the colors. Yes this requires you to read the links that were previously posted. And no, we're not going to write it for you.
 
Old 03-19-2011, 10:36 PM   #24
John VV
Guru
 
Registered: Aug 2005
Posts: 13,485

Rep: Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803
When i here graphics in "c" i think of
Cimg.h

a very nice lib ( built at compile)
 
1 members found this post helpful.
Old 03-20-2011, 02:47 AM   #25
shivi91
LQ Newbie
 
Registered: Mar 2011
Location: india
Posts: 24

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by John VV View Post
When i here graphics in "c" i think of
Cimg.h

a very nice lib ( built at compile)

whenver i try to complie on of the tutorial program they have given in that site..
error occurs that is

p2.cpp:3:19: fatal error: CImg.h: No such file or directory
compilation terminated.





the code is
#include <Cimg>
using namespace cimg_library;

int main() {
CImg<unsigned char> image("lena.jpg"), visu(500,400,1,3,0);
const unsigned char red[] = { 255,0,0 }, green[] = { 0,255,0 }, blue[] = { 0,0,255 };
image.blur(2.5);
CImgDisplay main_disp(image,"Click a point"), draw_disp(visu,"Intensity profile");
while (!main_disp.is_closed() && !draw_disp.is_closed()) {
main_disp.wait();
if (main_disp.button() && main_disp.mouse_y()>=0)
{
const int y = main_disp.mouse_y();
visu.fill(0).draw_graph(image.get_crop(0,y,0,0,image.width()-1,y,0,0),red,1,1,0,255,0);
visu.draw_graph(image.get_crop(0,y,0,1,image.width()-1,y,0,1),green,1,1,0,255,0);
visu.draw_graph(image.get_crop(0,y,0,2,image.width()-1,y,0,2),blue,1,1,0,255,0).display(draw_disp);
}
}
return 0;
}



i tried the same code with c complier .it didn't work
 
Old 03-20-2011, 03:02 AM   #26
shivi91
LQ Newbie
 
Registered: Mar 2011
Location: india
Posts: 24

Original Poster
Rep: Reputation: 0
#include <graphics.h>

#include <stdlib.h>

#include <stdio.h>

#include <conio.h>

#include<iostream.h>



int main(void)

{

/* request auto detection */

int gdriver = DETECT, gmode, errorcode;

int left, top, right, bottom;



/* initialize graphics and local variables */

initgraph(&gdriver, &gmode, "");



/* read result of initialization */

errorcode = graphresult();

if (errorcode != grOk) /* an error occurred */

{

printf("Graphics error: %s\n", grapherrormsg(errorcode));

printf("Press any key to halt:");

getch();

exit(1); /* terminate with an error code */

}

cout<<endl<<endl<<endl<<" zxc HOSPITAL" <<endl<<endl<<" name-abc age-56 "<<endl<<endl<<" reg no-907 Dr name-mno"<<endl;

left = getmaxx() / 2 - 200;

top = getmaxy() / 2 - 200;

right = getmaxx() / 2 + 200;

bottom = getmaxy() / 2 + 200;



/* draw a rectangle */

rectangle(left,top,right,bottom);



/* clean up */



getch();

closegraph();



return 0;

}


i am tring to convert this code for fedora
but i quite get stuck at few things
conio should be replaced with what.
graphics.h doesn't work what should be done for that?
 
Old 03-20-2011, 03:12 AM   #27
shivi91
LQ Newbie
 
Registered: Mar 2011
Location: india
Posts: 24

Original Poster
Rep: Reputation: 0
slang..tried to use that... but same kind of error...
fatal error

what should b done?
 
Old 03-20-2011, 03:24 AM   #28
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,633
Blog Entries: 29

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
List out here the errors you get when you remove conio.h and then compile.
 
Old 03-20-2011, 03:55 AM   #29
John VV
Guru
 
Registered: Aug 2005
Posts: 13,485

Rep: Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803
Quote:
whenver i try to complie on of the tutorial program they have given in that site..
error occurs that is

p2.cpp:3:19: fatal error: CImg.h: No such file or directory
i take it you did NOT copy cimg.h to /usr/include
-- or ---
and give the full or relative PATH to it in the source folder
every example in the "examples" ( for the examples the relative path would be " ../ " ) folder uses that "Makefile" to build all of them
Code:
make MLinux
 
Old 03-20-2011, 05:35 AM   #30
shivi91
LQ Newbie
 
Registered: Mar 2011
Location: india
Posts: 24

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by John VV View Post
i take it you did NOT copy cimg.h to /usr/include
-- or ---
and give the full or relative PATH to it in the source folder
every example in the "examples" ( for the examples the relative path would be " ../ " ) folder uses that "Makefile" to build all of them
Code:
make MLinux
hey i downloaded cimg.h from net
pasted that in /usr/include.but still the program shows the same error
 
  


Reply

Tags
c++, graphics


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] ATI graphics on Fedora 14 Dagorath Linux - Hardware 3 03-03-2011 07:55 AM
Graphics problem in fedora 10.. RAJEEV N BHARSHETTY Linux - Newbie 1 09-09-2009 10:01 AM
What are you using for a graphics card in Fedora? moxieman99 Fedora 3 03-19-2009 12:56 PM
graphics.h in fedora kantu Linux - Newbie 1 10-14-2008 01:26 PM
fedora 3 problem with graphics anjani.78 Linux - Newbie 8 07-05-2005 10:53 AM


All times are GMT -5. The time now is 08:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration