home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Planet Source Code Jumbo …e CD Visual Basic 1 to 7
/
3_2004-2005.ISO
/
Data
/
Zips
/
Killer_Sno18221211272004.psc
/
Module1.bas
< prev
Wrap
BASIC Source File
|
2004-11-26
|
2KB
|
34 lines
Attribute VB_Name = "Module1"
'These 2 api calls do the same job as 'Point' and 'PSet'
'But they do it a lot faster
Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long) As Long
'Only problem with setpixel, is you can only draw a single pixel, where
'with PSet you can set the draw width to be any size you wish.
'You can get around this by using SetPixel to draw 4 or more pixels in a tiny circle
'But this means you have to draw (4 * 'number of flakes') each cycle of the loop
'which would be slower than using PSet. doh!
'This function isnt actually being used in the program, but I thought I would include
'it as it may be of use to someone.
Declare Function SetPixel Lib "gdi32" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long
'A simple snow structure
'Could you a class instead if you want, doesnt make a lot of difference.
Type Snow
x As Long 'Current X Coordinates
y As Long 'Current Y Coordinates
oldX As Long 'Old X Coordinates
oldY As Long 'Old Y Coordinates
xSpeed As Long 'Horizontal Speed
ySpeed As Long 'Vertical Speed
FlakeSize As Long 'Size of flake
End Type
Public Flakes() As Snow 'Create an array of type 'Snow', this will be ReDimmed during 'Setup'
'Global Variables for our snow
Public mLeftWind As Long 'Stores the 'wind' factor
Public mRightWind As Long ' ' ' ' ' ' '
Public mSnowColor As Long 'Colour of the snow flakes
Public mFlakeNum As Long 'How many snow flakes are we having
Public mfrmMainHDC As Long 'The hDC of frmMain. This is the form's handle
Public mtStopSnow As BoolwisCsa u