|
-
Feb 1st, 2001, 05:04 AM
#1
Thread Starter
New Member
I'm making a shooting game (similar to space invaders, Raptor or Tyrian) that makes heavy use of bitblt.
It is essential that your ship is able to constantly change colors during the game. Right now, I just go through all the pixels of a bitmap and use GetPixel and SetPixelV to change the colors. But this slows the game down by heaps, especially on older computers.
I'm thinking that I should pre-draw all the pictures while the game is loading, but I don't know how.
How do I do this? Is there a way for VB to make temporary bitmaps to store pictures? How would I draw to them/load from them/delete them?
-
Feb 1st, 2001, 07:36 AM
#2
transcendental analytic
There's many ways to store bitmaps in memory, you can load them into stdpictures, have them attached to off screen dc's, or why not even byte arrays, and in directx you can store them in directdrawsurfaces. There's also imagelists but you need to have them all same sized.
If your ship only have a few colors to change to you could predraw all the sequences, in other case you could access each pixel using DMA instead of getpixel/Setpixelv.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Feb 2nd, 2001, 01:38 AM
#3
Thread Starter
New Member
-
Feb 2nd, 2001, 02:16 AM
#4
Thread Starter
New Member
Success!
Trial and error pays off
I do this when I'm loading:
I first dim 2 longs, then use CreateCompatibleBitmap and CreateCompatibleDC on them.
Then I use MyPicture = SelectObject(DCname, Bitmapname).
Now I can bitblt to or from MyPicture.
Is this a good way to do it?
Is there a better way?
-
Feb 2nd, 2001, 02:18 AM
#5
Thread Starter
New Member
Oh, sorry
After I've done this, is there anything I should delete to free up system resources?
-
Feb 2nd, 2001, 04:26 AM
#6
transcendental analytic
DeleteObject the Bitmap and ReleaseDC the Device context
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|