public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch) { if (_IsVisible) { ICutlassTexture texture = TextureManager.GetTexture(_SceneryObject_Id); spriteBatch.Draw(texture.BaseTexture, CurrentFrameBoundingRect.Min, texture.AreaToRender, Color.White); } }
/// <summary> /// Get a Texture2D /// </summary> /// <param name="textureName"></param> /// <returns></returns> public static Texture2D GetTexture2D(TexId textureId) { ICutlassTexture texture = GetTexture(textureId); if (texture != null) { return(texture.BaseTexture); } else { return(null); } }
/// <summary> /// Add a texture of type CutlassTexture. Returns the id of the new texture /// </summary> /// <param name="newTexture"></param> /// <param name="textureName"></param> public static TexId AddTexture(ICutlassTexture newTexture) { TexId texId; lock (_TexIdLock) { texId = _NextTexId++; } _Textures.Add(texId, newTexture); if (_Initialized) newTexture.LoadContent(); return texId; }
public Scenery(Vector2 position, bool isVisible = true, ICutlassTexture texture = null, bool animated = false, CollisionSide side = CollisionSide.All) { _Position = position; _IsVisible = isVisible; _Active = true; if (isVisible && texture != null) { _SceneryObject_Id = TextureManager.AddTexture(texture); _Animated = animated; _Side = side; } else { _Side = CollisionSide.All; } }
public Scenery(Vector2 position, bool isVisible = true, ICutlassTexture texture = null, bool animated = false, CollisionSide side = CollisionSide.All) { _Position = position; _IsVisible = isVisible; _Active = true; if (isVisible && texture != null) { _SceneryObject_Id = TextureManager.AddTexture(texture); _Animated = animated; _Side = side; } else { _Side = CollisionSide.All; } }
/// <summary> /// Add a texture of type CutlassTexture. Returns the id of the new texture /// </summary> /// <param name="newTexture"></param> /// <param name="textureName"></param> public static TexId AddTexture(ICutlassTexture newTexture) { TexId texId; lock (_TexIdLock) { texId = _NextTexId++; } _Textures.Add(texId, newTexture); if (_Initialized) { newTexture.LoadContent(); } return(texId); }
public void Draw(GameTime gameTime, SpriteBatch spriteBatch) { ICutlassTexture texture = (ICutlassTexture)TextureManager.GetTexture(_CurrentTexture); spriteBatch.Draw(texture.BaseTexture, _Position, texture.AreaToRender, Color.White, _Rotation, new Vector2(texture.AreaToRender.Width / 2, texture.AreaToRender.Height / 2), _Scale, SpriteEffects.None, 1); }