Attribute VB_Name = "modTiles"
Option Explicit



Public Sub LoadRutaIconosEsquemaTdo(PFile As FileListBox)
Dim strRuta As String
Dim strFolder As String
Dim strfile As String
Dim i As Integer
Dim tam As Integer
Dim limX As Integer
Dim posx As Integer
Dim posy As Integer
Dim icon As Integer

    Call IniciarRutaPicGame

    PFile.Path = mObjEscenasVarias.objPics.rutaDir
    'File1.Path = strfilePics
    tam = PFile.ListCount
    strFolder = mObjEscenasVarias.objPics.rutaDir
        
    limX = frmRpgEditor.picIconosTodos.ScaleWidth
    
    icon = 1
    
    Call DescargaIconos
    
    For i = 0 To tam - 1
        PFile.ListIndex = i
        strfile = PFile.FileName
        strRuta = strFolder & strfile
        posx = icon * 32
        If posx + 32 > limX Then
            posx = 0
            posy = posy + 32
            icon = 1
        Else
            icon = icon + 1
        End If
        
        Call LoadPicAutoRun(i, strRuta, posx, posy, Replace(strfile, ".bmp", ""))
        'frmEditorGamev3.picsTiles,
    Next

    frmRpgEditor.picIconosTodos.Height = frmRpgEditor.picsTiles(frmRpgEditor.picsTiles.Count - 1).Top + 32
    
End Sub

Public Sub LoadPicAutoRun(Pindex As Integer, PstrFile As String, posx As Integer, posy As Integer, pstrName As String)
Dim i As Integer
    
    i = Pindex
    If i > 0 Then
        Load frmRpgEditor.picsTiles(i)
    End If
    
    With frmRpgEditor.picsTiles(i)
        .Picture = LoadPicture(PstrFile)
        .Left = posx
        'Debug.Print frmEditorGamev3.picsTiles(i - 1).Height
        .Top = posy
        .Visible = True
        .AutoRedraw = True
        .AutoSize = True
        .Tag = pstrName
    End With
    'End If
End Sub


Public Sub DescargaIconos()
Dim i As Integer
Dim tam As Integer

    tam = frmRpgEditor.picsTiles.Count
    
    For i = tam - 1 To 1 Step -1
        Unload frmRpgEditor.picsTiles(i)
    Next
End Sub


