the code i have that interacts with e.graphics is
'clear area
e.Graphics.FillRectangle(Brushes.Black, 0, 0, 600, 800)
'draw sand
For Each i In world
e.Graphics.FillRectangle(i.getcolor, i.getx, i.gety, 1, 1)
Next
here are the variable areas of my two classes, along with their new functions; assume that the get lines do what you think they do.
Public Class Sand
Private x As Integer
Private y As Integer
Private type As element
Public Sub New(ByVal x As Integer, ByVal y As Integer, ByVal type As element)
Me.x = x
Me.y = y
Me.type = type
End Sub
Public Class element
Public color As Color
Public weight As Integer = 1
Public spread As Double = 0.5
Public text As String = "null"
Public Sub New(ByVal c As Color, ByVal w As Integer, ByVal s As Double, ByVal t As String)
color = c
weight = w
spread = s
text = t
End Sub
here is the spot in my program that dimensions the world variable and such.
Private world As List(Of Sand)
Private paused As Boolean = False
Private openbottom As Boolean = False
Private selected As Integer = 0
Private elements As List(Of element)
'DEBUG VARIABLES
Private debugmode As Boolean = True
Private framenum As Integer = 0
and here is the area in my debug portion that makes a 4 grains of sand in 2 different elements.
elements.Add(New element(Color.Azure, 1, 1, "Test El 1"))
elements.Add(New element(Color.Aqua, 1, 1, "Test El 2"))
world.Add(New Sand(240, 400, elements(1)))
world.Add(New Sand(440, 200, elements(1)))
world.Add(New Sand(340, 100, elements(2)))
world.Add(New Sand(540, 400, elements(1)))