Graphics from C to C++ - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Graphics from C to C++

smerrimansmerriman Posts: 1Member
I've been using a simple graphics code outline that allows me to draw rectangles, circles, using SetRect, FrameRect etc and all the other easy commands you can use in C. This is on a Macintosh computer. But here at home I have now got Visual C++ 6 on a PC. I've heard that you can still basically use C with a C++ compiler. If this is right, how can I get the same code onto the PC? Here is the Mac code. Thanks for any help

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include

/* Constants */

/* Globals */
Rect windRect;

/* Prototypes */
void Initialize(void);

int main(void)
{
Initialize();
MoveTo(330,85);
DrawString("pHello");
do {
} while (!Button());
return 0;
}

void Initialize(void)
{
WinowPtr mainPtr;
OSErr error;
SysEnvRec theWorld;

error = SysEnvirons(1,&theWorld);
if (theWorld.hasColorQD == false) {
SysBeep(50);
ExitToShell();
}
InitGraf(&qd.thePort);
InitFonts();
InitWindows();
InitMenus();
TEInit();
InitDialogs(nil);
InitCursor();

GetDateTime((unsigned long*)&qd.randSeed);
windRect = qd.screenBits.bounds;
InsetRect(&windRect,50,50);
mainPtr = NewCWindow(nil,&windRect,"pDrawing",true,documentProc,(WindowPtr)-1,false,0);
SetPort(mainPtr);
TextSize(12);
}

Sign In or Register to comment.