Please support our sponsor:
DirectX4VB.Com - All You Need For Multimedia Visual Basic Programming

Main Site Links Resources Tutorials
News VB Gaming Code Downloads DirectX 7
Contact Webmaster VB Programming Product Reviews DirectX 8
  General Multimedia Articles DirectX 9


DirectDraw: Combining Features
By: Jack Hoxley
Written: June 2000

Download: (96kb)

This isn't so much of a tutorial; more an example of how to do the above. I had this thought about doing a credits screen for a game; but using textured text - and the texture would be animated.

It is best understood by seeing the program in action - I was quite impressed with it; it may not be 3D, but it's simple, almost every computer will support it and its FAST.

Normally all the text you draw is one colour; unless you create your own text drawing procedure or use a weird font. This particular program uses this *problem* to create a new effect - If the text is all one colour, you can make it the transparent colour. That means that you can see everything underneath it. If you can see everything underneath it - lets put something cool and good looking underneath it. How about animate the picture underneath it? Even better.

So, some simple thinking makes for a rather clever use of resources available to us. Next; putting this idea into something we can program.

  1. We'll need some animated textures - not too difficult. Just draw some. Keep them small, otherwise they'll slow the program down.
  2. We'll tile the animation onto one surface; make it a vertical surface to avoid the problems with wide surfaces.
  3. We dont need to have a pre-drawn surface for the text - we can create a blank surface and draw the text on ourselves.
  4. We'll use a source colour key rather than a detination colour key - as there's much better support for the source colour key.

Here's the texture we'll be using. It's going to be made up of 20 frames - 10 up, 10 down, to get everything moving smoothly. The text to be drawn will be size 20; so we need the texture to be 30 pixels high - 20 of these means that it'll be 600 pixels high in total. Not too bad. The width needs to be 300 pixels to suit our text. Overall dimensions = 600x300.

It may look small, but when the screen is at 640x480 it won't be too bad.

Download the example program - it's the only way you'll see proper animation. You can get it from the top of this page, or from the downloads page.

DirectX 4 VB 2000 Jack Hoxley. All rights reserved.
Reproduction of this site and it's contents, in whole or in part, is prohibited,
except where explicitly stated otherwise.
Design by Mateo
Contact Webmaster
This site is hosted by Exhedra Solutions, Inc., the parent company of and