snarfblam
Leaders-
Posts
2156 -
Joined
-
Last visited
-
Days Won
2
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by snarfblam
-
Tetris is also windowed, not that that necessarily matters, i dont know; I've never made a windowed program in directx. But a question about those tutorials: where are they? The only directx tutorials that came with the sdk that i can find are for direct3d. Worse yet, the only documentation I can find is the C++ documentation. Microsoft.com is very lacking in Directx9 documentation, as well as the rest of the internet.
-
I don't understand how you can just pop into a forum and say "hey, can you convert my program into directx" and expect someone to just do it. I'm not trying to insult you, but it strikes me as childish of you when someone says "the midi wouldnt play" and you reply "oh, well can you fix it for me and post it?" If you want a game programmed in direct-x, you really have to learn directx for yourself. You can't expect someone else to just do it for you. You can learn from tutorials, or from other people's source. I learned alot about directdraw recently (in the past week) at Directx4.net, and from the source for tetris found in this directx forum. I am already started on a scrolling Zelda-style rpg. Maybe I'm wrong, but it seems to me you ought to do your dirty work for yourself instead of expecting others to (unless you pay them). It's hard to find decent documentation on managed directx but if I can do it, you can too.
-
In my program I am drawing to the backbuffer, which has a clipper tied to the form being drawn on. When I try to blit over the edge of the form, however, the program raises an exception: Error 5: Error in the application. Am I confused or should the clipping rectangle (set to contain the form by clipper.window = targetform) prevent errors caused by blitting outside the edges of the surface? I'm wondering if this would work on the .draw method and not the .drawfast method
-
Hey, thanks a ton for the info guys.
-
I've been using an external manifest file and it has been working exactly as one would expect. The problem comes about when I open an exe file with studio, and edit and save it. Even if I don't add the manifest, the icon still shows in 8-bit in explorer. I really doubt that this problem is related to the manifest. I just think studio.net has issues with 32-bit icons, but i really dont know; it could be something else
-
I've made a program with Visual Basic.net. After I compile it, I open the executable to include a manifest file as a recource so that my controls are all Windows Xp style. The program's icon, however, has a windows Xp Icon format (32 bit A8R8G8B8). When I open the executable, add the manifest, and save the executable, the program's icon no longer appears in the 32-bit format, but instead, in the 8-bit format. (The icon has 4-bit, 8-bit, and 32-bit formats at 16x16, 24x24, 32x32, and 48x48 resolutions.) I've noticed that the Studio.net icon editor doesn't support icons with alpha channels, and I'm wondering if that might be related. After adding the manifest, I've opened up the program in a separate icon editor. The 32-bit format is still present in the icon, it just isn't displaying it in explorer. Also, when I run the program, in the title bar of the window, the icon DOES appear in the 32-bit format. Just not in explorer.
-
BitBlt draws transparent pieces of Image Blue!!
snarfblam replied to aewarnick's topic in Interoperation / Office Integration
http://www.rookscape.com/vbgaming/GBeebe/bitblt.php There is a tutorial (for VB6, but you should be able to figure it out for c#) on how to blit a sprite using masks. -
BitBlt draws transparent pieces of Image Blue!!
snarfblam replied to aewarnick's topic in Interoperation / Office Integration
You can use bitblt with masks, just blit the mask using the and raster op and then blit the sprite using the or raster op (unless that is the very slow alternative) -
I am learning directx, and im making a sidescroller as my first game. My program draws my level. I am just not exactly sure as to the difference between the DrawFastFlags.Wait and DrawFastFlags.DoNotWait flags. When should i use which? Also, any tips for making a side scroller for a directx newbie would be great.
-
Are there any api functions or .net framework functions or any other ways to change the main playback volume?
-
I have another question: I dont understand, in divils example, "select our bitmap in to it", or what exactly the SelectObject GDI function does. Also, in divils example, he creates a dc, draws on it, and disposes of it. I need to draw this on to a contol.
-
blitting with bitblt, again
snarfblam replied to snarfblam's topic in Interoperation / Office Integration
Oops. I know why this doesnt work. HDC's aquired from graphics objects backed by bitmaps (like my bitmap named Source) are meant to be write only. You cant copy graphics from them, or you will turn up with blackness. So I need to create a GDI compatible source DC. -
blitting with bitblt, again
snarfblam replied to snarfblam's topic in Interoperation / Office Integration
Yeah, thats me. Anyways, I always use option explicit, and all my constants are declared. I got the value of vbSrcCopy from vb6. Also, I'm an idiot. I copied the bitblt declaration for vb6 and didnt change the parameters from longs to integers. I fixed it though, and it is still behaving the same. -
blitting with bitblt, again
snarfblam replied to snarfblam's topic in Interoperation / Office Integration
Ok, dont start this. I am making up to, depending on the size of the control, up to 3200 calls to the blitting function (generally more like 480). Thats graphic intensive. There is a noticable lag when the control is initially drawn, or when the size is changed. I don't want that, and I am NOT using GDI+. In the case of many, many calls to GDI+ vs GDI, GDI wins. No question about it. I've made many applications like this in vb6 with no visible lag, and a few in .net with GDI+, ALWAYS with visible lag. And why would i mind calling GDI32.dll? And what is wrong with calling unmanaged code that is not part of .net? To me it is a big deal, i want my programs to run smoothly. Please, no one tell me not to use GDI. I want to use GDI. When GDI+ is appropriate, as in drawing only a few images, or performing skewing and stretching effects, etc., i will GLADLY use GDI+. But I want to use GDI, it does exactly what I want it to with no unwanted side effects. So PLEASE don't tell me to use GDI+ or DirectX. Pretty please? -
BitBlt draws transparent pieces of Image Blue!!
snarfblam replied to aewarnick's topic in Interoperation / Office Integration
The memory leak was fixed in Me. But i found this when looking up transparentblt on microsoft.com: Note that this is a VB6 declaration: Public Declare Function AlphaBlend _ Lib "msimg32" _ (Byval hDcDest As Long, _ Byval intLeftDest As Integer, _ Byval intTopDest As Integer, _ Byval intWidthDest As Integer, _ Byval intHeightDest As Integer, _ Byval hDcSource As Long, _ Byval intLeftSource As Integer, _ Byval intTopSource As Integer, _ Byval intWidthSource As Integer, _ Byval intHeightSource As Integer, _ Byval lngBlendFunctionStruc As Long) _ As Long I don't know if this is what aewarnick was looking for -
I am making a user control in vb.net. I am trying to use GDI, however, to handle the blitting, since GDI is faster. I am using the hdc's that i retreive from graphics objects to pass to bitblt, and bitblt return values indicate a successful blit. But after I release the hdcs and try to display the bitmap on the screen, i get nothing but blackness. It works, however with GDI+ functions. Here is the GDI+ Version Dim Source As New Bitmap("D:\Visual studio projects\console\LEDWindows.bmp") Dim GSource As Graphics = Graphics.FromImage(Source) Dim hDCSource As IntPtr Dim Persist As Bitmap Dim GPersist As Graphics Dim hDCPersist As IntPtr Private Sub NewSize() Dim i, j As Integer Persist = New Bitmap(m_ConsoleSize.Width * 12, m_ConsoleSize.Height * 20) GPersist = Graphics.FromImage(Persist) For i = 0 To m_ConsoleSize.Width - 1 For j = 0 To m_ConsoleSize.Height - 1 GPersist.DrawImage(Source, i * CharWidth, j * CharHeight, New Rectangle(0, 40, 12, 20), GraphicsUnit.Pixel) Next Next Me.BackgroundImage = Persist Me.Refresh() End Sub Here is the GDI Version Dim Source As New Bitmap("D:\Visual studio projects\console\LEDWindows.bmp") Dim GSource As Graphics = Graphics.FromImage(Source) Dim hDCSource As IntPtr Dim Persist As Bitmap Dim GPersist As Graphics Dim hDCPersist As IntPtr Private Sub NewSize() Dim i, j As Integer Persist = New Bitmap(m_ConsoleSize.Width * 12, m_ConsoleSize.Height * 20, Imaging.PixelFormat.Format24bppRgb) GPersist = Graphics.FromImage(Persist) hDCPersist = GPersist.GetHdc hDCSource = GSource.GetHdc For i = 0 To m_ConsoleSize.Width - 1 For j = 0 To m_ConsoleSize.Height - 1 BitBlt(hDCPersist, i * CharWidth, j * CharHeight, 12, 20, hDCSource, 0, 40, vbSrcCopy) Next Next GPersist.ReleaseHdc(hDCPersist) GSource.ReleaseHdc(hDCSource) Me.BackgroundImage = Persist Me.Refresh() End Sub Note that the only difference is that the GDI+ version uses drawimage() and the GDI version grabs the hdc's, uses bitblt(), then releases the hdcs, which would be the GDI equivalent, so I can't figure out why this wont work.
-
im all calmed now. i just didnt like how everyone was telling me what to do instead of how to it. after my second or third fit though everyone started to become constructive, so thanks
-
BitBlt draws transparent pieces of Image Blue!!
snarfblam replied to aewarnick's topic in Interoperation / Office Integration
Just so people know, I looked this up on microsoft.com transparentblit's memory leak was fixed in windows 98 or Me. You COULD use it, it just wouldnt be nice to people using win95. -
Are you asking how to draw it? Cause you could just use paint to draw the letters. Then you could just create a bitmap object in your app and blit them onto a dc or drawimage() them onto with a graphics object.
-
Everything is passed byval by default, even objects. When you pass an object though, you are actually passing a pointer to that object. You can pass the pointer byref or byval. Either way, it will point to the same object so that it is almost like you are passing byref either way. With byval, though, you cant change what the variable points to because you would just be changing a copy of the pointer, not the origional. If you pass by ref, you can change what the variable points to because your dealing with the origional pointer, not a copy of it. There is a difference between passing objects byref and byval, and byval is the default.
-
OK First of all, thanks divil. Second, for direct-x you need to create surfaces and other junk i dont know how to do. Functions are loaded and linked to. Its not a big deal and not alot of overhead. It is more than i want though. It is more comlplicated than i want. I dont know direct-x. I'm not learning it when its not even necessary. I dont need the extra speed, i know its fast. I dont need the extra speed. Its a simple two dimensional, relatively small picture. I know about the getdc api, what i didnt know was, for the fourth time i think, how to how to use createcompatibledc. I dont want to use vb6 for many reasons. To name a few, winxp styles support and practice using vb.net. Sorry, but thats just a stupid question. Besides that, vb.net has the same support for apis as vb, as far as i can see, besides handles to a control's dc. I have win xp and a 1.93 ghz processor with 512 megs ddr and the drawimage function, when called 88 times, is much much slower than bitblt called 88 times. Ive tried both. I know. Drawimage is slower. Drawimage is slower. Drawimage is slower. Tried and tested. Ok? Its too slow. Bitblt isnt. I want to use gdi. It blits faster. I dont want to use gdi+. When vb.net, a .net application, creates a window with a device context, even if it creates a device context through gdi+, it still creates a dc, which isnt gdi+. I would rather work with the device context directly, through the api. A graphics object is not the same as a dc, it is a different way to work with a dc. A window has a dc either way. A graphics object must be created by code during run time with gdi+ to access a dc. They are two different things. I am using gdi+ right now. Its works, but its slow. I've used gdi in the past with vb6 on much slower computer, and it was faster. And im not learning direct-x to draw a simple tile-based image. I asked a simple question and noone but divil could just answer. Ive given my reasons time after time. You are not helping me by telling me repeatedly that i should do what i do not want to do for reasons ive clearly stated. Like i said before, im not stupid, im not jumping into something new, i know what im doing. Also, gdi+ isnt replacing gdi. Gdi consists of windows api functions, gdi+ is just another interface. Gdi isnt going away, even if developers stop using it. Its not being replaced. I practically wrote and essay in an earlier post as to why i want to use gdi, and not directx or gdi+. But thanks Divil. [edit]Do not use all CAPS. My ears hurt:) [/edit]
-
What do you mean translating GDI+ into GDI? I want to use the API to blit from an offscreen bitmap to another offscreen bitmap to an onscreen DC. There is no GDI+ involved in that. None. Just API calls. Just GDI. So there is no translating involved. What do you mean 'translate' from GDI to GDI+? There is no such thing as a GDI+ device context, is there? The GDI and GDI+ don't interface with eachother. My API function calls would go completely around GDI+. Since it's windows API it would use very few recources. It is much faster than the VB.net equivalent, and uses less recources than directX. It completely avoids GDI+ and is incredibly simple compared to DirectX. A VB.net application isn't a GDI+ environment. It uses the .net framework, a GDI+ environment. That's only if you choose to use the .NET GDI+ functions. I won't be using any .net framework for this, just API. A VB.net panel or form or picturebox still has a WINDOWS device context that can be interacted with through the API. GDI+ is just meant to be an easier and more useful graphical device interface, but is NOT meant to be used for what I'm doing. My bitblt calls would use API created bitmaps, which would be GDI object, to a device context, which is a windows thing, not a GDI+ thing. Windows things are exactly what the API is for. Also, I know the declaration for BitBlt. I have the API viewer that comes with Visual Studio 6. I know how to use the API. I'm not stupid. I have some idea as to what I'm doing. I'm not jumping into some random project thats way over my head and confusing the hell out of me. All I don't know is the exact process for using windows API do what i'm trying to do. What I'm asking is NOT how to use the API, not api declarations, and not other ways to what I want to do. Again, I'm not stupid, I know what I want to do, and have reasons for wanting to do it. I don't want the overhead of directX. I don't want the slowness of the GDI+ DrawImage(). I want to use GDI alone because it is easier to blit faster. So all I am asking is how to use the windows API to create offscreen bitmaps from which i can blit to eachother and blit to a device context in a form.
-
Because I don't know directx and it is not worth learning for something so relatively trivial, and it is overkill for something so simple. It seems to me that a lot of programmers are willing to use whatever gets the job done (i.e. drawimage() or directx for my program), but I would like to use the right tool for the job, to get the best performance while using the least resources and minimizing unnecessary work.
-
I am drawing images composed of many smaller tiles (using 16px by 16px tiles, 16 tiles wide and 11 tiles high) I already know about the DrawImage() function, that is what I am using. I have the drawing algorithm down; I just want to replace the DrawImage function for the sake of speed. I would prefer to use the API function Bitblt() because it is much faster. What I have now is an image control which contains my tiles. I blit these to a panel control to draw my image. What I need to do is create an offscreen bitmap which will act as a "tile source" to which I can load a bitmap containing all of my tiles. I need to blit these tiles to a second offscreen bitmap, where I construct my image. Then I can persist my image to a panel control (or any control). I have no idea how to create the offscreen bitmaps. I know there are methods that involve the CreateCompatibleDC() API If you show me how to do this, or gimme a link to a good, not confusing, tutorial I will be happy. I like to be happy.
-
GDI+ might draw lines or text faster, i don't know. As far as raster graphics go, GDI+ is useless. The DrawImage() function is very slow compared to the GDI bitblt. I made a program that drew an image composed of 16x11 tiles, drawing it one tile at a time. With GDI the image essentially appeared in the graphics container. With GDI+ you can see the image being draw from left to right; it is much too slow. The only qualm I have with Visual Studio.net is that they intentionally make it difficult to use the Windows API when it is potentially a useful tool. I might help you Alexying, but your code is a huge and needs to be summarized, and i dont really know much about c# anyways.