LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   making circles with c++ (https://www.linuxquestions.org/questions/programming-9/making-circles-with-c-520981/)

neocontrol 01-19-2007 04:31 PM

making circles with c++
 
Hi,

I'm learning to program in c++. My problem being that I am using a MS visual studio book.

Right now it's calling for a header called msoftcon.h. Any solutions to work around this head file? The example code is looking for me to make text based circles.... and obviously is a problem when it comes to this.

I heard something about using curses, but I'm not seeing any circle statements or anything.

Am I way off here? Any help would be appreciated.

Thanks

tuxdev 01-19-2007 05:36 PM

What are you trying to do? SDL is generally better for simple 2D graphics.

neocontrol 01-19-2007 08:16 PM

Right now it looks like I'm making circles from ascii. One is with letters, and the other is filled in with blocks and colored, and the other one is with symbols.

What exactly is SDL? I don't care if I follow the book exactly, as long as I'm learning concepts.

faizlo 09-16-2008 12:05 PM

Hi,

I know I should not pump old threads but I am stuck at exactly the same problem as described here. I apologize in advance if I break some rules.

Here is the code:
Code:

//Circles as graphics objects
//Code from R. Lafore "OOP with C++
//
#include "msoftcon.h"          //for graphics function

struct circle
  {
  int xCo, yCo;                //coordinates of center
  int radius;
  color fillcolor;            //color
  fstyle fillstyle;            //fill pattern
  };

void circle_draw(circle c)
  {
  set_color(c.fillcolor);              //set color
  set_fill_style(c.fillstyle);        //set fill pattern
  draw_circle(c.xCo, c.yCo, c.radius); //draw solid circle
  }

int main()
  {
  init_graphics();                    //initialize graphics system

  circle c1 = {15, 7, 5, cBLUE, X_FILL};
  circle c2 = {41, 12, 7, cRED, O_FILL};
  circle c3 = {65, 18, 4, cGREEN, MEDIUM_FILL};

  circ_draw(c1);                      //draw circles
  circ_draw(c2);
  circ_draw(c3);
  set_cursor_pos(1, 25);              //cursor to lower left corner
 
  return 0;
  }

My question is:
How would you modify this code to work on a Linux box?

faizlo

estabroo 09-16-2008 08:35 PM

you could look at using libcaca (color ascii art library). I haven't done any development with it myself, but I have used mplayer with it driving a color ascii terminal and it actually looked decent.


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