How to change DirectDraw surface bitmap
How to change DirectDraw surface bitmap
How to change DirectDraw surface bitmap
How to change DirectDraw surface bitmap
How to change DirectDraw surface bitmap
How to change DirectDraw surface bitmap How to change DirectDraw surface bitmap How to change DirectDraw surface bitmap How to change DirectDraw surface bitmap How to change DirectDraw surface bitmap How to change DirectDraw surface bitmap How to change DirectDraw surface bitmap How to change DirectDraw surface bitmap
How to change DirectDraw surface bitmap How to change DirectDraw surface bitmap
How to change DirectDraw surface bitmap
Go Back  Xtreme Visual Basic Talk > > > How to change DirectDraw surface bitmap


Reply
 
Thread Tools Display Modes
  #1  
Old 08-11-2013, 06:51 AM
ogi_dws ogi_dws is offline
Newcomer
 
Join Date: Jul 2013
Posts: 1
Default How to change DirectDraw surface bitmap


Hi I'm fairly new to DirectDraw and I currently writing a simple app where the main loop draws a surface using DrawFast method, it looks something like this:

frm.backbuffer.DrawFast(Control.MousePosition.X, Control.MousePosition.Y, frm.MySurface, DrawFastFlags.DoNotWait Or DrawFastFlags.SourceColorKey)

the image I'm drawing is a bitmap loaded into the memory, here's initialization of the surface:

MySurface = New Surface(bmpImage, New SurfaceDescription, GraphicsCard)

The problem here is that the 'bmpImage' is changing while the program runs and I don't know how to update this changes into the sprite surface. I want to note that I'm NOT trying to draw an animated sprite, so using a bitmap image with few frames on it is not a solution - I'm drawing a bitmap that is constantly changing.
What I'm doing now to update the surface is restoring the whole surface every time when it is drawn with this method:

Public Sub RestoreSurfaces()
Try
MySurface.Dispose()
backbuffer.Dispose()
GraphicsCard.RestoreAllSurfaces()
MySurface = New Surface(_BB, New SurfaceDescription, GraphicsCard)
Dim ck As ColorKey = New ColorKey
MySurface.SetColorKey(ColorKeyFlags.SourceDraw, ck)
ck = Nothing
Catch ex As Exception
MySurface.Dispose()
RestoreSurfaces()
End Try

I'm wondering is it a good way to update the surface image like that, or this is very slow and bad solution, if there is better solution, please let me know about it, thank you.
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

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
How to change DirectDraw surface bitmap
How to change DirectDraw surface bitmap
How to change DirectDraw surface bitmap How to change DirectDraw surface bitmap
How to change DirectDraw surface bitmap
How to change DirectDraw surface bitmap
How to change DirectDraw surface bitmap How to change DirectDraw surface bitmap How to change DirectDraw surface bitmap How to change DirectDraw surface bitmap How to change DirectDraw surface bitmap How to change DirectDraw surface bitmap How to change DirectDraw surface bitmap
How to change DirectDraw surface bitmap
How to change DirectDraw surface bitmap
 
How to change DirectDraw surface bitmap
How to change DirectDraw surface bitmap
 
-->