Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!brutus.cs.uiuc.edu!apple!dlyons From: dlyons@Apple.COM (David Lyons) Newsgroups: comp.sys.apple Subject: Re: programming questions Message-ID: <34316@apple.Apple.COM> Date: 25 Aug 89 18:33:59 GMT References: <11032@boulder.Colorado.EDU> Organization: Apple Computer Inc, Cupertino, CA Lines: 58 In article <11032@boulder.Colorado.EDU> hartkopf@tramp.Colorado.EDU (Jeff Hartkopf) writes: [In ORCA/C, how do I....] >[...] Now, how would I actually declare/initialize an >array like this in ORCA/C, so that I could use the statement > >SetPenPat(color[x]); Well, here's one way: int color[16][16] = { { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, { 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, ... }, ... }; Icky, eh? You could do something like this instead: void SetDithColor(int x) { int patt[16], i; x *= 0x1111; for(i=0; i<16; i++) patt[i] = x; SetPenPat(patt); } (Not tested, but looks okay.) >2) How do I define an icon (in the format used for DrawIcon()) in C? You can do a fairly straightforward translation of your Pascal code into C; of you can use an icon editor to generate the code. (I know my DIcEd will "Save As Source" for "APW C"; other icon editors may, too.) DIcEd generates something like this for you (in a text file): static char Icon1[] = { 0x00, 0x00, 0x80, ... /* lots o' bytes */ } which you can just cut and paste it into your code. The dialog box says APW C, but it's just a generic "static char" declaration, so it'll work just as well with ORCA/C. --Dave Lyons, Apple Computer, Inc. | DAL Systems AppleLink--Apple Edition: DAVE.LYONS | P.O. Box 875 AppleLink--Personal Edition: Dave Lyons | Cupertino, CA 95015-0875 GEnie: D.LYONS2 or DAVE.LYONS CompuServe: 72177,3233 Internet/BITNET: dlyons@apple.com UUCP: ...!ames!apple!dlyons My opinions are my own, not Apple's.