public Player(string spritePath) : base(50, 59) { this.QuestlineJournal = new QuestlineJournal(); var renderSize = Vector.Create(Width, Height); this._textureContext = new TextureContext(spritePath) { RenderSize = renderSize, }; }
public Map(string name) { this.Name = name; this._mapEntities = new HashSet <Entity>(); this._background = new TextureContext("ArenaGround.png") { RenderSize = Vector.Create(Size_X, Size_Y) }; this._arenaWalls = new TextureContext("ArenaWalls.png") { RenderSize = Vector.Create(Size_X, Size_Y) }; }
/// <summary> /// Binds a texture to the given path and context</summary> /// <param name="image">Path to image file containing texture</param> /// <param name="contextId">Context ID of texture</param> /// <param name="enableflipimage">True to enable flipping the image</param> /// <returns>OpenGL name of bound texture or -1 if texture could not be found/loaded</returns> public int GetTextureName(string image, object contextId, bool enableflipimage) { int name = -1; lock (this) { TextureContext context = FindContext(contextId); if (context == null) { context = new TextureContext(contextId); m_texCollections.Add(context); } if (!context.NameMap.TryGetValue(image, out name)) { TextureInfo texData; texData = new TextureInfo(); texData.EnableFlipImage = enableflipimage; name = BuildImage(image, texData); // When textures can't be found, let's note that fact so as to avoid // hundreds or thousands of IO exceptions that are then printed in // OutputService's window. context.NameMap.Add(image, name); if (name >= 0) { //defensive programming -- http://sf.ship.scea.com/sf/go/artf21789 if (!context.TextureDataMap.ContainsKey(name)) { context.TextureDataMap.Add(name, texData); context.Names.Add(name); } } } } return name; }