
VB.NET XNA Tutorial 4: Starting an engine
2 years ago
Starting an engine project; implementing the VBContentManager class
-
Vimeo: About / Blog / Developers / Jobs / Community Guidelines / Community Forums / Help Center / Site Map / Merchandise
/ Get Vimeo

Previous Week
The source for both VBContentManager and Hashtable(Of Type) are posted in the article for Tutorial 4. I recently posted an updated version of the VBContentManager for use with XNA (Game Studio) 2.0 (beta).
"This method does not accept null for this parameter. Parameter name: texture" at line "Me.objSB.Draw(Me.objCM.Textures("kermit"), Vector2.Zero, Color.White)" Thanks for your help!
The error is coming from SpriteBatch, it's yelling at you for trying to draw a sprite but without a texture. If "kermit" does not really exist in objCM.Textures, Nothing will be the result of trying to get "kermit" out of the Textures collection. Do you have a graphics file called kermit in your Content\Textures folder?
Public Class XNAGame
Inherits Mybasegame
Public Sub New()
MyBase.new("XNA Game", True, "C:\Users\WeldFire\Documents\Visual Studio 2008\Projects\XNA Game\XNA Game\Content")
End Sub
Protected Overrides Sub draw(ByVal gametime As Microsoft.Xna.Framework.GameTime)
MyBase.Draw(gametime)
Me.objGDM.GraphicsDevice.Clear(Color.Black)
Me.objSB.Begin(SpriteBlendMode.AlphaBlend)
Me.objSB.Draw(Me.objCM.Textures("kermit.png"), New Vector2(100, 100), Color.White)
Me.objSB.End()
End Sub
End Class