LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 05-03-2004, 01:33 AM   #1
lramos85
Member
 
Registered: Sep 2003
Location: Riverside, Ca
Distribution: Gentoo, FC3
Posts: 125

Rep: Reputation: 15
what is equivilent to graphics.h in linux?


Does anyone know what the equivilent of WIndows <graphics.h> for C++ avility to colors, etc. I have no Idea what it would be in Linux, can someone help me? Thanks.
 
Old 05-03-2004, 02:32 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
I don't know graphics.h, so can you be a bit more
specific about what it provides? "Colours" is a bit
vague ...


Cheers,
Tink
 
Old 05-03-2004, 07:06 AM   #3
llama_meme
Member
 
Registered: Nov 2001
Location: London, England
Distribution: Gentoo, FreeBSD
Posts: 590

Rep: Reputation: 30
Are you refering to the graphics library of Borland C++? In that case, the closest thing in Linux is probably the SDL library. See http://www.libsdl.org/index.php

Alex
 
Old 05-04-2004, 08:41 PM   #4
lramos85
Member
 
Registered: Sep 2003
Location: Riverside, Ca
Distribution: Gentoo, FC3
Posts: 125

Original Poster
Rep: Reputation: 15
This was done in windows I want to do it in Linux:
// Turbo C++ program

#include <iostream.h>
#include <graphics.h>
#include <math.h>

class RecursiveCurve {
public:
RecursiveCurve();
void readInitValues();
void snowflake();
void cross();
private:
double side, angle;
int level;
void right(double x) {
angle += x;
}
void left (double x) {
angle -= x;
}
void drawFourLines(double side, int level);
void drawCrossSide(double side, int level);
};

void RecursiveCurve::RecursiveCurve() {
setcolor(WHITE);
setbkcolor(BLUE);
moveto (200,150);
angle = 0.0;
cout << "Enter side and level: ";
cin >> side >> level;
}

void RecursiveCurve::drawFourLines(double side, int level) { // arguments to sin()
if (level == 0) // and cos() are angles
linerel((cos(angle*M_PI/180)*side), // specified in radians,
(sin(angle*M_PI/180)*side)); // i.e., the coefficient
else { // M_PI/180 is necessary;
drawFourLines(side/3.0,level-1);
left (60);
drawFourLines(side/3.0,level-1);
right(120);
drawFourLines(side/3.0,level-1);
left (60);
drawFourLines(side/3.0,level-1);
}
}

void RecursiveCurve::snowflake() {
for (int i = 1; i <= 3; i++) {
drawFourLines(side,level);
right(120);
}
}

void main() {
int grBoard = DETECT, grMode, grResult, grError;
initgraph(&grBoard,&grMode,"c:\\tc\\bgi");
grError = graphresult();
if (grError != grOk) {
cerr << "error: " << grapherrormsg(grError) << endl;
return;
}
RecursiveCurve().snowflake();
}
 
Old 05-05-2004, 02:13 PM   #5
llama_meme
Member
 
Registered: Nov 2001
Location: London, England
Distribution: Gentoo, FreeBSD
Posts: 590

Rep: Reputation: 30
The SDL library would be a good choice for that.

Alex
 
  


Reply



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
Linux equivilent to Window's "system tray"? TippyToes Linux - General 18 07-17-2005 08:08 AM
An "Acess Diver" equivilent in Linux? jon_k Linux - Security 2 06-26-2005 02:25 PM
Linux Equivilent to msconfig/services.msc? kompact Linux - Newbie 4 04-23-2005 10:40 AM
Need Linux equivilent of errpt ddyer Linux - Newbie 5 07-19-2004 01:16 PM
The Linux Equivilent of Yz Dock thebear Linux - General 6 10-28-2003 01:12 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:51 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
Open Source Consulting | Domain Registration