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 / dbGetImage()

Author
Message
dogzer
19
Years of Service
User Offline
Joined: 6th Nov 2005
Location:
Posted: 18th Nov 2005 18:02
Once I've used to dbGetImage() to grab the part of the image i want. How do i draw it into the screen?
MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 18th Nov 2005 18:26
dbPasteImage() with the image number used with dbGetImage().

My signature has been erased by me because it's LARGE.
Thank you for the votez!1!
dogzer
19
Years of Service
User Offline
Joined: 6th Nov 2005
Location:
Posted: 19th Nov 2005 03:16
In the code snippet is the 2 lines of code that i use to draw the first frame of my animation.

If i take away the dbGetImage the whole image apears(including the other frames). But if i put it as it is below, nothing shows up.

Any idea why it doesnt draw anything when i use dbGetImage?
dogzer
19
Years of Service
User Offline
Joined: 6th Nov 2005
Location:
Posted: 19th Nov 2005 03:18
Code didn't show up, here it is:

dbGetImage (Enemy1Img,0,0,15,15);
dbPasteImage(Enemy1Img, x-8,y-8);
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 19th Nov 2005 05:05
Are you getting the image from the correct place ? A bitmap or a screen ? Are the coordinates correct ?

MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 19th Nov 2005 10:02
Are you loading the image with dbLoadBitmap(), setting that bitmap (dbSetCurrantBitmap() and then using:
dbGetImage (Enemy1Img,0,0,15,15);
dbPasteImage(Enemy1Img, x-8,y-8);? I´m not sure if you have to set thebitmap but it wouldn´t hurt.

My signature has been erased by me because it's LARGE.
Thank you for the votez!1!
dogzer
19
Years of Service
User Offline
Joined: 6th Nov 2005
Location:
Posted: 19th Nov 2005 12:18
I used this code to load the spaceship:

dbLoadImage("Art\\Spaceship_1.bmp", Enemy1Img);

I tried using dbLoadImage.. but funnily enough, for some reason, not even de other spaceships get drawn.. =/
Sephnroth
22
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 19th Nov 2005 12:42
to use GetImage you must load it as a bit using dbLoadBitmap() - when you want to get the image first set the active bitmap to the one you loaded using dbSetCurrentBitmap(bitmap number) - i THINK, the SetCurrentBitmap command may be called something else.

However you should be aware of some things. To start with GetImage is really quite slow - if you are using it to animate sprites make sure you DONT call it every frame, get the images only once at the start of your program and then just use the image numbers from that point on.

Secondly, your job could be made easier for you by using the dbCreateAnimatedSprite() command. It will create an animated sprite from an image (so you can load it using dbLoadImage and not dbLoadBitmap) and do all the GetImage work for you. You just need to tell it the width/height of the frames in the image (they must all be the same width and height) and after wards you can animate your images simply by using dbPlaySprite(). You may find it alot easier to work with AND faster than doing your own get image manualy

dogzer
19
Years of Service
User Offline
Joined: 6th Nov 2005
Location:
Posted: 19th Nov 2005 17:04
Ok i'm using sprites
But I'm having problems drawing the sprites on the screen. I get a tiny dot instead of the image.

I load the sprite like this:
dbCreateAnimatedSprite ( Enemy1Img, "Art\\Spaceship_1.bmp", 16,16, Enemy1Img);

(The Image is 32x16) So it has 2 frames.

And I draw them like this:
dbSprite(Enemy1Img,x-8,y-8,Enemy1Img);
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 19th Nov 2005 21:21
dogzer
19
Years of Service
User Offline
Joined: 6th Nov 2005
Location:
Posted: 20th Nov 2005 11:05
It's basically just that.. i have this:



and..



Here's the whole thing. You can open it with visual c++ 6

http://www.ihud.com/file.php?file=1132481037/Invaders.rar
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 20th Nov 2005 11:38
First, use sprite before setsprite

dogzer
19
Years of Service
User Offline
Joined: 6th Nov 2005
Location:
Posted: 21st Nov 2005 00:16
Sorry, I still don't undertand how sprites work. Please help.

I get a purple dot with the code below. I must be missing something. I really don't know how sprites work and i would really like to know.

here's my "spaceship" image:
http://e.1asphost.com/dogzer/invaders/Spaceship_1.bmp

dogzer
19
Years of Service
User Offline
Joined: 6th Nov 2005
Location:
Posted: 21st Nov 2005 13:52
Haha. Sorry! I put on the iAcross and iDown each frame's size.. and i had to put the amount of frames on the image horizontaly and verticaly.

So if anyone ever gets a tiny dot, remember that

Login to post a reply

Server time is: 2024-11-19 02:46:22
Your offset time is: 2024-11-19 02:46:22