Graphics in VC++ (console base)

Dear friends ,

i'm using VC++ 2008 ex Ed. in windows 7 i've a problem in graphics when i call a rectangle function and compile its code and when i run it then its output does not show color of rectangle i show u output
rectangle does not show color its fill up letter U like "UUU"

1
2
3
4
5
6
7
8
9
10
11
#include"iostream"
#include"msoftcon.h"
using namespace std;

int main ( )
{
   init_graphics( );
    
   draw_rectangle(5,5,6,6);
   return 0;
}






     UU
     UU
Do you realize that this is a "text-mode graphics"?

set_fill_style( ) - specifies which character to use as the fill
set_color( ) - sets both the background and foreground colours
please any one tell me how can i use graphics in VC++ console base.......

i have following functions


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//msoftcon.h
//declarations for Lafore's console graphics functions
//uses Window's console functions

#ifndef _INC_WCONSOLE    //don't let this file be included
#define _INC_WCONSOLE    //twice in the same source file

#include <windows.h>     //for Windows console functions
#include <conio.h>       //for kbhit(), getche()
#include <math.h>        //for sin, cos

enum fstyle { SOLID_FILL, X_FILL,      O_FILL, 
              LIGHT_FILL, MEDIUM_FILL, DARK_FILL };

enum color {
   cBLACK=0,     cDARK_BLUE=1,    cDARK_GREEN=2, cDARK_CYAN=3, 
   cDARK_RED=4,  cDARK_MAGENTA=5, cBROWN=6,      cLIGHT_GRAY=7,
   cDARK_GRAY=8, cBLUE=9,         cGREEN=10,     cCYAN=11, 
   cRED=12,      cMAGENTA=13,     cYELLOW=14,    cWHITE=15 };
//--------------------------------------------------------------
void init_graphics();
void set_color(color fg, color bg = cBLACK);
void set_color(int fg, int  bg = 0);
void set_cursor_pos(int x, int y);
void clear_screen();
void wait(int milliseconds);
void clear_line();
void draw_rectangle(int left, int top, int right, int bottom);                    
void draw_circle(int x, int y, int rad);
void draw_line(int x1, int y1, int x2, int y2);
void draw_pyramid(int x1, int y1, int height);
void set_fill_style(fstyle);
void set_fill_style(char);
#endif /* _INC_WCONSOLE */ 


Last edited on
Topic archived. No new replies allowed.