Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

alex mcandrew

passing surfacename in function

This topic is 6197 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am developing a crude graphics engine in VB. I am currently writing code to load and display bitmaps. However, I am having troubles passing the name of a new surface to a function. Check out the code below: ---------- Sub Game_Loop() Call Load_Bitmap(16, 16, Tile_Dirt, "/tile1.bmp") Call Draw_Bitmap(100, 100, Tile_Dirt) End Sub Sub Load_Bitmap(Width As Integer, Height As Integer, Bitmap_Surface_Name As DirectDrawSurface7, Bitmap_Path As String) Dim Bitmap_Surface_Name As DirectDrawSurface7 Set Bitmap_Surface_Name = Nothing ddsd2.lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH 'default flags ddsd2.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN ddsd2.lWidth = Width ddsd2.lHeight = Height 'this is where the surface is created. You use the DDraw object to create a 'surface from the specified file name using the above description. Set Bitmap_Surface_Name = dd.CreateSurfaceFromFile(App.Path & Bitmap_Path, ddsd2) End Sub Sub Draw_Bitmap(X_Coor As Integer, Y_Coor As Integer, Surface_Name As DirectDrawSurface7) Dim ddrval As Long rBack.Bottom = ddsd3.lHeight rBack.Right = ddsd3.lWidth ddrval = backbuffer.BltFast(X_Coor, Y_Coor, Surface_Name, rBack, DDBLTFAST_WAIT) End Sub ---------- When the application launches I receive an error message saying "Variable not decfined" referring to Tile_Dirt from these lines of code: Call Load_Bitmap(16, 16, Tile_Dirt, "/tile1.bmp") Call Draw_Bitmap(100, 100, Tile_Dirt) This is probably just a basic programming question, but I need to know how to pass the surface name to these functions. Thanks a lot! Alexander Edited by - alex mcandrew on July 28, 2001 6:17:19 PM

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!