private void UpdateEditor(GameTime gt_) { UpdateTranslation(); if (p_SaveTileset) { //save } if (IsClicking()) { bool switched = false; if (currentTile.GetFrame().Contains(mousePos)) { ToggleSelectedTile(); switched = true; } if (!switched) { Point closest = new Point(0, 0); float closestDist = 1000; for (int x = 0; x < ts.GetWidth(); x++) { for (int y = 0; y < ts.GetHeight(); y++) { float dist = Vector2.Distance(GetMousePos(), ts.GetTiles()[x, y].GetMiddle()); if (dist < closestDist) { closestDist = dist; closest = new Point(x, y); } } } if (ts.GetTiles()[closest.X, closest.Y].GetFrame().Contains(GetMousePos())) { ts.GetTiles()[closest.X, closest.Y] = GetTile(tileNames[tileIndex]); ts.PlaceTiles(); } } } }