private void RenderMouseMovement() { int x = GetPosition(m_LastMouseMovement.X + m_PositionX) - m_PositionX; int y = GetPosition(m_LastMouseMovement.Y + m_PositionY) - m_PositionY; OGLTools.DrawRectangle(Color.White, new Position2D(x, y), new Dimension2D(BoxSize, BoxSize)); }
private void RenderObject(LayEntity obj) { OGLTexture text = Textures.LoadTexture(EvilTools.GetExecutingPath(@"MapEditor\Objects\" + obj.EntityDescriptionID + ".png")); if (text == null) { OGLTools.DrawFilledRectangle(Color.Green, new Position2D(obj.Pattern.Location.X * BoxSize + BoxSize - m_PositionX, obj.Pattern.Location.Y * BoxSize + BoxSize - m_PositionY), new Dimension2D(BoxSize, BoxSize)); return; } OGLTools.DrawTexture(text, new Position2D(0, 0), text.Size, new Position2D(obj.Pattern.Location.X * BoxSize + BoxSize - m_PositionX, obj.Pattern.Location.Y * BoxSize + BoxSize - m_PositionY), new Dimension2D(BoxSize, BoxSize), 1f); }
private void RenderObjects() { List <LayEntity> objects = Plugin.LayFile.GetObjectEntities(); foreach (LayEntity obj in objects) { RenderObject(obj); if (obj.Deleted) { OGLTools.DrawLine(Color.Red, new Position2D(obj.Pattern.Location.X * BoxSize + BoxSize - m_PositionX, obj.Pattern.Location.Y * BoxSize + BoxSize - m_PositionY), new Dimension2D(BoxSize, BoxSize)); OGLTools.DrawLine(Color.Red, new Position2D(obj.Pattern.Location.X * BoxSize + BoxSize + BoxSize - m_PositionX, obj.Pattern.Location.Y * BoxSize + BoxSize - m_PositionY), new Dimension2D(BoxSize * -1, BoxSize)); } } }
private void RenderDebugPattern() { LayEntity ent = Plugin.LayFile.FindEntity("13029"); if (ent == null) { return; } // draw the console! OGLTexture text = Textures.LoadTexture(EvilTools.GetExecutingPath(@"MapEditor\Objects\13029.png")); //OGLTools.DrawTexture(text, new Position2D(0, 0), text.Size, new Position2D(ent.Pattern.Location.X * BoxSize - m_PositionX, ent.Pattern.Location.Y * BoxSize - m_PositionY), text.Size, 1.0f); OGLTools.DrawTexture(text, new Position2D(0, 0), text.Size, new Position2D(GetPosition(ent.Pattern.Location.X * BoxSize) - m_PositionX + BoxSize, GetPosition(ent.Pattern.Location.Y * BoxSize) - m_PositionY + BoxSize), new Position2D(ent.Pattern.Location.X * BoxSize - m_PositionX + BoxSize * 5, ent.Pattern.Location.Y * BoxSize - m_PositionY + BoxSize + BoxSize), 1.0f); OGLTools.DrawRectangle(Color.Red, new Position2D(ent.Pattern.Location.X * BoxSize + BoxSize - m_PositionX, ent.Pattern.Location.Y * BoxSize + BoxSize - m_PositionY), new Dimension2D(BoxSize, BoxSize)); }
// (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 RenderSelectedTilesBoxes() { List <LayMapTile> tiles = MapTools.GetSelectedTiles(); int boxSize = BoxSize; foreach (LayMapTile tile in tiles) { int bX, bY = 0; bX = tile.Position.X * boxSize; // -m_PositionX; bY = tile.Position.Y * boxSize; // -m_PositionY; //bX = GetPosition(bX + m_PositionX) - m_PositionX; //bY = GetPosition(bY + m_PositionY) - m_PositionY; if ((bX < m_PositionX - 32) || (bY < m_PositionY - 32)) { continue; } // TODO improve rendering OGLTools.DrawRectangle(Color.White, new Position2D(bX - m_PositionX, bY - m_PositionY), new Dimension2D(boxSize, boxSize)); } }
private void oGL_Resize_1(object sender, EventArgs e) { Gl.glViewport(0, 0, oGL.Width, oGL.Height); OGLTools.glDisable2D(); OGLTools.RestoreOrtho(); }