Mirage Source http://miragesource.net/forums/ |
|
DirectX tutorials http://miragesource.net/forums/viewtopic.php?f=201&t=307 |
Page 1 of 2 |
Author: | halla [ Sat Jul 22, 2006 5:33 am ] |
Post subject: | DirectX tutorials |
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 |
Author: | Leighland [ Sat Jul 22, 2006 6:06 am ] |
Post subject: | |
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 |
Author: | Kevin [ Sat Jul 22, 2006 7:55 am ] |
Post subject: | |
directx4vb.vbgamer.com has lots |
Author: | Krloz [ Sat Jul 22, 2006 5:05 pm ] |
Post subject: | |
And what version does mirage use? or version doesnt matter |
Author: | halla [ Sat Jul 22, 2006 5:57 pm ] |
Post subject: | |
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. |
Author: | Krloz [ Sat Jul 22, 2006 6:19 pm ] |
Post subject: | |
So you are doing a mapeditor? |
Author: | funkynut [ Sat Jul 22, 2006 6:19 pm ] |
Post subject: | |
Ms uses Version 7 which has direct draw, since any version above doesnt have directdraw And which bit are you trying to figure? |
Author: | funkynut [ Sat Jul 22, 2006 6:21 pm ] |
Post subject: | |
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) |
Author: | halla [ Sat Jul 22, 2006 6:22 pm ] |
Post subject: | |
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. |
Author: | funkynut [ Sat Jul 22, 2006 6:32 pm ] |
Post subject: | |
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.. |
Author: | funkynut [ Sat Jul 22, 2006 6:39 pm ] |
Post subject: | |
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 |
Author: | halla [ Sat Jul 22, 2006 7:01 pm ] |
Post subject: | |
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 |
Author: | funkynut [ Sun Jul 23, 2006 12:43 am ] |
Post subject: | |
Nope, that will blt directly from another surface, which is what the map is drawn on (The backbuffer) |
Author: | Lea [ Sun Jul 23, 2006 12:57 am ] |
Post subject: | |
You can blit from the picture box container into whatever you want using the blit API. Otherwise you can use take it from the backbuffer and put it where you want. |
Page 1 of 2 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |