PDA

Click to See Complete Forum and Search --> :    HeLp!!!!!!


ille_pugil
Jun 1st, 2000, 09:27 PM
Opportunity's knocking for those who are interested. Our group is in the process of making a game. We are still in the design phase where the programming is just starting. Come on in at the ground level. Please reply to this message with experience, (not just 'I'm a good programmer', but whatever projects, training, or whatnot). If you could also post a small snippet of code so I can see your coding style. Thanks in advance.

-Pugil

Reaper101
Jun 2nd, 2000, 08:16 AM
Hi,

I would be very happy to help you in this project if you like. Below is a code snippet from a program called Picture Scroller that I made, that you can download at ZD-Net. This code draws a picture in a snake-like fashion around the screen (btw - this snippet uses BitBlt, but it originally used DirectDraw):

Just put a Picture Box on the form called picSrc. Then set picSrc's and the Form's AutoRedraw to True, and their ScaleMode to Pixel. Then place a picture in picSrc. After that place this in the Declarations Section:

---------------------------

Option Explicit

Dim iNewSizeW As Integer
Dim iNewSizeH As Integer

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
Private Const SRCCOPY = &HCC0020
Public Sub VerticalSnakeDrawing()

Dim iSize As Integer
Dim iEndX As Integer
Dim iPlace As Integer
Dim bUp As Boolean
Dim iPositionX As Integer
Dim iPositionY As Integer
Dim nIndex As Integer
Dim iTimes As Integer

iSize = iNewSizeW \ 15

iEndX = iPositionX + iSize

Do
If iPositionX + iSize > iNewSizeW Then
BitBlt Me.hDC, iPositionX, iPositionY, iNewSizeW - iPositionX, iSize, picSrc.hDC, iPositionX, iPositionY, SRCCOPY
Else
BitBlt Me.hDC, iPositionX, iPositionY, iSize, iSize, picSrc.hDC, iPositionX, iPositionY, SRCCOPY
End If

If nIndex = 15 And iPositionY = 0 And bUp = True Then
BitBlt Me.hDC, 0, 0, iNewSizeW, iNewSizeH, picSrc.hDC, 0, 0, SRCCOPY
Exit Do
End If

DoEvents

If iPlace = 0 Then
If iPositionY < iNewSizeH - iSize Then
iPositionY = iPositionY + 1
Else
iPlace = 1
End If
ElseIf iPlace = 1 Then
If iPositionX < iEndX Then
iPositionX = iPositionX + 1
Else
If bUp = False Then
bUp = True
iPlace = 2
Else
bUp = False
iPlace = 0
End If

nIndex = nIndex + 1
iEndX = iEndX + iSize
End If
Else
If iPositionY > 0 Then
iPositionY = iPositionY - 1
Else
iPlace = 1
End If
End If

Me.Refresh
Loop

End Sub
Private Sub Form_Load()

iNewSizeW = picSrc.Width
iNewSizeH = picSrc.Height
Me.Show
VerticalSnakeDrawing

End Sub

---------------------------

Also, I am not familiar with D3D, although I do know some DirectDraw and DirectSound... and of course BitBlt. I hope I can help you.

Reaper