rpgnewbie
12-19-2003, 01:41 AM
A Newbie Bitblt Tutorial with Samples...
At the request of Pooyae in the following thread:
http://www.visualbasicforum.com/t128032.html
...and because there is little in the way of simple BitBlt examples/tutorials on this forum, I am posting the following in hopes that some moderator may deem it worthy for Tutor's Corner (in order to assist those VB programmers new to using Bitblt in the development of their games).
Attached should be:
"BitBlt_Grass Tiling Demo.zip" - which demonstrates using Bitblt to fill a picture box control with grass tile images
"BitBlt_Walking_Man_ Demo.zip" - the grass tiling code in this demo is the same as the "BitBlt_Grass_Tiling_Demo" except the BitBlt command has been replaced by the PaintPicture code to show how to easy it is to interchange both graphic functions.
This demo also features a BitBlt-ed moving image (sprite) that is animated by flipping through a sequence of three frames. Because it uses bitblt-ing (instead of image controls) the animation is seamless and flickerfree. The sprite moves from left to right and stops just before reaching the right edge of the picturebox and shows a msgbox.
All graphics images (including masks) are included in the zipped files. The BitBlt Public Declare function is in it's own module, as this is the way it is usually done in larger projects.
Through the generous permission of dark2025 the following is also included:
BltDemo is a fully commented tutorial tucked inside a demo program showing a red ball which is moved around by the mouse against a complex background both with and without sprite background transparency. The Bitblt Declaration, as well as GetTickCount Declaration, are both in a bas module.
All three demos have been designed with simplicity and ease of understanding for VB beginners in mind. Hopefully you will find them helpful.
If you are interested in a VB program for that automatically creates design time masks, you can check out "AutoSpriteMaskCreator2.zip" attached at the bottom of this thread:
http://www.visualbasicforum.com/t107858.html
After learning the basics of Bitblt-ing with masks created at design time, you may wish to try runtime (programmatic) masking. If so, you may find it useful to explore the following thread links:
Thread with run time masking code from shmoove (uses "CreateCompatibleDC):
http://www.visualbasicforum.com/t51613.html
Programmatic masking demo with class-based caching In the Code Library (by OnErrOr):
http://www.visualbasicforum.com/t109862.html
At the request of Pooyae in the following thread:
http://www.visualbasicforum.com/t128032.html
...and because there is little in the way of simple BitBlt examples/tutorials on this forum, I am posting the following in hopes that some moderator may deem it worthy for Tutor's Corner (in order to assist those VB programmers new to using Bitblt in the development of their games).
Attached should be:
"BitBlt_Grass Tiling Demo.zip" - which demonstrates using Bitblt to fill a picture box control with grass tile images
"BitBlt_Walking_Man_ Demo.zip" - the grass tiling code in this demo is the same as the "BitBlt_Grass_Tiling_Demo" except the BitBlt command has been replaced by the PaintPicture code to show how to easy it is to interchange both graphic functions.
This demo also features a BitBlt-ed moving image (sprite) that is animated by flipping through a sequence of three frames. Because it uses bitblt-ing (instead of image controls) the animation is seamless and flickerfree. The sprite moves from left to right and stops just before reaching the right edge of the picturebox and shows a msgbox.
All graphics images (including masks) are included in the zipped files. The BitBlt Public Declare function is in it's own module, as this is the way it is usually done in larger projects.
Through the generous permission of dark2025 the following is also included:
BltDemo is a fully commented tutorial tucked inside a demo program showing a red ball which is moved around by the mouse against a complex background both with and without sprite background transparency. The Bitblt Declaration, as well as GetTickCount Declaration, are both in a bas module.
All three demos have been designed with simplicity and ease of understanding for VB beginners in mind. Hopefully you will find them helpful.
If you are interested in a VB program for that automatically creates design time masks, you can check out "AutoSpriteMaskCreator2.zip" attached at the bottom of this thread:
http://www.visualbasicforum.com/t107858.html
After learning the basics of Bitblt-ing with masks created at design time, you may wish to try runtime (programmatic) masking. If so, you may find it useful to explore the following thread links:
Thread with run time masking code from shmoove (uses "CreateCompatibleDC):
http://www.visualbasicforum.com/t51613.html
Programmatic masking demo with class-based caching In the Code Library (by OnErrOr):
http://www.visualbasicforum.com/t109862.html