private void FrmMap_Load(object sender, EventArgs e) { Graphics.CSprite.initFrameRateMapping(); foreach (KeyValuePair <string, Graphics.CTextureAtlas> tileset in Graphics.CTextures.textures) { if (tileset.Value.isTileSet) { cmbTilesets.Items.Add(tileset.Key); King_of_Thieves.Graphics.CSprite sprite = txvTextures.changeSprite(tileset.Key, tileset.Value); _atlasCache.Add(tileset.Key, sprite); } } populateNameSpaceList(); populateActorList("all"); cmbTilesets.SelectedIndex = 0; cmbLayers.SelectedIndex = 0; cmbActorList.SelectedIndex = 0; _newMap(); tile = txvTextures.selectTile(hsbTexture.Value, vsbTexture.Value); }
public void draw(King_of_Thieves.Graphics.CSprite image, SpriteBatch spriteBatch, double width, double height) { Vector2 dimensions = Vector2.Zero; dimensions = new Vector2((float)width, (float)height); image.draw((int)tileCoords.X, (int)tileCoords.Y, (int)(atlasCoords.X), (int)(atlasCoords.Y), 1, 1, true, spriteBatch); }
public virtual void draw(King_of_Thieves.Graphics.CSprite image, SpriteBatch spriteBatch, int offSetX = 0, int offsetY = 0) { Vector2 dimensions = Vector2.Zero; dimensions = new Vector2(Graphics.CTextures.textures[tileSet].FrameWidth, Graphics.CTextures.textures[tileSet].FrameHeight); image.draw((int)(tileCoords.X + offSetX), (int)(tileCoords.Y + offsetY), (int)(atlasCoords.X), (int)(atlasCoords.Y), 1, 1, true, spriteBatch); }
public King_of_Thieves.Graphics.CSprite changeSprite(string atlasName, King_of_Thieves.Graphics.CTextureAtlas newTexture) { _textureAtlas = newTexture; _currentSprite = new King_of_Thieves.Graphics.CSprite(atlasName, newTexture); _selector = new Texture2D(GraphicsDevice, 1, 1); _selector.SetData <Color>(new Color[] { Color.Red }); return(_currentSprite); }
private void cmbTilesets_SelectedIndexChanged(object sender, EventArgs e) { King_of_Thieves.Graphics.CSprite sprite = txvTextures.changeSprite(cmbTilesets.Text, Graphics.CTextures.textures[cmbTilesets.Text]); mpvMapView.changeCurrentTileSet(sprite); //check the texture width and height if (txvTextures.checkWidth()) { hsbTexture.Minimum = 0; hsbTexture.Maximum = txvTextures.atlasWidth - txvTextures.Width; } if (txvTextures.checkHeight()) { vsbTexture.Minimum = 0; vsbTexture.Maximum = txvTextures.atlasHeight - txvTextures.Height; } hsbTexture.Value = 0; }