DirectDraw
I just switched the rendering mode from BitBlt to DirectDraw for my tile engine, but now it flickers quite badly when the map is scrolled. Can anybody help me please? I'm really new at all this DirectX programming. Also, I tried using a backbuffer... it didn't work... Still flickers... This is the code to create graphics to a picturebox ==>
Private Sub DrawSurface() Dim Dest As Rectangle Try BackSurface.ColorFill(Color.Blue) BackSurface.DrawFast(0, 0, MapSurface, Map.Rect, DrawFastFlags.Wait) Catch ex As SurfaceLostException InitializeSurface() End Try
Dest = New Rectangle(PointToScreen(Me.picMain.Location), Me.picMain.Size) FrontSurface.Draw(Dest, BackSurface, DrawFlags.DoNotWait) End Sub
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
About DirectDraw
If I wana make a 2d rpg in VB with Directx do I have to use Direct Draw.
And is there any other way to make a rpg/mmorpg with out Directx?
EDIT: Can BLit Blit thing make MMORPG's?
DirectDraw
I've started making a Mario type side-scroller by BitBlting tiles from a map onto a picturebox. It works well except I'm not getting the performance I need. Obviously what I need to do is use DirectDraw but how? Where do I start? What's the easiest way for something like this?
Thanx
FPS In DirectDraw
Could someone post the code to get the FPS of a program? I used to just get the code off of voodoo vb but now that its gone I dont have it anymore. I guess this time I will memorize and learn the code so I dont need to ask anymore, thanks in advance
DirectDraw
I am new (about 5 minutes) into working with DirectDraw, and I have learnt the following, however i want to be able to dim rBack as a polygon. How do I define and configure it?
Thanks!
Sub DrawPic()
If bInit = False Then Exit Sub
Dim rBack As RECT
rBack.Bottom = ddsd3.lHeight
rBack.Right = ddsd3.lWidth
Call BackBuffer.BltFast(0, 0, BitSurf, rBack, DDBLTFAST_WAIT)
Primary.Flip Nothing, DDFLIP_WAIT
End Sub
FX In DirectDraw
Hello everyone, just wanted to post some FX in directdraw (in case anyone is still interested). There are some algorithms for alphablending and colorkeying, plus simple rotation. Take it as my small contribution to the forum. Thanks and happy programming!
Edit by 00100b:
Attachment Removed. Compiled programs are not permitted as or within file attachments.
Please take a moment to read the Posting Guidelines for details of our standards.
GUI For Directdraw
Is there some standards on GUI for directdraw(dx7) or something?
What I want is to have all GUI stuff in a module(modGUI).
Kimbo
DirectDraw
Yeehaa!
Good Evening/Morning folks!
I have been didling around directx4vb and know some stuff from the past about DirectDraw so in the first example of DirectDraw the FullScreen one, it loads a bitmap (changed that to my sprite) so basically my question is how I can move my sprite!?
Couldn't find any .X or .Y for the bitmap/sprite.
DirectDraw
Can someone PLEASE Point me in the right direction of where i should start in directdraw, i have already been to directx4vb and i cant find what i need there, i cant figure out where to find actual drawing of sprites there.....
DirectDraw Vs GDI ?
I have recently bought a book about directx.
i have learned few chapters and i wanted to ask :
whats the benefits of using directdraw instead of gdi ?
speed ? , better graphics ? better options ?
as far as the book got i saw same api's in gdi.
and DD is harder to use sometimes
DirectDraw :/
Hey, im not the greatest with direct draw. in fact, i just started learning. im not sure this is the place to post. if its the wrong place, please move it to the appropriate place thanks
heres my code..
http://www.nomorepasting.com/paste.php?pasteID=1452
I get this error :
Runtime error 402: object required on this line:
SRect.Bottom = ddsd2.lHeight
what im trying to do with this code is draw the picture (funny.bmp) to the screen (picture1). Please take a look, and thanks in advance
Help With Directdraw
Anyone know where I could get a easy tutorial on DirectDraw for vb? It seems most of the documentation is using 'hardcore directX programmer' terms without explaining them properly.
DirectDraw
I have tried initializing DirectDraw with the following code :
private DirectX as DirectX7
private DirectDraw as DirectDraw7
private SurfaceDesc as DDSURFACEDESC2
private PrimarySurface as DirectDrawSurface7
private BackBuffer as DirectDrawSurface7
private Sub Main()
set DirectX = new DirectX7
set DirectDraw = DirectX.DirectDrawCreate("")
'error 1 :
DirectDraw.SetCooperativeLevel 0, DDSCL_FULLSCREEN Or DDSCL_ALLOWMODEX Or DDSCL_EXCLUSIVE
DirectDraw.SetDisplayMode 1024, 768, 16, 0, DDSDM_DEFAULT
With SurfaceDesc
.lFlags = DDSD_CAPS Or DDSD_BACKBUFFERCOUNT
.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE Or DDSCAPS_COMPLEX Or DDSCAPS_FLIP
.lBackBufferCount = 1
End With
'error 2 :
set PrimarySurface = DirectDraw.CreateSurface(SurfaceDesc)
SurfaceDesc.ddsCaps.lCaps = DDSCAPS_BACKBUFFER
set BackBuffer = PrimarySurface.GetAttachedSurface(SurfaceDesc.ddsCaps)
set PrimarySurface = nothing
set DirectDraw = nothing
set DirectX = nothing
End Sub
When running it, the line just after "ERROR1" causes an "Invalid procedure call or argument" error.
The error does not occur only when I change the flag argument to DDSCL_NORMAL.
This, expectedly, causes an automation error (2005532447 - DDERR_NOEXCLUSIVEMODE ) in the line after "ERROR2".
Any help would be highly appreciated,
Gino
DirectDraw
I now that what i want to do needs DirectDraw but i dont know how to use direct draw with visual basic or visual c and i don't have any examples , so if you can help me for that you make a very big faivor to me, thanks
if you have any examples, i need examples with visual basic
GDI/DirectDraw + Scrollbars
Hello,
I'm using VB.NET (2002) and I made a (stupid) chatprogram.
Now my problem is that I got sùper slow graphics when resizeing.
I used panels to get it all working wright (bad idea?). I made my own titelbar and the rest of the frame, with one panel that resizes is the titelbar.
Now my question is:
- Can it be done faster?
- Can i use DirectDraw for fixed graphics and resizable graphics (I don't know anything about DirectDraw .
- Is it possible to change the scrollbars to your own graphics (Like messenger 6.0/6.1)?
Thanks in advance.
Load PNG Using DirectDraw
Hello all, I'm currently making a game and some of the sprites will be in PNG file format for the alpha channels. I'm looking a way to load the PNG images using DirectDraw so when displaying the tiles it blts very fast.
Thanks.
DirectDraw Flicker
Hey guys,
Im quite new to Directx (not VB though) and I went through the DirectDraw tutorial that suqirm posted. When the program runs, i can see my icons in the taskbar flickering in and out of vision. I copied the exact code that was posted in his second post, to the exact same result. Is this just a flaw with DirectX7 and VB? or is it my computer? Is it just the way that tutorials code is?
Thanks for anyhelp.
Ps. It'd be great if someone could point me in the direction of a more full blown DD tutorial. (not directx4vb.com that site doesn't work!)
DrawText With DirectDraw
Hi, I'm a complete newbie on DirectX, and I was wondering if anyone could give me a VERY SIMPLE COMPLETE code on how I can print "Hello World" or something to a PictureBox using DirectDraw?
Any help greatly appreciated!
Working On A Rpg Using Directdraw
im currently learning how to use directdraw and directplay to make a simple mmorpg to further my skills...however i looked up how to draw a gif or jpeg..in order to show my character and move him around and such in a similar sense to using bitblt...draw the charater..then if it turns left draw that picture showing the character going left..however my efforts have failed and ive spent over 4 hours trying to work it out..searching the net and stuff..
i still cant seem to achieve this..can anyone help me out??
thanks,
dan
Need Help With Collision DirectDraw
I already made a collision between the bird and a bubble...
When collided the bubble will disappear and add 1 to score...
But the problem is everytime the bird collided with the bubble...The incrementing score is unstoppable...
The bubble moves in ascending movement...when it reaches the top...will reset the position underneath...
Then I'm able to make the bubble dissappear when collided with the bird, although the bubble disappear...it seems to me that the bubble is still present although not beeing seen on the screen...I notice it when the score is still incrementing...
the code goes like this
public type Bubbletype
x as integer
y as integer
rRedRect as rect
visible as boolean
end type
public redBubbles() as Bubbletype
.....
some part of the loop
for i=0 to ubound(redBubbles)
if redbubbles(i).visible=true then
msback.bltfast ......................
else
redbubbles(i).visible=false
end if
next i
if bX > redbubbles(i).X -40 and bX < redbubbles(i).X +40 and by > redbubbles(i).y -40 and bX > redbubbles(i).y +40
redbubbles(i).visible=false
score=score+1
endif
DirectDraw Game
can someone tell me how to
display 2 transparant pictures on a form in windowed mode
i don't want a tutorial from a website, cause i don't understand a thing of them
Direct3D And DirectDraw
Hello I want to know if it's possible to Directly mix D3D with DirectDraw
the reason is that we are writing a 2d Scroller with D3DSprites so we can have more effects etc
so again is this anyway possible?
Best wishes,
Kirk Quesnelle
DirectDraw Sprite Help
Hey um i got this nice/speedy/scrolling tile thingy from psc and it has 1 sprite. im new with directdraw and ive learned alot from it ect,ect,ect but like for sprites would i put them all on the same surface? or would i have to possibly index the surface or something. i tried loading 2 sprites each with there own surface but it kinda didnt go to right. im making a MMORPG btw. itll be a free gaming engine u can download and map and make the npc's ect,ect,ect
Initialize Directdraw
in http://www.kuhnstall.de/tutorials/dx9sharp1.html
i saw a good C# tutorial. it explains everything THOROUGHLY
i tried converters and everything to make it work in VB but it didnt work
can some1 tell me how to do the same in VB(using the same way they did it on the site)
i see different ways like:
"
objBackBufferSurface.BltFast(this.XPosition,
this.YPosition,
m_objBitmapSurface,
ref m_objSizeRECT,
CONST_DDBLTFASTFLAGS.DDBLTFAST_SRCCOLORKEY | CONST_DDBLTFASTFLAGS.DDBLTFAST_WAIT ); "
that gets too complicated!!!
the way they teach you on the site is easy and it makes sense. DirectX 9.0a doesnt have the wizards for Visual Studio.NET to do it, so i need some1 to help me initialize directDraw in DirectX9.0a in VB.NET
i saw other ways to do it on VB but not VB.NET
2D Top Down RPG, ImageBoxes, API Or DirectDraw?
Hi,
I'm creating a small RPG that will be played online. I've decided to go top down 2D style, with a relatively simple tile engine. The graphical engine itself is in the middle of a form. I've read about different ways to do tiles engines but i still can't make up my mind.
As i see it, there are two solutions:
Use Directdraw, faster graphics, harder to code, but allows for easier transparency for sprites,
or use one image box per tile, Slower, can do transparency but need to use masks, not possible or hard to do sprites that go "across" tiles on a diagonal way...
So, anyone got an opinion on this? Have you done a tiel engine before, what method did you use, what were the problems you encountered, etc...
Thanks in advance, your help and experience is very much appreciated...
Imperio59
Slow Directdraw?
Hello
Why is the Drawbox function in DD7 so slow? (i get my fps cut in half)
Is there anyway to avoid this?
-thanx
DirectDraw Messages
Since visual basic message boxes don't show while using directdraw, I want to display text to who ever is playing. So far I came up with this:
Code:
Private Sub DisplayTxt(ActString As String, Length As Integer)
primary.SetFillColor RGB(100, 120, 225)
primary.SetForeColor RGB(255, 255, 255)
primary.DrawRoundedBox 0, 464, 640, 480, 10, 2
primary.DrawText 0, 464, ActString, False
Sleep Length
End Sub
The only problem is that the "Sleep" function stops the game. That's fine and I don't care about that (although I would like a way so everything still moves) but if the player repeatedly presses an arrow key while its "Sleeping" the player "jumps" across however many spaces they pressed once it's done sleeping. How can I make it so everything can still move while displaying text or make it so you can't move while it's displaying?
Help, DirectDraw Clipping
Hi everyone, I'm a newbie here, so take it easy on me
I have a serious problem. My demo is a sliding world where the red sprite is actually going to be the main character. When you press the arrow keys, the sprite moves and so does the background. There is also a red block blitted onto the background and when ever it gets to any edge of the screen, it dissapears. I have clipping code(which I found on these forums), but it doesn't seem to work. Could someone please check it out and perhaps tell me what I'm doing wrong. I put the clipping code in a nice "CheckClip" sub.
Thanks.
DirectDraw Clipper
Hi,
Can anyone tell me why people use this function? I'm not too sure on what it does.
DirectDraw - Blt Problem
Hello, I am having a problem with my directdraw application I am working on. I Have one main picture box where everything is supposed to render. I setup all of the rectangles to blt in the correct spots, thats where the problem kicks in. The Source Rectangle works fine, but the Destination Rectangle doesn't want to cooperate .
I can use the following command perfectly:
Code:
Call DX.GetWindowRect(FrmMain.PicMain.hWnd, DestRect)
This command, obviously sets up the Destination Rectangle perfectly, but when I want to place a specific tile (This is a Map Editor/Tile Engine), it blts to the screen coords and not coords in the picture box. For example, If .Left and .Top were set to 1, and .Bottom and .Right were set to 32, then would be put on the top left hand of the screen. They won't show up unless part of the picture box is in that area though because of the clipper. I would like to know how to change that so the coords are picturebox coords and not screen coords, that way the location of my form and picture box doesn't matter. So using the example destination rectangle, it would blt to the top left of the picturebox instead. The command shown above in the VB Code works which I don't understand. No matter where my form or picturebox is located, it will blt perfectly (although it distorts the image obviously). Thanks for your help.
DirectDraw Surfaces
HI,
I have my isometric engine working fine. I'm now at the point where I'd like to use a bitmap which contains multiple frames of movement e.g. a character walking. How do I go about this? I just want so if I push up he moves into the up position and walks else stands facing up. Is it possible?
Cheers
First DirectDraw Program
I am new to DirectDraw and I want to make a small game using it. I based it off of DirectX4VB.com tutorials. I am able to make a map but I have no idea how to put the character on it. I also will need to know how to move the character and stop him when he runs into walls. Can anyone help me with this problem?
Windowed DirectDraw In MDI?
Hey. My program uses an MDI environment, with each file window being a picture box and a few buttons. Previously I've been using BitBlt to draw the interface in the picture box, but I've decided to switch to DirectDraw with the hope that it will speed things up - there's noticeable lag in certain parts of my program, such as scrolling quickly or when I run a timer which checks a fairly large array.
How would I set DirectX7 to draw individually in each window? From the Windowed DirectDraw Tutorial, it seems that the clipper is the only link between the picture box and the primary surface. Another method I could think of is assembling everything from several surfaces into one and using BltToDC. I leaned towards the latter mainly because I don't like defining RECTs, and BltFast doesn't require two RECTs.
Regardless, I attempted to use the BltToDC method at least to test if I was getting DirectDraw to work, and so far nothing is happening. The only thing is that a black box of the right size is appearing on the picture box. Anyone know what my problem is? Here's the relevant code:
Code:
'Main Variables
Dim DX As New DirectX7
Dim DD As DirectDraw7
Dim rollBitmap As DirectDrawSurface7
Dim rollKeys As DirectDrawSurface7
Dim rollBG As DirectDrawSurface7
Dim descRollBitmap As DDSURFACEDESC2
Dim descRollKeys As DDSURFACEDESC2
Dim descRollBG As DDSURFACEDESC2
Code:
Private Sub MDIForm_Load()
maxWidth = Int((Screen.Width / Screen.TwipsPerPixelX) / 256)
maxHeight = Int((Screen.Height / Screen.TwipsPerPixelY) / 144)
Set DD = DX.DirectDrawCreate("") 'Create DirectDraw
Call DD.SetCooperativeLevel(Me.hWnd, DDSCL_NORMAL) 'Set Windowed
descRollBitmap.lFlags = DDSD_CAPS
descRollBitmap.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
Set rollBitmap = DD.CreateSurfaceFromFile(App.Path & "pianoroll.bmp", descRollBitmap)
descRollKeys.lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH
descRollKeys.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
descRollKeys.lWidth = 65
descRollKeys.lHeight = 144
Set rollKeys = DD.CreateSurface(descRollKeys)
descRollBG.lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH
descRollBG.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
descRollBG.lWidth = (maxWidth + 1) * 256
descRollBG.lHeight = (maxHeight + 1) * 256
Set rollBG = DD.CreateSurface(descRollBG)
Dim key1Rect As RECT
key1Rect.top = 0
key1Rect.Bottom = 12
key1Rect.Left = 0
key1Rect.Right = 65
Dim key2Rect As RECT
key2Rect.top = 12
key2Rect.Bottom = 24
key2Rect.Left = 0
key2Rect.Right = 65
Dim bar1Rect As RECT
bar1Rect.top = 36
bar1Rect.Bottom = 48
bar1Rect.Left = 0
bar1Rect.Right = 256
Dim bar2Rect As RECT
bar2Rect.top = 24
bar2Rect.Bottom = 36
bar2Rect.Left = 0
bar2Rect.Right = 256
Call rollBitmap.BltFast(0, 0, rollKeys, key1Rect, DDBLTFAST_WAIT)
Call rollBitmap.BltFast(0, 12, rollKeys, key2Rect, DDBLTFAST_WAIT)
Call rollBitmap.BltFast(0, 24, rollKeys, key1Rect, DDBLTFAST_WAIT)
Call rollBitmap.BltFast(0, 36, rollKeys, key2Rect, DDBLTFAST_WAIT)
Call rollBitmap.BltFast(0, 48, rollKeys, key1Rect, DDBLTFAST_WAIT)
Call rollBitmap.BltFast(0, 60, rollKeys, key2Rect, DDBLTFAST_WAIT)
Call rollBitmap.BltFast(0, 72, rollKeys, key1Rect, DDBLTFAST_WAIT)
Call rollBitmap.BltFast(0, 84, rollKeys, key1Rect, DDBLTFAST_WAIT)
Call rollBitmap.BltFast(0, 96, rollKeys, key2Rect, DDBLTFAST_WAIT)
Call rollBitmap.BltFast(0, 108, rollKeys, key1Rect, DDBLTFAST_WAIT)
Call rollBitmap.BltFast(0, 120, rollKeys, key2Rect, DDBLTFAST_WAIT)
Call rollBitmap.BltFast(0, 132, rollKeys, key1Rect, DDBLTFAST_WAIT)
Dim temp As RECT
temp.Bottom = 144
temp.Right = 65
Call rollKeys.BltToDC(winRes.pianoKeys.hDC, temp, temp)
winRes.Show
DirectDraw Problems...
Hi...
I recently began learning DirectDraw...
I am learning from the tutorials on directx4vb.com
and am using the source from the Fullscreen tutorial in my current project...
all im trying to do is this:
load a bitmap file into a surface
and then draw the bitmap all over the screen(the bitmap is a tile for a tile based game...42x28 pixels)
and i try to start in the top-left corner and work my way to bottom right...
i use CreateSurfaceFromFile and make a surface called
tileSurface
and in the blt sub i try to tileSurface.BltFast(0, 0, Mainsurface, rBack, DDBLTFAST_WAIT)
when i execute the program...it looks really crappy
a whole bunch of blinking 'static' crap....i know this has nothing to do with the bitmap cause when i just create a blank surface instead of from file i get the same result...so i am obviously doing something wrong....
(i attached the source of my program...)
can anyone help?
Thanks
-rkinasz
Transparent In DirectDraw 7
How to make the picture become transparent in DirectDraw?
I have a picture will Green(RGB:0,255,0) background but while i set the low and high of DDCOLORKEY to "&H7E0", the picture is become transparent but it leave a green border around the character of the picture?
Original Picture
http://www.angelfire.com/super2/alex...s/Original.JPG
After Transparent
http://www.angelfire.com/super2/alex...ages/After.JPG
Have i do something wrong of the value of DDCOLORKEY?
Can any one tell me how to set the value correctly?
Thanks a lot!
DirectDraw Problem
I'm trying to make a Screen Saver with DirectDraw which displays the Bitmap contents of a select folder but the program won't run and the programs log says nothing bad happened
Yet A Few More DirectDraw Questions
Here it is:
1) DirectDraw works, my background shows up nicely, even the image I place on top of background is visible, but, the mouse cursor isn't visible when I don't move the mouse, and when I do move the mouse, the cursor flickers in the background....any ideas?
2) Whenever I bring bitmaps, whatever colours I'm using, it stays the same, but much brighter (I'm using 32-bit and the pictures are drawn with 256 colors) and even if I try to change the colours in the bitmaps, it will still display the new colours brighter....is it just a DirectDraw thing or am I doing something wrong?
If I need to explain better or show some code then please tell me
Thanks
Need A DirectDraw Tutorial
Hi There
I've seen the Tutorial in the Tutor's Section, and although it's helped out a lot, I've had to use two tutorials to be able to learn minimal DirectDraw. (The other is from www.allapi.net)
But I was wondering if anybody out there could post directions to a site, or if they really wanted to write the tutorial themselves then ok, but a tutorial on DirectDraw using DirectX 7, and VB 6.0
I've looked around the net but haven't been able to find DirectX 7 tutorials, and I'm having problems understanding all of the DirectDraw tutorial in the Tutor's Section. My goal is to be able to set a background and eventually move in to transparencies (but that's far off)
I've got everything set up thanks to the Tutor's Corner, now I just need help in loading and displaying Bitmaps. I have only two surfaces set up, Primary, BackBuffer and the rest of my code is mainly just setting up DirectDraw and nothing to do with the imaging part. If anybody can point me in the right direction then I'll be a happy man
Thanks
2 Things In DirectDraw
Here are my 2 questions:
1) Why is it that when you set the color key for the Source surface, only black seems to work. Ive used magenta and it still appears when i Blt it to another DD surface.
2) What are overlays used for and How do you code them?
All this is in VB (just in case someone thoughtn it may be C++) Any help appreciated.
PNG Files And DirectDraw
I'm attempting to load a png file into a directdraw surface and am using some of the tutorials here on these forums. The one I am trying to use is JimCamels FreeImage method. However, I downloaded the new FreeImage dll from the site and I am getting an error on the line:
FreeImage_Free DIB_New
The error says it can't find the entry point for that function in the dll. I'm assuming it is because that function isn't supported in the newer version of the dll, but maybe i'm wrong. Anyone have the older version of the dll that works with the example? I have the modFreeImage.bas file was created awhile back and am trying to use that too. Any help would be appreciated. Thanks.
Is DirectDraw Normally This Slow?
OK, so I've made a very simple program that rotates three primitives (lines) so that it looks like a triangle spinning.
I've got a 1.8GHz P4 and 512MB of RAM, and this program bounces between 60FPS and 22FPS. Something tells me that something this simple really shouldn't be this slow.
*Note* Right now, it's configured to run at 1024x768, because that's my screen resolution. It was originally made to run in 640x480, but whenever I stopped the program, VB went crazy. The Project Explorer Window, Properties List, and Form Layout window all changed sizes, and VB ended up in like 1/4 of my screen.
You can easily change it back to 640x480 if you wish, and the program will still run perfectly fine, and you'll be able to see the triangle and everything.
Resources And DirectDraw
I am trying to make surfaces from resource file. The problem is that VB can't find the resource file, while stand-alone exe can. That is, if the resource file is included to the exe.
The question is: How can I make external resource file that is accessable from VB AND from exe? To be able to do both is quite essential.
I am using VB6 and DX7.
DirectDraw Transparency (Dx7)
Ive got this code (but not right next to eachother)
Code:
Public DDTrans As DDCOLORKEY
...
DDTrans.high = 0
DDTrans.low = 0
...
SDSprite.lFlags = DDSD_CAPS Or DDSD_WIDTH Or DDSD_HEIGHT
SDSprite.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
Set DDSprite = DirectDraw.CreateSurfaceFromFile(AppPath & "Sprite.bmp", SDLaser)
DDSprite.SetColorKey DDCKEY_SRCBLT, DDTrans
Am I forgetting something? It doesnt transparenc-'ise'! But as if I didnt put that in...
Another DirectDraw Problem...
OK, here is my class code for the DirectDraw object, the Load procedure
Code:
Public Sub Load(ByRef Picture As PictureBox, ByRef SCREENWIDTH As Integer, ByRef SCREENHEIGHT As Integer)
On Error GoTo ErrorHandle
Set DDScreen = Nothing
Set DDBuffer = Nothing
Set DDClipper = Nothing
DirectDraw.SetCooperativeLevel Picture, DDSCL_NORMAL
SDScreen.lFlags = DDSD_CAPS
SDScreen.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE
SDScreen.lWidth = SCREENHEIGHT
SDScreen.lHeight = SCREENWIDTH
Set DDScreen = DirectDraw.CreateSurface(SDScreen)
'RectScreen.Left = 0
'RectScreen.Top = 0
'RectScreen.Right = SDScreen.lWidth
'RectScreen.Bottom = SDScreen.lHeight
SDBuffer.lFlags = DDSD_CAPS Or DDSD_WIDTH Or DDSD_HEIGHT
SDBuffer.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
SDBuffer.lWidth = SCREENWIDTH
SDBuffer.lHeight = SCREENHEIGHT
Set DDBuffer = DirectDraw.CreateSurface(SDBuffer)
'RectBuffer.Left = 0
'RectBuffer.Top = 0
'RectBuffer.Right = SDBuffer.lWidth
'RectBuffer.Bottom = SDBuffer.lHeight
Set DDClipper = DirectDraw.CreateClipper(0)
DDClipper.SetHWnd Picture.hWnd
DDScreen.SetClipper DDClipper
Exit Sub
ErrorHandle:
MsgBox "Unable to install DirectDraw. Game cannot begin."
End
End Sub
And in another procedure ive called this:
Code:
Public Sub Paint(ByRef Picture As PictureBox)
DirectX.GetWindowRect Picture.hWnd, RectScreen
DDScreen.Blt RectScreen, DDBuffer, RectBuffer, DDBLT_WAIT
End Sub
I am using 'DDScreen.Blt' instead of 'BltFast' because if I put this in:
Code:
DDScreen.BltFast RectScreen.Left, RectScreen.Top, DDBuffer, RectBuffer, DDBLTFAST_WAIT
It does not display... What could be wrong?
DirectDraw Blt Interpolation
How to turn off pixel interpolation when scale-blitting from one surface to another? It seems to be on by default.
CommonDialog In DirectDraw
I'm making a game in Directx7/DirectDraw and I want open levels using the standard CommonDialog control, but when the command CommonDialog1.ShowOpen is executed I can't see the CommonDialog window.
Some times I can see it(rare), but the background screen is gone, I only see a black screen.
Please help me.
Thanks
DirectDraw 7 Problem
I have a tile editor in windowed mode. When I first start off I have 3 picture boxes. 1 for the map, 1 for tileset, and 1 for tile layers. The tileset and tile layer picture box's are in a tab strip. So if you want to add multiple tilesets, it adds another tab with another picture box.
When I only have 1 tab for tileset everything draws fine.
When I add a tileset, and another tab is created with another picture box, everything draws fine. BUT when I click on tabs, the tileset gets drawn for like .5 seconds and then disapears. Then if I move the window so the picture box needs to get repainted the tileset will show up. The wierd thing is the map and tileset get draw together. I have something like:
Function Clear()
Function DrawMap()
Function DrawTileset()
I'm drawing everything to Primary right now, since it's not a constant drawing it doesn't need to be double buffered at the moment. Any help would be great. Thanks.
-Rick
DirectDraw Flip VS. BLT
Having read Jonathan Harbours book through almost twice now, I can't seem to figure out why he chose to Blit the backbuffer to the Primary surface instead of flipping it.
Is there an obvious choice for speed? Are there limitations to flipping as opposed to just using the BltFast comand?
By the way, This is in regards to Direct X 7, if you didn't already figure that out by the Direct Draw subject.
|