home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!stanford.edu!nntp.Stanford.EDU!leland.Stanford.EDU!cooljohn
- From: cooljohn@leland.Stanford.EDU ( Magdaleno)
- Subject: Accessing Data in Resource
- Message-ID: <1992Dec14.203030.18641@leland.Stanford.EDU>
- Keywords: Resource, Data Handle, Handle
- Sender: news@leland.Stanford.EDU (USENET News System)
- Organization: DSG, Stanford University, CA 94305, USA
- Date: Mon, 14 Dec 92 20:30:30 GMT
- Lines: 39
-
- Here's one problem of mine that I hope has a quick solution.
-
- In the midst of writing a game, a created my own resource type, say:
- MTYP, and in it I stored the map of the game.
-
- Now in my program, this is what I do to access the data:
-
- type
- pMapType = array[1..MAXSIZE] of integer;
- pMapPtr = ^pMapType;
-
- var
- pMap : pMapType;
-
- procedure LoadInMap;
- var
- MapRes : Handle;
- begin
- MapRes := GetResource('MTYP',MAPID);
- pMap := (pMapPtr(MapRes^)^); { YUCK. }
- etc....
- end;
-
- Well this code works for getting info out of the resource,
- but unfortunately, I haven't figured out how to point the Handle
- in the right direction, when I want to call WriteResource.
-
- So I have two questions:
- (1) Is there better way to access the data... through the Handle.
- (2) If so/not how do I make, in this case, MapRes point to
- the memory where my array is stored. I've tried type
- coercion to no ado.
-
-
- Thank you in advance,
-
- John Magdaleno
- cooljohn@leland.stanford.edu
-
-