private void oGL_MouseMove(object sender, MouseEventArgs e) { m_LastMouseMovement = e; if (m_Map == null) { return; } int x = GetPositionOnMap(e.X + m_PositionX); if (x < 0) { return; } int y = GetPositionOnMap(e.Y + m_PositionY); if (y < 0) { return; } if ((x < m_Map.Size.Width) && (y < m_Map.Size.Height)) { m_LastHoveredTile = m_Map.Tiles[x, y]; } }
private void LoadData(EvilPlug.Filetypes.Lay.LayFile layFile) { try { m_Map = new LayMap(layFile); } catch { lblStatus.Text = "Status: Error loading map data!"; m_Loaded = false; m_Loading = false; return; } for (int y = 0; y < m_Map.Size.Height; y++) { for (int x = 0; x < m_Map.Size.Width; x++) { LayMapTile tile = m_Map.Tiles[x, y]; tile.Tag = new ExtraTileInfo(tile, Textures); } } WindowState = FormWindowState.Normal; Application.DoEvents(); WindowState = FormWindowState.Maximized; m_Loaded = true; m_Loading = false; MapTools = new LayMapTool(Plugin.LayFile, m_Map); }
public ExtraTileInfo(LayMapTile tile, OGLTextureManager manager) { Parent = tile; TextureManager = manager; Texture = TextureManager.LoadTexture(EvilTools.GetExecutingPath(@"MapEditor\Tiles\" + tile.Id + ".png")); if (Texture == null) { Texture = TextureManager.LoadTexture(EvilTools.GetExecutingPath(@"MapEditor\Tiles\unknown.png")); } }
private void oGL_Click_1(object sender, EventArgs e) { LayMapTile tile = m_LastHoveredTile; if (tile == null) { return; } LayEntity parent = Plugin.LayFile.FindEntityByGridLocation(tile.Position.X, tile.Position.Y); if (parent == null) { return; } if (parent.TilesGrid.Tiles.Count > 0) { MapTools.UnselectAllTiles(); MapTools.SelectGrid(parent.TilesGrid); } }
// (2 * 4) * 8 = 64 // other possible: 1 (32) private void RenderMap() { if (m_Map == null) { return; } //OGLTexture txt = Textures.LoadTexture(EvilTools.GetExecutingPath(@"MapEditor\Tiles\22029.png")); int yStart = 0; int xStart = 0; xStart = GetPositionOnMap(m_PositionX); yStart = GetPositionOnMap(m_PositionY); for (int y = yStart; y < m_Map.Size.Height; y++) { if ((y * BoxSize) > oGL.Height + m_PositionY) { continue; } for (int x = xStart; x < m_Map.Size.Width; x++) { if ((x * BoxSize) > oGL.Width + m_PositionX) { continue; } LayMapTile tile = m_Map.Tiles[x, y]; ExtraTileInfo info = (ExtraTileInfo)tile.Tag; OGLTools.DrawTexture(info.Texture, new Position2D(0, 0), new Dimension2D(info.Texture.Size.Width, info.Texture.Size.Height), new Position2D((x * BoxSize) - m_PositionX, (y * BoxSize) - m_PositionY), new Dimension2D(BoxSize, BoxSize), 1f); } } }
private void ProcessTile(LayMapTile tile) { Text += tile.Position.X.ToString() + "," + tile.Position.Y.ToString(); txtTileId.Text = tile.Id + " (Raw id: " + tile.RawId + ")"; }
public frmTileDetail(LayMapTile tile) { InitializeComponent(); ProcessTile(tile); }