Supermatthew
New member
Im having a problem.
the image on the left below is the result after rendering, and the image on the right is the image in the file.
The one with the box is the one its suppost to draw, but you can see, its drawing from the bottom left row. Theres a missing pixle thats yellow on the edge, that i somehow cut off..
i enlarged it because its easier to see whats going on:
the image sprites.bmp is basicly 12 images of a char, 3 in each direction, each char is 32x64
i have tryed modifying every variable there, settings, and other stuff. I tryed looking online. Some of it come from tutorials, but i ended up writing most of it.
Can someone tell me whats wrong with the code(with comments removed:
the image on the left below is the result after rendering, and the image on the right is the image in the file.
The one with the box is the one its suppost to draw, but you can see, its drawing from the bottom left row. Theres a missing pixle thats yellow on the edge, that i somehow cut off..
i enlarged it because its easier to see whats going on:
the image sprites.bmp is basicly 12 images of a char, 3 in each direction, each char is 32x64
i have tryed modifying every variable there, settings, and other stuff. I tryed looking online. Some of it come from tutorials, but i ended up writing most of it.
Can someone tell me whats wrong with the code(with comments removed:
VB.NET:
Sub MainLoop()
Dim dddevice As Device = Nothing
Dim DrawinTexture As Texture
Dim ColorKeyVal As Color
Dim Drawin As Sprite
Dim D3Dpp As PresentParameters = Nothing
Dim DP As DisplayMode = Nothing
DP = Manager.Adapters.Default.CurrentDisplayMode
D3Dpp = New PresentParameters
D3Dpp.BackBufferFormat = DP.Format
D3Dpp.BackBufferWidth = PictureBox1.Width
D3Dpp.BackBufferHeight = PictureBox1.Height
D3Dpp.SwapEffect = SwapEffect.Discard
D3Dpp.PresentationInterval = PresentInterval.Immediate
D3Dpp.Windowed = True
Drawin = New Sprite(dddevice)
dddevice = New Device(Manager.Adapters.Default.Adapter, DeviceType.Hardware, PictureBox1.Handle, CreateFlags.SoftwareVertexProcessing, D3Dpp)
Drawin = New Direct3D.Sprite(dddevice)
ColorKeyVal = Color.Black 'black
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''Load from file
DrawinTexture = TextureLoader.FromFile(dddevice, Application.StartupPath & "\Data\Gfx\sprites.bmp", 0, 0, D3DX.Default, Usage.None, Format.Unknown, Pool.Default, Filter.Point, Filter.Point, 0) ' ColorKeyVal.ToArgb)
dddevice.RenderState.Lighting = False
Me.Show()
Do While Not Quit
dddevice.Clear(ClearFlags.Target, Color.FromArgb(0, 0, 255), 0, 0)
dddevice.BeginScene()
Drawin.Begin(SpriteFlags.None)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''' Next line is the one used to draw.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Drawin.Draw2D(DrawinTexture, New Rectangle(0, 128, 32, 64), New SizeF(32, 64), New Point(20, 20), Color.White)
Drawin.End()
dddevice.EndScene()
dddevice.Present()
Application.DoEvents()
Threading.Thread.Sleep(50)
Loop
On Error Resume Next
dddevice.Dispose()
dddevice = Nothing
Drawin.Dispose()
Drawin = Nothing
Application.Exit()
System.Environment.Exit(System.Environment.ExitCode)