Starting an engine project; implementing the VBContentManager class
  • emachine74 2 years ago
    Check out the blog at xnamachine.blogspot.com

    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).
  •  
  • Sumnewdude 1 year ago
    Hello I don't know if you check this that often but Im getting this error.
    "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!
  •  
  • emachine74 1 year ago
    That error indicates that a texture called "kermit" hasn't been loaded into objCM.Textures - but it's hard to say why without seeing your project or code.

    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?
  •  
  • Sumnewdude 1 year ago
    Yes kermit.png is in my Textures folder. . . here is my code.
    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
  •  
  • emachine74 1 year ago
    XNA's Content Pipeline removes the file extensions from resources when it brings them in, so when accessing content from in the game, you'll want to drop the extension from the name; try getting "kermit" from your textures collection instead of "kermit.png".
  •  
  • Sumnewdude 1 year ago
    That dosn't work either. . . I must have missed somthing else in this video.
  •  
This conversation is missing your voice. Take five seconds to join Vimeo or log in.

Advertisement

Statistics

  •  
    plays
    likes
    comments
  • Total
    plays 512
    likes 1
    comments 7
  • Nov 8th
    plays 0
    likes 0
    comments 0
  • Nov 7th
    plays 1
    likes 0
    comments 0
  • Nov 6th
    plays 0
    likes 0
    comments 0
  • Nov 5th
    plays 0
    likes 0
    comments 0
  • Nov 4th
    plays 1
    likes 0
    comments 0
  • Nov 3rd
    plays 0
    likes 0
    comments 0
  • Nov 2nd
    plays 1
    likes 0
    comments 0
  • Nov 1st
    plays 0
    likes 0
    comments 0
Previous Week

Downloads

Please join Vimeo or log in to download the original file. It only takes a few seconds.