Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DirectX tutorials
#1
any tuts on using this with vb so I can learn how to do this better

I need to learn to place the current map on a form and the character and npc so on...

thanks
Reply
#2
orpgkings.com has 3 links posted ... 2 are for dx7 and the other is dx8 ... ill try find the link, its in a post on their forums though
Reply
#3
directx4vb.vbgamer.com has lots
Reply
#4
And what version does mirage use? or version doesnt matter
Reply
#5
Yeah im trying to figure out where it gets the current map and displays it on picScreen. I want the current map to also be shown on a new form that pops up.
Reply
#6
So you are doing a mapeditor? Tongue
Reply
#7
Ms uses Version 7 which has direct draw, since any version above doesnt have directdraw

And which bit are you trying to figure?
Reply
#8
Oh yea, ms also Uses Blt Apis instead of Directx in some places (no idea why) so just so you know, I think the only time it uses dx is when blting to Backbuffer and primary surface, any other time its using and api (for example, item editor pic boxes, mapeditor box etc)
Reply
#9
now I have it open a battle form. I want the exact same map that they are on to be displayed on it.

I made picScreenB on the form and copied all the DX stuff I found for PicScreen to go with B too and it gave an error when I got to frmMirage.

Im not sure how to go about this.
Reply
#10
picScreen, has been set as a primary surface which is clipped directly to a surface so when the surface updates, it shows it on the screen (Sorry, thats like the best way I could explain it and thats still not that good)

So you could either create a second primary surface, or Just blt straight onto the picbox using directx. I'm not that good at remembering the method of blting to a picbox, but I know it, i'll jsut go test it out..
Reply
#11
http://ms.shannaracorp.com/forums/viewtopic.php?t=47

Thats a Tut I made a while ago that I made blt from DX surface into a picture box, mayb/maynot help but thats basicly what you'll probably have to do. You'll have to adapt this so that it'll use Backbuffer as source instead of the items surface but err, maybe someone else can explain better

Quote:First, we’ll start by adding a timer, that every time is set off, will draw the item back into the picture boxes, so create a timer called ‘tmrBlt’ with an interval of 50.
Then add this code
Code:
Dim n As Integer
Dim DC As Long
  
    ' Get the DD Item surface DC
    DC = DD_ItemSurf.GetDC

    For n = 1 To 3
        If lstItem(n).ListIndex > 0 Then
            Call BitBlt(picItem(n).hdc, 0, 0, PIC_X, PIC_Y, DC, 0, Item(lstItem(n).ListIndex).Pic * PIC_Y, SRCCOPY)
        Else
            picItem(n).Refresh
        End If
    Next n
  
    ' Not 100% sure, but it unlocks the surface after you've gotten its dc
    Call DD_ItemSurf.ReleaseDC(DC)

Not much difficult to understand with this code
DC = DD_ItemSurf.GetDC
This is like an address to the surface which we need to be able to blt something directly from the direct draw surface, only problem is that by doing this, we lock up the surface (I’ll tell you how to unlock it later)

For n = 1 To 3
If lstItem(n).ListIndex > 0 Then
Call BitBlt(picItem(n).hdc, 0, 0, PIC_X, PIC_Y, DC, 0, Item(lstItem(n).ListIndex).Pic * PIC_Y, SRCCOPY)
Else
picItem(n).Refresh
End If
Next n
That is the main section, all it does it runs through each picture box, checks if there’s an item selected in the list box, if there isn’t, it clears the picture box to make it blank by using the refresh function.
If there is an item to be bltted then it will call bitblt.
The first argument, picitem(n).hdc is basically the address for the picture box that were drawing to
The next two arguments are the x,y coordinates and since we want to blt it at the very top corner of the picture box, we have it as 0,0
The next two following them are the width, and height, and for both I have used a constant which at default are both 32 (Same size as the picture box)
Onto the next argument, this is where we supply the address to the source, which in this case is the direct draw surface, which if you remember, we saved to the variable DC
Next two arguments are the source x,y. Since we start on the very left of the item sheet, x = 0, but since y changes depending on the item, we find out what picture number the item is assigned, then we multiply by 32(pic_y) pixels to get the actual location on the items sheet
The final Argument tells it what type of blt to perform, there are many different types, depending on what effects you want but this one (SRCCOPY) just copies the image directly over as it is
The final piece of text (Call DD_ItemSurf.ReleaseDC(DC)) is the part that unlocks the surface we used as a source
Reply
#12
that will let me blt from a file right but it wouldnt be the current map would it? cause it has to read the map file and all that stuff
Reply
#13
Nope, that will blt directly from another surface, which is what the map is drawn on (The backbuffer)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)