Mirage Engine
Practicing DirectX - Printable Version

+- Mirage Engine (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17)
+---- Thread: Practicing DirectX (/showthread.php?tid=1850)



Practicing DirectX - jsventor - 22-06-2008

Code:
Sub DisplaySpellIcons()
' Icons
        Dim M As Long
        Dim Mm As Long
        Dim TI As Long
        Dim sDc As Long
              
        If GetTickCount > TI + 500 Then
            For M = 0 To MAX_PLAYER_SPELLS - 1
                Mm = Player(MyIndex).Spell(M + 1)
    With rec
        .top = Spell(Mm).Pic * PIC_Y
        .Bottom = .top + PIC_Y
        .Left = 0
        .Right = .Left + PIC_X
    End With
  
    With rec_pos
        .top = 0
        .Bottom = PIC_Y
        .Left = 0
        .Right = PIC_X
    End With

    DD_SpellIconSurf.BltToDC frmMirage.picSpell(M).hDC, rec, rec_pos
    frmMirage.picSpell(M).Refresh
    'Call BitBlt(frmMirage.picSpell(M).hDC, 0, 0, PIC_X, PIC_Y, frmMirage.picSpellIcons.hDC, (Spell(Mm).Pic - Int(Spell(Mm).Pic / 6) * 6) * PIC_X, Int(Spell(Mm).Pic / 6) * PIC_Y, SRCCOPY)
            Next M
        End If
End Sub

It originally used BitBlt, and Im making it use BltToDc instead because I heard it was better, and I successfully did it with something else, but with this I am getting an RTE 9 on this line..

Code:
.top = Spell(Mm).Pic * PIC_Y

Any ideas?


Re: Practicing DirectX - Robin - 22-06-2008

Remove the timer. BltToDC only requires you to do it once.

That's why it's better than BitBlt.


Re: Practicing DirectX - jsventor - 22-06-2008

Robin Wrote:Remove the timer. BltToDC only requires you to do it once.

That's why it's better than BitBlt.


Ahh ok gotcha Tongue

And there is no timer, that's a separate sub that's Called in the Game Loop, Its just that one line giving me problems for some reason >.>


Re: Practicing DirectX - GIAKEN - 22-06-2008

Add a check to make sure that mm isn't over the max inventory (24?) or under 0 (or 1?).


Re: Practicing DirectX - jsventor - 22-06-2008

Well if in mod types, spells are
Code:
Public Spell(1 To MAX_SPELLS) As SpellRec

Then why is this..
Code:
0 To MAX_PLAYER_SPELLS - 1