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.

2D All the way! / Getting image dimensions

Author
Message
3ddd
22
Years of Service
User Offline
Joined: 14th Apr 2004
Location: Orlando, FL
Posted: 11th Sep 2004 06:30
I'm sorry if this is a dumb question and the answer is right in front of me, but...

How can you get the width and height of an image that you load from file? Is there a command like "Image Height" that takes an image number and returns the height in pixels?


He's evil, but, he'll die. I like it.
medwayman
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: uk
Posted: 11th Sep 2004 07:14
Assign your image to a sprite then use sprite width() and sprite height() to get it’s size.

Based on Amiga PD game Squigs. Currently being re-written.

3ddd
22
Years of Service
User Offline
Joined: 14th Apr 2004
Location: Orlando, FL
Posted: 11th Sep 2004 07:26
Thanks for the answer but can DBPro really do no better than that? Seems like such a horrible way to go about it. I hope they add some more image commands - I mean, it is a game programming language. I wonder how much doing that a lot slows thing down.


He's evil, but, he'll die. I like it.
Zone Chicken
22
Years of Service
User Offline
Joined: 25th Jan 2004
Location: `~-..-~`~-..-~`
Posted: 11th Sep 2004 09:47 Edited at: 11th Sep 2004 09:54
If your loading the file and not creating it why not just right click the image file itself, go to properties, then summary tab shows the w,h right there, i do it all the time to find the w and h before using the offest sprite command, save's alot of time.
the_winch
23
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 11th Sep 2004 11:39
The commands are in the image dll but there are no string table entries. I uset the commands fairly often and have no idea why they have no string table entries.

If you have a resource editor you can add the string table entries to the DBProImageDebug.dll yourself.
You need to add.
IMAGE HEIGHT[%LL%?GetHeight@@YAHH@Z%Image Number
IMAGE WIDTH[%LL%?GetWidth@@YAHH@Z%Image Number


it's cool to hate
3ddd
22
Years of Service
User Offline
Joined: 14th Apr 2004
Location: Orlando, FL
Posted: 11th Sep 2004 12:55
Whoa, can you elaborate on that, the winch? It sounds like you are saying that DBPro has the capability but they, for some reason, didn't finish those features.

Would something free like http://www.users.on.net/johnson/resourcehacker/ do the trick?
Do you think the string tables entries were not included for a good reason (i.e., will adding them break or conflict with something), or they were just overlooked?


He's evil, but, he'll die. I like it.
3ddd
22
Years of Service
User Offline
Joined: 14th Apr 2004
Location: Orlando, FL
Posted: 11th Sep 2004 13:14 Edited at: 11th Sep 2004 13:14
Well I'll be damned - that worked! Here is what I did:
1) Installed Resource Hacker (see above link)

2) Made a backup copy of DBProImageDebug.dll (found in Crogram FilesDark Basic SoftwareDark Basic ProfessionalCompilerplugins)

3) Ran ResHacker.exe and opened up DBProImageDebug.dll

4) Selected String Table / 1 / 2057

5) In the right window I added the following two lines above the "}":


So, the entire contents of the window reads:


6) Pressed the Compile Script button and then saved the file

Now I can use the following two commands in DBpro:


Very cool! Thanks the winch!!


He's evil, but, he'll die. I like it.
3ddd
22
Years of Service
User Offline
Joined: 14th Apr 2004
Location: Orlando, FL
Posted: 11th Sep 2004 13:32
BTW, I noticed that there was an entry for a ROTATE IMAGE command. But when I tried it (e.g., ROTATE IMAGE 1, 45) DBpro returned the error "Command now obsolete at line xx". Which is sort of amusing because it essentially says users no longer have a need to rotate images, since TGC did not update the obsolete command!


He's evil, but, he'll die. I like it.
Zone Chicken
22
Years of Service
User Offline
Joined: 25th Jan 2004
Location: `~-..-~`~-..-~`
Posted: 11th Sep 2004 13:34
Just curroius are you guy's using classic or pro?

I just tried sw = sprite width(1) and sh = sprite height (1)
and they both worked in 5.6 final.
3ddd
22
Years of Service
User Offline
Joined: 14th Apr 2004
Location: Orlando, FL
Posted: 11th Sep 2004 13:39 Edited at: 12th Sep 2004 07:53
DBpro is what I am using. Oh, I need to update to the latest version. I just get paranoid about doing it, not wanting to cause any problems with the project I am working on. I guess they fixed it recently. Thanks for posting that!

EDIT:
I just noticed that the code snippets Zone Chicken posted used sprite commands instead of image commands. This thread is about obtaining the width and height of IMAGES, not sprites. Can anyone confirm if the Image Width and Image Height commands work in 5.6 and if they appear in the help guide?


He's evil, but, he'll die. I like it.
medwayman
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: uk
Posted: 12th Sep 2004 06:18
That’s interesting. Nice one for that, The_Winch and thanks for the rundown, 3ddd I think ill add those commands

Based on Amiga PD game Squigs. Currently being re-written.

Tapewormz
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Winnipeg, Mantoba, Canada
Posted: 12th Sep 2004 08:57 Edited at: 12th Sep 2004 09:18
This would be a good command suggestion for the "Your 2D Game Command Suggestions Wanted" found in issue 20 of the newsletter.
http://darkbasicpro.thegamecreators.com/data/newsletter/newsletter_issue_20.html

There should be a forum post called "TGC 2D Pack Ideas" that you can post suggestions in. TCA says the thread is here http://forum.thegamecreators.com/?m=forum_view&t=38072&b=18

Login to post a reply

Server time is: 2026-06-11 19:29:50
Your offset time is: 2026-06-11 19:29:50