-
OK its me again guess what the thing WORKS it loads fast!!! OK but the code is to load a pic right its a special format (OMF sprite format) and so it loads it and plots it. The problem is it plots really really slowly (and its not cuz of the autoredraw property.) Ok so a friend suggested I tell it to remember the HDC so i'm not calling it again every time, so its not having to find the HDC by UserControl.hDC every time. But the problem is ok I define a variable, but no matter what I do it doesn't work. I say Msgbox UserControl.hDC, then Dim theDC as {itdoesntmatter}, then say theDC = UserControl.hDC, then say msgbox theDC and it gives me the same thing as the first message box. Works right? Wrong. When you call the SetPixelV with theDC instead of UserControl.hDC, it goes by without any error message at all but it just doesn't plot the darn point. Well if you know of how to do this, or if this is not at all the reason why it plots slow, tell me please!!!
-
Well nuts. Well here is the line that plots it:
Code:
For arcnt = 0 To PicEnd
If PicX(arcnt) > -1 And PicY(arcnt) > -1 Then
SetPixelV UserControl.hdc, PicX(arcnt), PicY(arcnt), Pal(PicClr(arcnt))
End If
Next
Hey maybe if I make it check if its offscreen as it loads it instead...
-
Cool, it highlights keywords in blue...
Nah, no difference. I made it check if it was offscreen as it loads it and if it was it just skips the whole putting-in-array and finding-color thing. I'm surprised it didn't make a difference. Oh well.
-
How come no one knows this?
-
-
Is this some joke everyone is playing against me? 27 people viewed this at least 1 of you can say "I don't know" right???
-
I don't know!
Vuen, How do I make those blue things? And that's not the important one, cuz I need those indentions.
-
K thanks phew
just stick (code) and (/code) between your code but the () being the square ones. It will preserve your formatting, so you can paste VB code directly. It does the highlighting by itself.
-
:) That helped me alot. Thanks! :)
-
-
Doesn't anyone know this?
-
Vuen, if I am not mistaken (though it is the case with hwnd so I suppose it's the same with hdc), hwnd is never constant, it changes the whole time thus you can never remember the hwnd as you will never be 100% sure that you will get the same hwnd every time. This might be the same for the hdc.
I hope this helped.
P.S. graphic routines (espetially big images) can be very slow. Because of this, game company's prefer to code theyre graphic routines in assembler which is inherently faster. I don't know much of it but you could try using direct-x or direct draw.
Good luck!
-
Yeah, I've been d/ling DirectX documentation on and off, but it IS 120 megs you know. If you can just pull me the part about setting individual pixels to a window using directdraw that would be great. And also I believe the hDC is set when the ctl is loaded and stays constant until unloaded.
-
I would if I could but seeing as I most probably know less of direct-x then you, you would be a better judge of what you need then me. That and the fact that my bandwidth is but poor and e-mailing a 120 meg file won't be considered smart as it would take the same time for your e-mail (maybe less) to downlad as downloading it from the site.
Sorry I couldn't help you with that.
-
This is what I found in the MSDN library. Maybe it is usefull:
If the HasDC property is set to False, a new device context will be created by the system and the value of the hDC property will change each time it is called.
-
Yeah but I need to log the hDC so when SetPixelV runs it does not have to recall the hDC from windows every time it runs, I think that's what is slowing it down.