Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Loading an image from HANDLE

Author
Message
SushiBox
16
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Ohio
Posted: 18th Jan 2009 20:25


How will I be able to load the image from the HBITMAP or HANDLE? Thanks.

www.Helios-Online.net
SushiBox
16
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Ohio
Posted: 20th Jan 2009 05:19
BUMP: I really need to know how to handle cursors and bitmaps from my .rc resource script. If you have any insight, please let me hear it!

I am working on a 2D Side Scrolling MMORPG, the journey is being blogged and I suggest you check it out. Will include all progress, road blocks even drama! http://exoengine.com/blog/
Orac
18
Years of Service
User Offline
Joined: 16th May 2006
Location: Billingham
Posted: 20th Jan 2009 10:47
I'm not sure that you will be able to do this. To change the cursor you need to handle the WM_CURSOR message in the Windows message loop. This is encapsulated by the LoopGDK() function and therefore not available to intercept (someone please correct me if I'm wrong on this). Could you not use a sprite instead?

Of all the things I've lost .. I miss my marbles most of all.
SushiBox
16
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Ohio
Posted: 20th Jan 2009 23:35
Well, thats what i'm using. I don't need to use a .cur file, I could use .BMP too. The problem is, how do I use dbSprite to load from a resource?

I am working on a 2D Side Scrolling MMORPG, the journey is being blogged and I suggest you check it out. Will include all progress, road blocks even drama! http://exoengine.com/blog/
Orac
18
Years of Service
User Offline
Joined: 16th May 2006
Location: Billingham
Posted: 21st Jan 2009 09:53
I have been pondering over this too. I don't think it can be done directly because dbSprite takes an image number as one of its parameters. The image number should have been assigned by a call to dbLoadImage which takes a filename as one of its parameters, hence the problem. One way that I've been trying to do it goes like this:

1) Use the Windows API calls FindResource and LoadResource to get at the image. So far my attempts to get this working have failed, the FindResource function doesn't seem to work in a DarkGDK application.

2) Create a memblock using dbMakeMemblock

3) Copy the previously loaded resource data into the memblock

4) Make an image from the memblock with dbMakeImageFromMemblock. The image should then have an image number associated with it.

5) Use the image number as a parameter for dbSprite.

Like I said, so far I've failed at step 1) but if you can get it working, please let me know.

Of all the things I've lost .. I miss my marbles most of all.
chunks chunks
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 21st Jan 2009 15:29 Edited at: 21st Jan 2009 15:33
hi , try this code which ianm posted when i asked the same question.

http://forum.thegamecreators.com/?m=forum_view&t=119287&b=22

Also i did some code after ianm said u could load it in with directx and then use the make image command in the gdk , but this didn`t seem to work so i had to use get image instead .

http://forum.thegamecreators.com/?m=forum_view&t=125878&b=6

Hope that helps.

chunks .

Edit: I also have some code somewhere to load wav files from resources too.

nvidia geforce 8600gt + amd athlon 64
windows xp pro.
Orac
18
Years of Service
User Offline
Joined: 16th May 2006
Location: Billingham
Posted: 21st Jan 2009 16:12
IanM's code is fine for loading bitmaps of the .bmp type, I have used it myself in a project. However the LoadBitmap() function can't handle other formats such as .png or .jpg which is what I was trying to do with FindResource() and LoadResource(). These two functions should (in theory) allow you to load any type of resource, including custom defined resources.

Of all the things I've lost .. I miss my marbles most of all.
chunks chunks
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 22nd Jan 2009 00:57
try the directx loading route as d3dx textures allows directly loading from resources in all the formats dgdk supports , then use dbMakeImage() to convert it to a format gdk can use , this seems like an easier way to me.

I will post some code up tommoro .

chunks

nvidia geforce 8600gt + amd athlon 64
windows xp pro.

Login to post a reply

Server time is: 2024-11-25 11:40:01
Your offset time is: 2024-11-25 11:40:01