|
|
|
|
@ -120,8 +120,19 @@ namespace lunarium { namespace editor
|
|
|
|
|
ImGui::End();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ImGui::PopStyleVar(3);
|
|
|
|
|
|
|
|
|
|
ImVec2 window_size = ImGui::GetWindowSize();
|
|
|
|
|
|
|
|
|
|
float child_height = ImGui::GetFrameHeight() * 2;
|
|
|
|
|
ImGui::BeginChild(ImGui::GetID(GetName()), ImVec2(ImGui::GetWindowSize().x, child_height), true);
|
|
|
|
|
ImGui::TextUnformatted("THIS IS SOME PLACEHOLDER TEXT -- ADD TOOLS HERE FOR SELECTING TILE SETS");
|
|
|
|
|
ImGui::EndChild();
|
|
|
|
|
|
|
|
|
|
ImVec2 test = ImGui::GetWindowSize();
|
|
|
|
|
test.y -= child_height;
|
|
|
|
|
//ImGui::BeginChild(ImGui::GetID(GetName()), ImVec2(ImGui::GetWindowSize().x, test.y));
|
|
|
|
|
|
|
|
|
|
mWorkAreaPos = { ImGui::GetWindowPos().x, ImGui::GetWindowPos().y };
|
|
|
|
|
mWorkAreaSize = { ImGui::GetWindowSize().x, ImGui::GetWindowSize().y };
|
|
|
|
|
mScrollOffset = { ImGui::GetScrollX(), ImGui::GetScrollY() };
|
|
|
|
|
@ -130,55 +141,17 @@ namespace lunarium { namespace editor
|
|
|
|
|
mWorkAreaPos.Y += ImGui::GetFrameHeight();
|
|
|
|
|
mWorkAreaSize.Y -= ImGui::GetFrameHeight();
|
|
|
|
|
|
|
|
|
|
// Adjust for info box
|
|
|
|
|
// float child_height = 90.0f;
|
|
|
|
|
// size.y -= child_height;
|
|
|
|
|
|
|
|
|
|
// ImGuiIO& io = ImGui::GetIO();
|
|
|
|
|
// float x = io.MousePos.x - pos.x;
|
|
|
|
|
// float y = io.MousePos.y - pos.y;
|
|
|
|
|
|
|
|
|
|
// bool is_in_window = x >= 0.0f && x < size.x && y >= 0.0f && y < size.y;
|
|
|
|
|
|
|
|
|
|
// // Check for mouse click
|
|
|
|
|
// if (ImGui::IsMouseDown(ImGuiMouseButton_Left) && is_in_window && mpTileSet)
|
|
|
|
|
// {
|
|
|
|
|
// // Adjust for scrolling
|
|
|
|
|
// x += ImGui::GetScrollX();
|
|
|
|
|
// y += ImGui::GetScrollY();
|
|
|
|
|
|
|
|
|
|
// // Find selected tile
|
|
|
|
|
// mSelectedTile.X = x / mpTileSet->GetTileSize().Width;
|
|
|
|
|
// mSelectedTile.Y = y / mpTileSet->GetTileSize().Height;
|
|
|
|
|
// Invalidate();
|
|
|
|
|
// }
|
|
|
|
|
// Adjust for tool bar
|
|
|
|
|
mWorkAreaPos.Y += child_height;
|
|
|
|
|
mWorkAreaSize.Y -= child_height;
|
|
|
|
|
|
|
|
|
|
if (mpViewImage)
|
|
|
|
|
{
|
|
|
|
|
ImGui::Image((ImTextureID)mpViewImage->GetGLTextureID64(),
|
|
|
|
|
ImVec2(mpViewImage->GetWidth(), mpViewImage->GetHeight()), ImVec2(0, 1), ImVec2(1, 0)); // the last 2 params are flipping the image on the y
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: If a tile on the map was changed this frame null out the canvas image so it will be redrawn
|
|
|
|
|
|
|
|
|
|
// ImGui::SetNextWindowPos(ImVec2(ImGui::GetWindowPos().x, ImGui::GetWindowPos().y + (ImGui::GetWindowSize().y - child_height)), ImGuiCond_Always);
|
|
|
|
|
// ImGui::BeginChild(ImGui::GetID(GetName()), ImVec2(size.x, child_height), true);
|
|
|
|
|
// std::ostringstream oss;
|
|
|
|
|
// oss << "Mouse Pos: (" << x << ", " << y << ")";
|
|
|
|
|
|
|
|
|
|
// if (mpTileSet)
|
|
|
|
|
// {
|
|
|
|
|
// oss << "\nSelected Tile Would be: (" << (int)x / mpTileSet->GetTileSize().Width << ", " << (int)y / mpTileSet->GetTileSize().Height << ")";
|
|
|
|
|
|
|
|
|
|
// Rectangle selection = mpTileSet->GetTileRect(mSelectedTile);
|
|
|
|
|
// oss << "\n Selection: (" << selection.left() << ", " << selection.top()
|
|
|
|
|
// << ") size: (" << selection.HalfWidth * 2 << ", " << selection.HalfHeight * 2 << ")";
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// ImGui::TextUnformatted(oss.str().c_str());
|
|
|
|
|
|
|
|
|
|
// ImGui::EndChild();
|
|
|
|
|
//ImGui::EndChild();
|
|
|
|
|
ImGui::End();
|
|
|
|
|
return mIsOpen;
|
|
|
|
|
}
|
|
|
|
|
|