Jump to content
  • Advertisement

Archived

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

FenixRoA

Beginner needs help with DirectDraw surfaces!!!

This topic is 5218 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

first I initialize my directx, screen goes blank, flickers a once to get in 800X600X16 (previously set refresh rate) now heres the code thats been giving me the trouble and the error that i get from it (the line that gives the error is marked with a *!!!): Private Structure Slide Private Surf As DirectX.DirectDraw.Surface Public Sub New(ByRef FilNam As String, ByRef Height As Integer, ByRef Width As Integer, ByRef DDevice As DirectX.DirectDraw.Device) Dim Desc As New DirectX.DirectDraw.SurfaceDescription() Desc.Height = Height Desc.Width = Width ''put in a try ''MsgBox(System.Windows.Forms.Application.StartupPath) *!!!Surf = New DirectX.DirectDraw.Surface(System.Windows.Forms.Application.StartupPath + "\graphics\" + FilNam, Desc, DDevice) Desc = Nothing End Sub Public Sub New(ByRef FilNam As String, ByRef Desc As DirectX.DirectDraw.SurfaceDescription, ByRef DDevice As DirectX.DirectDraw.Device) Surf = New DirectX.DirectDraw.Surface(System.Windows.Forms.Application.StartupPath + "\graphics\" + FilNam, Desc, DDevice) End Sub Public Function getSurf() As DirectX.DirectDraw.Surface Return Surf End Function Public Sub Dispose() Surf.Dispose() Surf = Nothing End Sub End Structure Private Sub GameLoop() (top of call stack at occurence of error) ''DComp.Hide() Dim bksign As New Slide("picname.gif", 70, 50, DDevice) End Sub The error says that it occurred in a directdraw.dll and finishes with: "Additional Information: The value was not in the expected range" I tested the pathname 300 times and i can guarentee that that is not the issue. Thank you for your time and cosideration FenixRoA

Share this post


Link to post
Share on other sites
Advertisement
I''d put that code in a [ source ] [ /source ] block so that it is readable (just take out the spaces). It''s been a while since I''ve done anything in vb, but it might be easier for others to understand it when properly spaced/indented. Cheers.

Share this post


Link to post
Share on other sites
I tried testing the code in VB but it seems you''re using a different version (.net maybe??). VB6 really didn''t like that code hehe.

Are you sure you can load .gif files through "New DirectX.DirectDraw.Surface"? As far as i know DirectX is only compatible with bitmaps but i could be wrong.

If you''re sure you''ve checked the filename and you''re sure you can load .gif files then maybe the problem is in the DirectX.DirectDraw.Device object?

Aha, just had a quick skim over your code again and i think i may of found the problem. In C/C++ when i use DirectDraw and i create a surface i set all the values i don''t use in the surface description to 0. And when i create an "offscreen" surface i have to set the flags member of the surface description to show that im setting the width and height and the surface capabilities. Then in the surface capabilities part of the surface description i have to set the DDSCAPS_OFFSCREENPLAIN flag.

I''m not sure if any of this applies to you because you''re using visual basic but if you''re not sure you could give it a shot and see what happens

Share this post


Link to post
Share on other sites
Thanks for your help guys
I''m new to gamedev.net and i didnt know about the source tags... i''ll use those from now on, thank you.

As to the code thanks for your help i''m about to try all your suggestions and I''m keeping my fingers crossed that it works.

To the above, yes, i''m sorry i forgot to mention i AM using Visual Basic .net 2003 with all applicable updates.

Thank you all for your help

Share this post


Link to post
Share on other sites
OK

I tried by adding desc.clear just before i define the height and width... Didn''t work and I got the same error... any ideas?

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!