| Mirage Source http://web.miragesource.net/forums/ |
|
| DirectX Tests http://web.miragesource.net/forums/viewtopic.php?f=201&t=857 |
Page 1 of 1 |
| Author: | Lea [ Sat Dec 16, 2006 11:18 pm ] |
| Post subject: | DirectX Tests |
DirectX Test 1: Copying surface to surface using GetLockedArray Today, with verrigan's help, I managed to finish Test 1 of my series of DirectX tests. I wanted to copy a surface to another surface using GetLockedArray. This was to prepare me for something I had planned to do in my Tileset engine. This test was mostly a proof of concept. Anyways, I hope you can learn something from it. Using this code as-is isnt very practical for copying a surface. It takes about 15 milliseconds for me on my computer to copy a 32x32 tile. You can just blit the picture and it copys almost instantly. You can download my source at http://www.eternalflameonline.com/dxtest1.rar Please test it for me, and make sure it works. If it works, both pictures will look the same. Thanks, and happy coding. Dave |
|
| Author: | Dragoons Master [ Sat Dec 16, 2006 11:24 pm ] |
| Post subject: | |
It shows the img on the screen, it works here ^^ Nice job |
|
| Author: | Lea [ Sun Dec 17, 2006 5:59 pm ] |
| Post subject: | |
DirectX Test 2: Getting surface from a file containing surface information. This is to prepare for my TileSet engine, where I want to save the surfaces in a file (I still have other things to test to see if they're possible/faster) Using this code as-is isn't very practical for loading a picture from a file. It takes about 80 milliseconds for me on my computer to copy a 64x64 tile. You can load a surface from a bitmap image much faster. (The time to load a picture to a surface and save the data is only a small bit slower than loading the data to a surface alone) You can download my source at http://www.eternalflameonline.com/dxtest2.rar Pleast test it for me, and make sure it works. If it works, both pictures will be the same. You need to run this program twice, once to save the data and another to display it. Happy coding, Dave~ |
|
| Author: | Lea [ Sun Dec 17, 2006 6:15 pm ] |
| Post subject: | |
DirectX Test 3: Is this stuff hardware dependant, and all a waste of time? If this doesn't work for everyone, all of this was a waste of time. This code is mostly the same as test2, except this code doesn't have the power to save the picture to a file. This is to more-closely model how the tileset would be loaded in game. You can download my source at http://www.eternalflameonline.com/dxtest3.rar In this package, there are two sets of Image and Data. They're Named BackDrop1.bmp, and TileData1.bin; and BackDrop2.bmp and TileData2.bin. To test this, you need to rename one pair to BackDrop.bmp and TileData.bin (remove the numbers) If it works, try the other pair. If it doesn't please let me know ASAP (a picture would be great!)! This is a very important test. It is considered "working" if both pictures are the same. If this one seems to work for everybody, i'll make a followup program with more images to test. I must be certain that this will work for everyone. Thanks for your help! Dave~ |
|
| Author: | Lea [ Sun Dec 17, 2006 6:51 pm ] |
| Post subject: | |
Some fun on the side, DirectX Test 4: Alpha Blending By popular demand, I threw together an alpha blending example. This takes two surfaces and blends them together. It currently "animates" them, with the alpha value increasing by .1, then decreasing by .1 from 0 to 1. You can change this if you desire. With my example, the two surfaces need to be exactly the same size. If you would like, you could add checks and balances to make this not so. You can change the pictures to whatever you'd like, as long as they are the same size. It takes just over a second for each frame to do a 300x306 bitmap. I wouldnt recommend doing this in real time, unless they were very, very small surfaces and you only had to do a few of them. It would probably be faster to make the alpha blending code into a DLL file and make calls to it. however, you could "pre-render" the alpha blending stages, then just blt them to the surface when you need them. For example, if you wanted to turn a sprite green, you could open another copy of the sprite, and alpha blend it with a green color. Then use that sprite, since all the frames are done already. You can download my source at http://www.eternalflameonline.com/dxtes ... ending.rar Enjoy it! Show me what you get working with it |
|
| Author: | Dragoons Master [ Sun Dec 17, 2006 9:49 pm ] |
| Post subject: | |
Everything working perfectly, NICE JOB! |
|
| Author: | Lea [ Sun Dec 17, 2006 11:35 pm ] |
| Post subject: | |
With test 3, if you change your display settings to display 16 bit colors instead of 32 bit colors it doesn't work. If I make the game fullscreen, and force 32 bit colors (or force 16 bit colors) it would work, but I wouldnt be able to use this method if it could be any dispay mode, such as a windowed game. Drat... I'm going to make up some more tests for you guys... |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|