943,985 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 4217
  • C++ RSS
Oct 9th, 2004
1

How to learn graphical part of C++?

Expand Post »
dear respected.......


would u plz help me to learn graphics in C++.Like drawing lines,circles,ellips etc.

Wish u all the best :mrgreen:
Similar Threads
Reputation Points: 11
Solved Threads: 0
Newbie Poster
mishu1516 is offline Offline
2 posts
since Oct 2004
Oct 9th, 2004
0

Re: How to learn graphical part of C++?

>would u plz help me to learn graphics in C++
C++ doesn't support graphics natively. You need to choose a graphical library or API before someone can help you with it. A few good starters are Allegro, Qt, and SDL. A quick google search will give you reams of information on them.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Oct 10th, 2004
1

Re: How to learn graphical part of C++?

Look in the tutorial forum at dani too and google
Reputation Points: 108
Solved Threads: 7
Posting Whiz in Training
FireNet is offline Offline
256 posts
since May 2004
Oct 10th, 2004
0

Re: How to learn graphical part of C++?

I know Narue will smile, but here I go again. There is a thing called BCX for free out there, that will translate rather simple basic like code to C, or with the $CPP directive to C++ code. A good way to at least study Win32 API calls.

To draw a red line from point (x=25,y=15) to point x=400,y=350) use the BCX basic code:
<code>BCX_LINE(Form1,25,15,400,350,Red)</code>This will translate to <code>#define Red RGB (255,0,0)
int BCX_Line (HWND,int,int,int,int,int=0,HDC=0);

int BCX_Line (HWND Wnd,int x1,int y1,int x2,int y2,int Pen,HDC DrawHDC)
{
int a,b=0;
HPEN hOPen;

HPEN hNPen=CreatePen(PS_SOLID,1,Pen);
if(!DrawHDC) DrawHDC=GetDC(Wnd),b=1;
hOPen=SelectObject(DrawHDC,hNPen);
MoveToEx(DrawHDC,x1,y1,NULL);
a = LineTo(DrawHDC,x2,y2);
DeleteObject(SelectObject(DrawHDC,hOPen));
if(b) ReleaseDC(Wnd,DrawHDC);
return a; // true or false
}
</code>which are mostly API calls.

Hope I did this code field stuff correctly!
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004
Oct 10th, 2004
0

Re: How to learn graphical part of C++?

Okay, I fugged up the code field thing, here it is again ...

I know Narue will smile, but here I go again. There is a thing called BCX for free out there, that will translate rather simple basic like code to C, or with the $CPP directive to C++ code. A good way to at least study Win32 API calls.

To draw a red line from point (x=25,y=15) to point x=400,y=350) use the BCX basic code:
C++ Syntax (Toggle Plain Text)
  1. BCX_LINE(Form1,25,15,400,350,Red)
This will translate to
C++ Syntax (Toggle Plain Text)
  1. #define Red RGB (255,0,0)
  2. int BCX_Line (HWND,int,int,int,int,int=0,HDC=0);
  3.  
  4. int BCX_Line (HWND Wnd,int x1,int y1,int x2,int y2,int Pen,HDC DrawHDC)
  5. {
  6. int a,b=0;
  7. HPEN hOPen;
  8.  
  9. HPEN hNPen=CreatePen(PS_SOLID,1,Pen);
  10. if(!DrawHDC) DrawHDC=GetDC(Wnd),b=1;
  11. hOPen=SelectObject(DrawHDC,hNPen);
  12. MoveToEx(DrawHDC,x1,y1,NULL);
  13. a = LineTo(DrawHDC,x2,y2);
  14. DeleteObject(SelectObject(DrawHDC,hOPen));
  15. if(b) ReleaseDC(Wnd,DrawHDC);
  16. return a; // true or false
  17. }
which are mostly API calls.

Hope I did this code field stuff correctly!
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: C++ for Dummies Programming Book
Next Thread in C++ Forum Timeline: Newbie - how do I start C++ programming?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC