Mirage Engine
BLTing Onto Screen - Printable Version

+- Mirage Engine (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49)
+---- Thread: BLTing Onto Screen (/showthread.php?tid=54)



BLTing Onto Screen - Tutorial Bot - 01-06-2006

Author: William
Difficulty: 3/5

To blt things onto the picScreen you can use:
Code:
Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Which is easier to use in my opinion, but then you need to load a tileset to into a picture control. Here you have a example:
Code:
BitBlt frmMirage.picScreen.hdc, picx, picy, 32, 32, frmMirage.PictureControl.hdc, tempx, tempy, vbSrcCopy
That's basically a copy paste from my single player engine, just changed some names on it. But the easiest thing to understand BitBlt is to study the Function.
You can also use:
Code:
Public Declare Function TransparentBlt Lib "msimg32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal crTransparent As Long) As Boolean
To blt transparent tiles, ex:
Code:
Call TransparentBlt(frmMirage.picScreen.hdc, picx, picy, 32, 32, frmMirage.PictureControl.hdc, tempx, tempy, 32, 32, RGB(0, 0, 0))

Another way is to use the image control, put it on the screen make it visible = false. Then on the top in the coding part add:
Code:
Dim NewElement As Integer
And in form_load put this:
Code:
NewElement = 1
And then to use it, use this code to load it:
Code:
Load Image1(NewElement)
Image1(NewElement).Visible = True
And to move it around use this:
Code:
Image1(NewElement).Top = Image1(NewElement).Top + 50
or:
Code:
Image1(NewElement).Left = Image1(NewElement).Left + 50