Results 1 to 2 of 2

Thread: [RESOLVED] [2005] DirectX Problem

  1. #1

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    Resolved [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.
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  2. #2

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    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
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width