Direct Draw 7 tile engine error
Direct Draw 7 tile engine error
Direct Draw 7 tile engine error
Direct Draw 7 tile engine error
Direct Draw 7 tile engine error
Direct Draw 7 tile engine error Direct Draw 7 tile engine error Direct Draw 7 tile engine error Direct Draw 7 tile engine error Direct Draw 7 tile engine error Direct Draw 7 tile engine error Direct Draw 7 tile engine error Direct Draw 7 tile engine error
Direct Draw 7 tile engine error Direct Draw 7 tile engine error
Direct Draw 7 tile engine error
Go Back  Xtreme Visual Basic Talk > > > > Direct Draw 7 tile engine error


Reply
 
Thread Tools Display Modes
  #1  
Old 04-06-2004, 01:22 AM
Kamochan Kamochan is offline
Centurion
 
Join Date: Mar 2002
Location: Miami or Gainesville (UF)
Posts: 130
Default Direct Draw 7 tile engine error


I've just gotten back into DirectX programming after about a year off and seem to be having trouble remembering how to set things up. Anyways, I'm trying to create a simple tiling graphics engine and am getting a familiar error... but I cannot remember how to fix it. I've uploaded to code (BUGGY!) in hopes someone can tell me what's wrong.

It's very straight forward (in my opinion) being largely cut and pasted from the tutorials on DirectX4vb. The rest of the code (my part) is commented so you should be able to follow along.

Thanks.
Attached Files
File Type: zip tileEngine.zip (47.1 KB, 9 views)
Reply With Quote
  #2  
Old 04-06-2004, 06:11 AM
Iceplug's Avatar
IceplugDirect Draw 7 tile engine error Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

You set the primary surface to nothing in InitSurfaces, and therefore VB is giving you a Object variable not set Error when you draw.
Also, you need to set bRunning = False in your Drawing loop and unload all of your objects after the mainloop.
Code:
Set surfWorldTiles = Nothing Set surfBackBuffer = Nothing Set surfPrimary = Nothing Set ddClipper = Nothing Set DD = Nothing Set DX = Nothing
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #3  
Old 04-06-2004, 11:53 AM
Kamochan Kamochan is offline
Centurion
 
Join Date: Mar 2002
Location: Miami or Gainesville (UF)
Posts: 130
Default

Hey thanks IcePlug. I'm still having a bit of trouble though. The error is now gone, but all I get when the program runs is a blank screen. From my understanding of my own code, I should get a display of some of the tiles I've stored on my backbuffer.

Stepping through the code I can see the 2D arrays for the tiles are successfully created. The blting of the tiles to the back buffer in the DrawBG method seems to be executing fine as well. Finally, the blt method returns no error when copying the back buffer to the primary surface. However, I get nothing on the screen.

Also, I don't understand why you said to set bRunning = false in my main drawing loop (and perhaps this is the source of my error?). If I'm not mistaken my main drawing loop is this one...

Code:
Do While bRunning = True DoEvents DrawBG blt Loop

When I set bRunning = false in this loop I still get a blank screen.
Reply With Quote
  #4  
Old 04-06-2004, 01:35 PM
Iceplug's Avatar
IceplugDirect Draw 7 tile engine error Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

I said to set bRunning = False so that your program shuts down correctly.

You aren't seeing anything because your pictures are loaded onto surfWorldTiles, but you are only drawing Backbuffer to Primary.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #5  
Old 04-06-2004, 06:11 PM
Kamochan Kamochan is offline
Centurion
 
Join Date: Mar 2002
Location: Miami or Gainesville (UF)
Posts: 130
Default

I'm drawing my tiles to the back buffer in the DrawBG method (at the bottom of it). The weird thing is, I'm getting some weird tearing effect on the right side of the screen. It doesn't seem to matter how many rows of tiles I draw. (I want to draw a little off the screen for scrolling purposes as I've done this before.. unfortunately I don't have access to all my old code).

Anways, I've re-uploaded the file including the few changes I've made. I'm just curious if everyone else will get the same results. Try changing the constant that y increments to in the DrawBG method. This should draw more columns of tiles but doesn't seem to be doing it. My tiles are 60 by 60 pixels. The viewing screen is 800 by 600. So drawing 10 rows and 14 columns should cover the entire screen, however, it's not doing it for me. There's tearing at the right. Even if I increase the upper bound on the columns to 20 I get the same result...

Code:
For x = 0 To 9 For y = 0 To 13 'first, set up destination location With rectTileDest .Top = x * 60 .Bottom = .Top + 60 .Left = y * 60 .Right = .Left + 60 End With 'next, identify tile type and set up source rect Select Case BackGround(x, y).ID Case 0: With rectTileSource .Top = 0 .Bottom = 60 .Left = 0 .Right = 60 End With Case 1: With rectTileSource .Top = 120 .Bottom = 180 .Left = 120 .Right = 180 End With End Select 'finally, blt the tile to the back buffer ddrval = Form1.surfBackBuffer.blt(rectTileDest, Form1.surfWorldTiles, rectTileSource, DDBLT_WAIT) Next y Next x

Chaging the 13 in the "for y = 0 to 13" line is the upper bound I am talking about.

Thanks
Attached Files
File Type: zip TileEngine.zip (47.6 KB, 10 views)

Last edited by Kamochan; 04-06-2004 at 06:14 PM. Reason: forgot attachment
Reply With Quote
  #6  
Old 04-06-2004, 06:58 PM
Iceplug's Avatar
IceplugDirect Draw 7 tile engine error Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

You have the picturebox set for the width of 800x600, but the map that you generate is (13*60+60, 9*60+60) = (840, 600)... resizing the picturebox to 840x600 gets rid of the little area to the right.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #7  
Old 04-07-2004, 02:06 AM
Kamochan Kamochan is offline
Centurion
 
Join Date: Mar 2002
Location: Miami or Gainesville (UF)
Posts: 130
Default

hmm... that's interesting. I wasn't aware you couldn't blit half a tile on screen and half off the way I was trying to do it....

thanks for all your help Ice
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Direct Draw Compatability Error darkeagle03 DirectX 8 05-10-2004 06:32 PM
Direct draw 7 Windowed mode flickering joon DirectX 2 01-08-2004 05:29 AM
Urgent... Help Needed Direct Draw Mark Paquetsky Tech Discussions 4 09-15-2003 09:26 AM
Problem with Direct Input and Direct Sound Waxycat Miscellaneous Languages 15 06-06-2003 11:03 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Direct Draw 7 tile engine error
Direct Draw 7 tile engine error
Direct Draw 7 tile engine error Direct Draw 7 tile engine error
Direct Draw 7 tile engine error
Direct Draw 7 tile engine error
Direct Draw 7 tile engine error Direct Draw 7 tile engine error Direct Draw 7 tile engine error Direct Draw 7 tile engine error Direct Draw 7 tile engine error Direct Draw 7 tile engine error Direct Draw 7 tile engine error
Direct Draw 7 tile engine error
Direct Draw 7 tile engine error
 
Direct Draw 7 tile engine error
Direct Draw 7 tile engine error
 
-->