Mirage Source http://www.miragesource.net/forums/ |
|
BLTing Onto Screen http://www.miragesource.net/forums/viewtopic.php?f=210&t=65 |
Page 1 of 1 |
Author: | Tutorial Bot [ Thu Jun 01, 2006 9:52 pm ] |
Post subject: | BLTing Onto Screen |
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
|
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |