FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Resources

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> DWT
View previous topic :: View next topic  
Author Message
Gertje



Joined: 25 Apr 2005
Posts: 9

PostPosted: Thu Jan 12, 2006 2:51 pm    Post subject: Resources Reply with quote

Hi,

For example, I would like to show a small PNG in my program, then I can read it using the ResourceManager.
No I have two questions:
1 How do I make resource files? I more or less know how I to make a res file, but I do not know how to make a rc file that points somehow to my png file...
2 How do I read them exactly using ResourceManager?

Thanks
Geert
Back to top
View user's profile Send private message
Shawn Liu



Joined: 09 Mar 2005
Posts: 104
Location: Shanghai, China

PostPosted: Sat Jan 14, 2006 6:06 pm    Post subject: Re: Resources Reply with quote

Gertje wrote:

1 How do I make resource files? I more or less know how I to make a res file, but I do not know how to make a rc file that points somehow to my png file...
2 How do I read them exactly using ResourceManager?


I made rc file by using MS virsual Studio.
All resources are loaded in binary mode in spide of the really type the resource is (GIF, PNG, and etc). It is the same loaded from a disk file.
So make all your images as custom resource in binary format. There are two methods involoved in loading custom resource.
Code:
Image getImage(char[] strID, char[] strType)
ubyte[] loadBinaryRes(char[] strID, char[] strType)


Actually, getImage() method invokes loadBinaryRes() internally to get the binary ubyte[] buffer from rc file, then create a MemoryStream as ImageData source to create the Image. loadBinaryRes() loads binary data from rc file just like it load a binary file from disk.
For detail, please refer to 'dwt.util.resourcemanager' and the examples.
Back to top
View user's profile Send private message
Gertje



Joined: 25 Apr 2005
Posts: 9

PostPosted: Sun Jan 15, 2006 12:31 am    Post subject: Reply with quote

Thanks, I have got it working now!
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> DWT All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group