Welcome to MacForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Minimal graphics gcc lib for MacOS-X

 
   Macintosh computer (Home) -> Tools RSS
Next:  XCode and files on ssh - possible?  
Author Message
Jean-Guillaume Pyraksos

External


Since: Jun 16, 2005
Posts: 3



(Msg. 1) Posted: Tue Jul 11, 2006 10:52 am
Post subject: Minimal graphics gcc lib for MacOS-X
Archived from groups: comp>sys>mac>programmer>tools (more info?)

Hi,
A member of my family studies C in his classroom under Windows, and they
use a Windows IDE.
On his MacOS-X Tiger machine, he uses gcc + Emacs, but lacks the
capability of opening a simple graphics window, and drawing lines.
Is there a *small* graphics lib he can include to get his project done
without diving in the arcane of XCode and Mac programming ?
A turtle graphics library should be the ideal so far.
Thanks for him (and probably many other students)...

JG

 >> Stay informed about: Minimal graphics gcc lib for MacOS-X 
Back to top
Login to vote
Ingemar

External


Since: Nov 17, 2006
Posts: 4



(Msg. 2) Posted: Fri Nov 17, 2006 11:05 am
Post subject: Re:Minimal graphics gcc lib for MacOS-X [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

> Is there a *small* graphics lib

A few simple Carbon calls will do fine. You don't need any extra library,
just use -framework Carbon on the command line (if you are using the
Terminal). NewCWindow, SetPort, MoveTo, LineTo... Something like this:

---
#include <Carbon/Carbon.h>

Rect bounds;
WindowPtr wind;

main()
{
SetRect(&bounds, 100, 100, 356, 356);
wind =
NewCWindow(NULL,&bounds,"\pTest",1,plainDBox,(WindowPtr)-1,0,
0);
SetPortWindowPort(wind);
while (!Button())
{
LineTo(Random() & 255, Random() & 255);
QDFlushPortBuffer(GetWindowPort(wind), NULL);
}
}
---

It can't be much simpler. Of course, I'd like to suggest OpenGl for the
future. ;)
* posted via http://MacErudite.com
* please report abuse to http://xinbox.com/mymac

 >> Stay informed about: Minimal graphics gcc lib for MacOS-X 
Back to top
Login to vote
Ingemar

External


Since: Nov 17, 2006
Posts: 4



(Msg. 3) Posted: Sat Nov 18, 2006 1:54 am
Post subject: Re:Minimal graphics gcc lib for MacOS-X [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

> I also suggest the flag '-fpascal-strings' to get rid of the warning that
> is produced.

You are quite right! The whole command line should be something like:

gcc test.c -o test -framework Carbon -fpascal-strings

Run with

../test

That's still a nice and short command line. But it would be good if the
window would pop up in the front. That would take a few more lines to fix.
* posted via http://MacErudite.com
* please report abuse to http://xinbox.com/mymac
 >> Stay informed about: Minimal graphics gcc lib for MacOS-X 
Back to top
Login to vote
tim lindner

External


Since: Nov 18, 2006
Posts: 1



(Msg. 4) Posted: Sat Nov 18, 2006 4:10 am
Post subject: Re: Minimal graphics gcc lib for MacOS-X [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Ingemar wrote:

> Something like this:

That's a really neat example. At first I didn't know anything was
happening becuase all of the drawing was happening in a window behind my
terminal.

I also suggest the flag '-fpascal-strings' to get rid of the warning
that is produced.

--
The ears are too length.
--------------------------------------------------------------
tim lindner: First initial last name at macmess dot org
 >> Stay informed about: Minimal graphics gcc lib for MacOS-X 
Back to top
Login to vote
Display posts from previous:   
   Macintosh computer (Home) -> Tools All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]