|
-
Feb 14th, 2000, 12:09 PM
#1
Thread Starter
Addicted Member
Heres Some Math I have done for the sakes of Vb Programming 
1.Reverse Y BltBliting(Graphic Stuff)
The set up a 300 Pixel height form.
Problem Im making a program where down is the
bottom of the form not top.
Solution: y = ( y - 300) * - 1 ' This will flip the y to a lower point,
Uses on Mouse clicking coresponting.
2. Blt Bliting My Module
Here is part of a module i made that is reuseable. It uses Form1 as a canvas. It uses pictures Named IMG(1),Img(2) as a source.
'' Note I used this to make Games like Chips Adventures so it uses a Block Format of 30X30
'''''''''''''''''''''''
Private 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
'NOTE THIS FILE CAN BE USED WITH OTHER PROGRAMS IF THE NEXT LINE IS INCLUDED
'Written By M-Gate Labs,[email protected]
'Thank You for Choosing this simple render method 
' uses a Picture where there is a whit back ground and what is not goint to show through is white
Public Sub RENDEROBJECTAND(OBJECTNUMBER As Integer, x As Long, Y As Long)
Y = (Y - 300) * -1
BitBlt Form1.hDC, x, Y, Form2!img(OBJECTNUMBER).ScaleWidth, Form2!img(OBJECTNUMBER).ScaleHeight, Form2!img(OBJECTNUMBER).hDC, 0, 0, vbSrcAnd
End Sub
'Uses a Image with a black Background
Public Sub RENDEROBJECTPAINT(OBJECTNUMBER As Integer, x As Long, Y As Long)
Y = (Y - 300) * -1
BitBlt Form1.hDC, x, Y, Form2!img(OBJECTNUMBER).ScaleWidth, Form2!img(OBJECTNUMBER).ScaleHeight, Form2!img(OBJECTNUMBER).hDC, 0, 0, vbSrcPaint
End Sub
Public Sub RENDEROBJECTCOPY(OBJECTNUMBER As Integer, x As Long, Y As Long)
Y = (Y - 300) * -1
BitBlt Form1.hDC, x, Y, Form2!img(OBJECTNUMBER).ScaleWidth, Form2!img(OBJECTNUMBER).ScaleHeight, Form2!img(OBJECTNUMBER).hDC, 0, 0, vbSrcCopy
End Sub
''''''''''''''''''''''
3. Playing Sound' Not Plural Only 1 at a time. 
'note this was used im a module and had a special way of accessing the files.
'''''''''''''''
Declare Function sndPlaySound Lib "winmm" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Public Const SND_ASYNC = &H1
Dim FILELOCATION As String
Public Sub PLAYSOUND(FILENAME As Integer)
If FILENAME = 1 Then
FILELOCATION = App.Path + "\sounds" + "\chimes.wav"
End If
If FILENAME = 2 Then
FILELOCATION = App.Path + "\sounds" + "\yes.wav"
End If
If FILENAME = 3 Then
FILELOCATION = App.Path + "\sounds" + "\NO.wav"
End If
If FILENAME = 4 Then
FILELOCATION = App.Path + "\sounds"
+ "\default.wav"
End If
Call sndPlaySound(ByVal FILELOCATION, SND_ASYNC)
End If
End Sub
''''''''''''''''''''
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|