2
mai
2009
Isométrie en VB net
mai
2009
Un article de ogotcha
Pas de commentaires
Voici une bref explication pour réussir à faire de l’isométrie en VB.Net
La théorie :
La pratique :
Private function DrawIso() as bitmap
Dim g As Graphics
Dim Img As Bitmap
Img = New Bitmap(400, 400)
g = Graphics.FromImage(mapping)
'Initialisation du nombre de case
Dim NbrX, NbrY As Integer
NbrX = 10
NbrY = 10
Dim X, Y As Integer
X = 0
Y = 0
While Y < NbrY
While X < NbrX
Dim Img As Image = application.startuppath & "/sol.jpg"
'Coordonée pour le passage en 2D iso
Dim dec As Integer = NbrY * Img.Height / 2
Dim OrigX As Integer = (X - Y) * Img.Height / 2 + dec
Dim OrigY As Integer = (Y + X) * Img.Height / 4
'Application ratio 2/1
Dim ImgH As Integer = Truncate(Img.Height / 2)
Dim ImgL As Integer = Truncate(Img.Width) '* 2)
g.DrawImage(rotation(Img, -45), OrigX, OrigY, ImgL, ImgH)
X += 1
End While
Y += 1
X = 0
End While
Return Img
End Sub
Dim g As Graphics
Dim Img As Bitmap
Img = New Bitmap(400, 400)
g = Graphics.FromImage(mapping)
'Initialisation du nombre de case
Dim NbrX, NbrY As Integer
NbrX = 10
NbrY = 10
Dim X, Y As Integer
X = 0
Y = 0
While Y < NbrY
While X < NbrX
Dim Img As Image = application.startuppath & "/sol.jpg"
'Coordonée pour le passage en 2D iso
Dim dec As Integer = NbrY * Img.Height / 2
Dim OrigX As Integer = (X - Y) * Img.Height / 2 + dec
Dim OrigY As Integer = (Y + X) * Img.Height / 4
'Application ratio 2/1
Dim ImgH As Integer = Truncate(Img.Height / 2)
Dim ImgL As Integer = Truncate(Img.Width) '* 2)
g.DrawImage(rotation(Img, -45), OrigX, OrigY, ImgL, ImgH)
X += 1
End While
Y += 1
X = 0
End While
Return Img
End Sub
(Page suivante : Suite du code)