Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[DX8] Drawing faces on a picturebox


erkro1
 Share

Recommended Posts

I am trying to draw the faces on a picturebox (for the multiple characters system), but for some reason it only displays it for a very short time (less than half a second) and then it disappears.

Code:

```
Sub BltCharFaces()

Dim sRect As RECT, dRect As RECT, FaceNum As Long, srcRect As D3DRECT, destRect As D3DRECT

Dim i As Byte

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

If NumFaces = 0 Then Exit Sub

Direct3D_Device.Clear 0, ByVal 0, D3DCLEAR_TARGET, D3DColorRGBA(0, 0, 0, 0), 1#, 0

Direct3D_Device.BeginScene

For i = 1 To MAX_PLAYER_CHARACTERS

FaceNum = CharData(i).Sprite

If FaceNum > 0 Or FaceNum <= NumFaces Then

sRect.Top = 0

sRect.Bottom = sRect.Top + 100

sRect.Left = 0

sRect.Right = sRect.Left + 100

dRect.Top = CharTop

dRect.Bottom = CharTop + 100

dRect.Left = CharOffSetX + (CharOffSetX * (i - 1)) + 100 * (i - 1)

dRect.Right = dRect.Left + 100

RenderTextureByRects Tex_Face(FaceNum), sRect, dRect

End If

Next

With srcRect

.x1 = 0

.x2 = frmMenu.picFaces.Width

.y1 = 0

.y2 = frmMenu.picFaces.Height

End With

With destRect

.x1 = 0

.x2 = frmMenu.picFaces.Width

.y1 = 0

.y2 = frmMenu.picFaces.Height

End With

Direct3D_Device.EndScene

Direct3D_Device.Present srcRect, destRect, frmMenu.picFaces.hwnd, ByVal (0)

' Error handler

Exit Sub

errorhandler:

HandleError "BltCharFace", "modGraphics", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub
```
Link to comment
Share on other sites

Nope, but thats because this is in frmMenu, and then the ServerLoop isn't activated yet.

EDIT: I'll try adding the rendering in a timer tomorrow. ![;)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/wink.png)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...