View previous topic :: View next topic |
Author |
Message |
Gertje
Joined: 25 Apr 2005 Posts: 9
|
Posted: Thu Jan 12, 2006 2:51 pm Post subject: Resources |
|
|
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 |
|
|
Shawn Liu
Joined: 09 Mar 2005 Posts: 104 Location: Shanghai, China
|
Posted: Sat Jan 14, 2006 6:06 pm Post subject: Re: Resources |
|
|
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 |
|
|
Gertje
Joined: 25 Apr 2005 Posts: 9
|
Posted: Sun Jan 15, 2006 12:31 am Post subject: |
|
|
Thanks, I have got it working now! |
|
Back to top |
|
|
|
|
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
|