Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Optimizing Graphic Input? (Completed)
#4
So here I have some work I've done. It's not yet complete so Ill submit the finish code later. So you guys can decide if it has been optimized:
Completed!
Replace this:
Code:
For y = 0 To MAX_MAPY
                For x = 0 To MAX_MAPX
                    Call BltTile(x, y)
                Next x
            Next y
With this:
Code:
' Blit out tiles layers ground/anim1/anim2
        If InEditor Then
            For y = 0 To MAX_MAPY
                For x = 0 To MAX_MAPX
                    Call BltTile(x, y)
                Next x
            Next y
        Else
            yChange1 = 2
            yChange2 = 2
            xChange1 = 2
            xChange2 = 2
            
            If GetPlayerY(MyIndex) - 2 < 0 Then yChange1 = 1
            If GetPlayerY(MyIndex) + 2 > MAX_MAPY Then yChange2 = 1
            If GetPlayerX(MyIndex) - 2 < 1 Then xChange1 = 1
            If GetPlayerX(MyIndex) + 2 > MAX_MAPX Then xChange2 = 1
            
            If GetPlayerY(MyIndex) - 1 < 0 Then yChange1 = 0
            If GetPlayerY(MyIndex) + 1 > MAX_MAPY Then yChange2 = 0
            If GetPlayerX(MyIndex) - 1 < 0 Then xChange1 = 0
            If GetPlayerX(MyIndex) + 1 > MAX_MAPX Then xChange2 = 0
            
            For y = GetPlayerY(MyIndex) - yChange1 To GetPlayerY(MyIndex) + yChange2
                For x = GetPlayerX(MyIndex) - xChange1 To GetPlayerX(MyIndex) + xChange2
                   Call BltTile(x, y)
                Next x
            Next y
        End If

Also add this at the top of the Sub:
Code:
Dim xChange1 As Byte, xChange2 As Byte, yChange1 As Byte, yChange2 As Byte
Now will this speed it up?

Also this has to be done for the fringe too.. And also a system that blts over the text area. I can do all those, I just need to know if this will speed anything up first.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)