Loading a bitmap from a dll
BlitzPlus Forums/BlitzPlus Programming/Loading a bitmap from a dll
| ||
| I've just been messing around with Blitz+ and Qcards32.dll (something similar to ms cards.dll) I managed to get a card displayed on screen as follows .lib "Qcard32.dll" InitializeDeck% (hWnd%) DrawCard% (hWnd%, nCard%, nxLoc%, nyLoc%) ; some of the example code Global Canvas = CreateCanvas(0,0,500,500,winMain) SetBuffer CanvasBuffer(Canvas) Global t% = InitializeDeck (QueryObject(Canvas,1)) ....... Cls DrawCard (QueryObject(Canvas,1),6,200,y) FlipCanvas Canvas Using this code the card displays but very flickery if I set the value to (QueryObject(winMain,1),6,200,200) it displays in the window. I'm just wondering how blitz handles images loaded through a function in a dll, is the card being drawn within a canvas or something ? |
| ||
| I'm not sure, but I don't think that this actually draws the card onto the canvas's buffer. You can test this out by doing a SaveBuffer() on your canvas after drawing the card, using DrawCard(). I really have no idea what Qcard32.dll is, but it's probably just using it's own drawing function, not DirectX like Blitz does. Then again I might be wrong, but I don't have any way to test it, because I don't have that Dll anywhere on my system. If it is actually drawing onto the buffer, then I don't know whats wrong with it, without seeing more of the code. |
| ||
| Hi Todd Just tried savebuffer but the card does not appear but a normal image that i displayed in the canvas does. THe Qcard32.dll is similar to the microsoft cards.dll Here is the test app
; Card test
Global winMain = CreateWindow("Card Test",100,100,500,500,0,13)
Global Canvas = CreateCanvas(0,0,500,500,winMain)
Global img = LoadImage("image.png")
SetBuffer CanvasBuffer(Canvas)
; create the timer
Global timer = CreateTimer(60)
Global timerframes
Global t% = InitializeDeck (QueryObject(Canvas,1))
If t = 0 Then
Notify("Could not initialize qcards32.dll. Result: " + t%)
EndIf
; main loop
Repeat
WaitEvent()
Select EventID()
Case $803
End
Case $4001 ; Timer tick
totalticks = EventData() ; get the total amount of ticks
; that the timer has passed
For tck = timerframes To totalticks
timeframes=timerframes+1
Next
draw()
End Select
Forever
; draw graphics to screen
Function draw()
Cls
DrawCard (QueryObject(Canvas,1),6,200,y)
DrawImage(img,100,200)
FlipCanvas Canvas
End Function
the decls file contains .lib "Qcard32.dll" InitializeDeck% (hWnd%) DrawCard% (hWnd%, nCard%, nxLoc%, nyLoc%) the functions are described in the docs as: BOOL InitializeDeck(hWnd) DrawCard (hWnd, nCard, nxLoc, nyLoc) THe dll is here http://www.telusplanet.net/public/stevem/ Thanks for your help |
| ||
| The dll's don't seem to use DirectX. I can draw them straight to a window ok, but doing anything with them like moving a card or deleting a card works but I somehow need to get the window to refresh to show the change. I can't see any command for this though okee |
| ||
| It's not going to work... or rather it's not going to work well. You have basically two programs fighting for the same screen-space. Just create your own card images and use those. Kanati |
| ||
| Or just code it in C+ or VB :P |