Hi guys. So as some of you know, I’m redesigning the interface in Skywyre v10 and going back to the traditional Picturebox on an interface design like in Eclipse. SkyWyre made the change to drawing to a full screen on frmMain, and my project specifically requires me to revert back. However, I don’t want to go back to DirectX7, using an earlier engine.
Currently, I’m attempting to move everything from the main game screen (Which is now frmMain.picGame), to picture boxes on the interface.
Currently, I’m trying to draw the hotbar items/spells but I’m getting that infamous “Unrecoverable DX8 Error”.
This is my procedure, and I know it’s wrong but I tried my best attempt at it. If anybody could correct my code that’d be great, as I can then use it as a template for moving everything else.
Code:
Public Sub DrawSkillbar()
Dim I As Long, x As Long, y As Long, t As Long, sS As String
Direct3D_Device.Clear 0, ByVal 0, D3DCLEAR_TARGET, D3DColorRGBA(0, 0, 0, 0), 1#, 0
Direct3D_Device.BeginScene
x = 0
y = 0
For I = 1 To MAX_HOTBAR
' draw the icon
Select Case Hotbar(I).sType
Case 1 ' inventory
If Len(Item(Hotbar(I).Slot).name) > 0 Then
If Item(Hotbar(I).Slot).Pic > 0 Then
'EngineRenderRectangle Tex_Item(Item(Hotbar(i).Slot).Pic), x + 2, y + 2, 0, 0, 32, 32, 32, 32, 32, 32
RenderTexture Tex_Item(Item(Hotbar(I).Slot).Pic), 5 + x, 5 + y, 0, 0, 30, 30, 30, 30, D3DColorARGB(255 - Item(Hotbar(I).Slot).a, 255 - Item(Hotbar(I).Slot).R, 255 - Item(Hotbar(I).Slot).G, 255 - Item(Hotbar(I).Slot).B)
End If
End If
Case 2 ' spell
If Len(Spell(Hotbar(I).Slot).name) > 0 Then
If Spell(Hotbar(I).Slot).Icon > 0 Then
' render normal icon
'EngineRenderRectangle Tex_Spellicon(Spell(Hotbar(i).Slot).Icon), x + 2, y + 2, 0, 0, 32, 32, 32, 32, 32, 32
RenderTexture Tex_SpellIcon(Spell(Hotbar(I).Slot).Icon), 5 + x, 5 + y, 0, 0, 30, 30, 30, 30
' we got the spell?
For t = 1 To MAX_PLAYER_SPELLS
If PlayerSpells(t).Spell > 0 Then
If PlayerSpells(t).Spell = Hotbar(I).Slot Then
If SpellCD(t) > 0 Then
'EngineRenderRectangle Tex_Spellicon(Spell(Hotbar(i).Slot).Icon), x + 2, y + 2, 0, 0, 32, 32, 32, 32, 32, 32, , , , , , , 254, 190, 190, 190
RenderTexture Tex_SpellIcon(Spell(Hotbar(I).Slot).Icon), 5 + x, 5 + y, 0, 0, 30, 30, 30, 30, D3DColorARGB(255, 100, 100, 100)
End If
End If
End If
Next
End If
End If
End Select
' draw the numbers
sS = str(I)
If I = 10 Then sS = "0"
If I = 11 Then sS = " -"
If I = 12 Then sS = " ="
RenderText Font_Default, sS, 5 + x + 8, 5 + y + 28, White
x = x + 40
If x >= 120 Then
x = 0
y = y + 40
End If
Next
Direct3D_Device.EndScene
Direct3D_Device.Present ByVal 0, ByVal 0, frmMain.picSkillbar.hwnd, ByVal (0)
' Error handler
Exit Sub
errorhandler:
HandleError "DrawSkillbar", "modGraphics", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub