[RESOLVED] [2005] DirectX Problem
Hi guys, I've got an array of blocks which contains the left, top, right and bottom positions of the blocks.
I need to draw the blocks using DirectX when everything else like the healthbar and lives get drawn...
When I put this to draw the first block it's fine:
Code:
ssurface.FillStyle = 0
ssurface.FillColor = blocks(0).getFill
ssurface.ForeColor = blocks(0).getBorder
ssurface.DrawBox(blocks(0).blockRectangle.X, blocks(0).blockRectangle.Y, blocks(0).blockRectangle.Right, blocks(0).blockRectangle.Bottom)
But when I put this it just sits there and locks up!
Code:
For i As Integer = 0 To blocks.Length - 1
ssurface.FillStyle = 0
ssurface.FillColor = blocks(0).getFill
ssurface.ForeColor = blocks(0).getBorder
ssurface.DrawBox(blocks(0).blockRectangle.X, blocks(0).blockRectangle.Y, blocks(0).blockRectangle.Right, blocks(0).blockRectangle.Bottom)
Next
What's happening and what should I do?
Thanks in advance, knxrb.
Re: [2005] DirectX Problem
Hey guys, I've been fiddling with it and I've solved my problem :)
For anyone who ever has the same problem:
I put the blocks draw code into it's own sub like this:
Code:
Public Sub drawblocks()
For Each b As Block In blocks
ssurface.FillStyle = 0
ssurface.FillColor = b.getFill
ssurface.ForeColor = b.getBorder
ssurface.DrawBox(b.blockRectangle.X, b.blockRectangle.Y, b.blockRectangle.Right, b.blockRectangle.Bottom)
Next
End Sub
Then in the sub I use to draw everything I just called the sub like this and it works fine:
Code:
Try
drawBlocks()
Catch ex As Exception : End Try
Hope it helps someone, knxrb :D