Important alert: (current site time 7/16/2013 3:29:12 AM EDT)
 

winzip icon

An Introduction To DirectX

Email
Submitted on: 9/23/2000 11:28:19 AM
By: Simon Price  
Level: Intermediate
User Rating: By 1 Users
Compatibility: VB 6.0
Views: 37490
(About the author)
 
     This is a tutorial for a complete beginner to DirectX. This introduction shows you the very basics of using DirectDraw, with more comments than code to help explain everything in plain English. The resulting program will draw a picture and stretch it to fit the size of the form. IMPORTANT - This requires DirectX7 and the DirectX7 for Visual Basic Type Library. If this tutorial helps you, please give feedback and/or vote, because if there is enough interest, subsequent tutorials will follow.

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 15 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

9/23/2000 11:33:35 AMSimon Price

If you like this see my other submissions (DO NOT click the link provided, instead search for "Simon Price" because I have 2 accounts!) and visit my website : www.VBgames.co.uk
Good luck with learning DirectX!
(If this comment was disrespectful, please report it.)

 
9/23/2000 1:44:32 PMVBDOG

Well what can I say a very good tutorial well commented and easy to understand which is very rare in vb programmers.
(If this comment was disrespectful, please report it.)

 
9/23/2000 4:24:49 PMDaniel Davies

I can't beleive it...U did it again! 5 Globes for the code. Excellent discription. Altogether Great! I was actually about to e-mail you...(Seeing as you are great with Direct-X) Asking if it would be possible to create a simple Direct 3D thing. U know, something really easy! I did try a MSDN tutorial, but it never said exactly what to do, so I couldn't get anything to work :( Anyway, let me know :o)
(If this comment was disrespectful, please report it.)

 
9/23/2000 5:29:33 PMSimon Price

Thanx guys, yes there might be a D3D tutorial, but I think it should come after tutorials on DirectDraw exclusive mode and maybe DirectSound and DirectMusic too.
(If this comment was disrespectful, please report it.)

 
9/23/2000 10:09:27 PMNathan Chere

Make that 3 accounts Simon, you're forgetting SE Software :)
Seriously though, this is the first submission of yours which I think deserves credit/votes. 4 globes.
(If this comment was disrespectful, please report it.)

 
9/24/2000 5:07:06 AMSimon Price

Thanks Nathan, but I still can't believe you're still going on about SEsoftware...
(If this comment was disrespectful, please report it.)

 
9/24/2000 1:41:58 PMxim

Thanks Simon, most tutorials tend to skip over the details, but this (and hopefully future installments ;)) is well commented and will certainly aid me in my quest for a complete understanding of Dx.
(If this comment was disrespectful, please report it.)

 
9/27/2000 3:13:25 PMMichael Tanner

Great tutorial, Simon. Can't wait for the next one!
(If this comment was disrespectful, please report it.)

 
10/7/2000 8:50:35 AMSqueakMac

I want to try this code, but I don't have the DirectX 7 Tpye libraries. Where can I get them?
(If this comment was disrespectful, please report it.)

 
10/7/2000 10:49:28 AMSimon Price

To SqueakMac, and anyone else interested:

I downloaded the DirectX7 for Visual Basic type libraries from www.microsoft.com , I can't remember
the exact url but go there and look for DirectX7 and then developers and I'm
sure you'll find the link.
(If this comment was disrespectful, please report it.)

 
10/8/2000 12:18:29 PMMr. Bob

To anyone who is looking for the DX7 Type Libraries: You don't have to download the SDK (Althhough should be a joy to have). All you need to do is install DX7. Then, the Libs will be in the References area. Great Job, Simon! You just saved my first game!
(If this comment was disrespectful, please report it.)

 
10/8/2000 6:39:52 PMDoug

Hmm.. pretty cool. I don't get what the object of this tutorial is supposed to accomplish though.. you draw that text.bmp onto the screen. but can't you just use a picturebox and put text.bmp as the Picture? I don't get it :-|
(If this comment was disrespectful, please report it.)

 
10/8/2000 6:41:37 PMDoug

Oops. I meant test.bmp not text
(If this comment was disrespectful, please report it.)

 
10/17/2000 5:55:41 PMTravell

Simon Rulz, Would 3DStudio Max be a good tool to use for my 2d characters in DX? Im designing a Survivor Horror Game. What type of Engine would you recommend? Anyone else feel free to e-mail be concerning this project
(If this comment was disrespectful, please report it.)

 
10/18/2000 6:49:47 PMbatman

Ya i am batman. Some people call me crazy but o well.

IM SO SMART... I KNEW ABOUT THIS PROJECT BEFORE IT WAS OUT! (i went to your website and it said project not done)...
... batman comes and goes ...
... whoever reads this will see me again!!!!....

AHAHAHAHAHAHAHAHAHAHA...cough cough
(If this comment was disrespectful, please report it.)

 
10/19/2000 4:35:07 PMChewi

I downloaded the SDK but I found it's only a useful reference once you know how it works. As a tutorial it is infuriatingly complicated. I haven't tried this tutorial of yours, Simon, because I already know how to use it thanks to some help from Jack Hoxley (also from the UK... you seem to be... and so am I). He wrote a guide and after a few e-mails I had it figured. It's great to see another one and by the looks of things you've done a good job. I've looked into Direct3D through the SDK... I have a very vague idea but I think a tutorial on that would really help. Just now I wanted to make a virtual piano program (that's why I came here just now). I looked into DirectMusic... and looked away. I think there must be an easier way. Ummm... I think I wrote too much. *grins*
(If this comment was disrespectful, please report it.)

 
10/23/2000 5:50:40 PMjonnysoft

A cute little demo, but not very inspiring. (Who would use DDraw to blt still pictures to windows?!?!?!?)
(If this comment was disrespectful, please report it.)

 
10/27/2000 1:32:37 PMWazerface

I knew Simon made this just by the title, GREAT JOB!!! and JonnySoft, don't even think of calling simon's code "cute and little"
(If this comment was disrespectful, please report it.)

 
6/9/2001 6:44:40 PMDjm406

Great start for people learning DirectX
(If this comment was disrespectful, please report it.)

 
6/3/2002 11:18:19 AMGah3k

Good job. I am a newbie to DirectX, and this helped me out a lot.
(If this comment was disrespectful, please report it.)

 
8/8/2002 4:26:54 PMAnphanax

for us newbies with directx, this demo is great. Because it shows how to paint a still picture without all that extra garbage to confuse the hell out of people. Once people know how to create still images with directdraw, they can of course make moving ones. :\ This is the best example I have ever found. 5 Globes.
(If this comment was disrespectful, please report it.)

 
1/17/2003 10:48:44 AM

nice tutorial, easy to understand, very helpful for students like me.
(If this comment was disrespectful, please report it.)

 
1/20/2003 7:28:56 PMTimothy E. Mertz

HEEEEELP i am having trouble when i declare my directx7 i get no popup suggestions but when i type in his it suggests thing for me some body email me at krazykeet@aol.com with a reply i am desprate to learn directx but how can i when i cant get it to work right!!!

(If this comment was disrespectful, please report it.)

 
1/20/2004 8:33:33 PM

Hey, GREAT, and I mean it, GREAT code man! Even though it's like 4 years old it is still incredibly useful! I did notice one thing and it is a wonderfully easy change with DRASTIC improvements. Simply change the line:
Picture1.Refresh
to say:
Picture1_Paint
to call the function to paint instead of clearing the canvas then repainting. Eliminates what little flicker was left on my screen. Cool, huh?
(If this comment was disrespectful, please report it.)

 
5/5/2004 1:54:46 PM

Hi!
this code is great, we can really understand easily. I just would like to know if it is possible to use a .jpg instead of the .bmp, i've tryed, but it gives me an error. Thanks!!
(If this comment was disrespectful, please report it.)

 
12/15/2004 1:18:19 PMKenny Roberts

I havnt checked your other tutorials yet, but have you made something to draw moving objects, kind of like a 3d object, or is it even possible. Sorry to bother you, but im completely new to DirectX.. - Your friend Bugz.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.