Compare commits
	
		
			3 Commits
		
	
	
		
			b69e7ebb98
			...
			55a1660242
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 55a1660242 | |||
| ed365dfef5 | |||
| 23a09e4a13 | 
@@ -237,10 +237,12 @@ struct TileSheetV4 {
 | 
			
		||||
[[nodiscard]]
 | 
			
		||||
constexpr bool valid(TileSheetV4::SubSheet const&ss, int bpp) noexcept {
 | 
			
		||||
	auto const bytes = static_cast<size_t>(ss.columns * ss.rows * PixelsPerTile) / (bpp == 4 ? 2 : 1);
 | 
			
		||||
	return ox::all_of(ss.subsheets.begin(), ss.subsheets.end(),
 | 
			
		||||
			[bpp, bytes](TileSheetV4::SubSheet const&s) {
 | 
			
		||||
		return bytes == s.pixels.size() && valid(s, bpp);
 | 
			
		||||
	});
 | 
			
		||||
	return
 | 
			
		||||
		(ss.pixels.empty() || ss.subsheets.empty()) &&
 | 
			
		||||
		ox::all_of(ss.subsheets.begin(), ss.subsheets.end(),
 | 
			
		||||
				[bpp, bytes](TileSheetV4::SubSheet const&s) {
 | 
			
		||||
			return bytes == s.pixels.size() && valid(s, bpp);
 | 
			
		||||
		});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
[[nodiscard]]
 | 
			
		||||
@@ -249,8 +251,14 @@ constexpr bool valid(TileSheetV4 const&ts) noexcept {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
constexpr void repair(TileSheetV4::SubSheet &ss, int bpp) noexcept {
 | 
			
		||||
	auto const bytes = static_cast<size_t>(ss.columns * ss.rows * PixelsPerTile) / (bpp == 4 ? 2 : 1);
 | 
			
		||||
	ss.pixels.resize(bytes);
 | 
			
		||||
	if (ss.subsheets.empty()) {
 | 
			
		||||
		auto const bytes = static_cast<size_t>(ss.columns * ss.rows * PixelsPerTile) / (bpp == 4 ? 2 : 1);
 | 
			
		||||
		ss.pixels.resize(bytes);
 | 
			
		||||
	} else {
 | 
			
		||||
		ss.pixels.clear();
 | 
			
		||||
		ss.columns = -1;
 | 
			
		||||
		ss.rows = -1;
 | 
			
		||||
	}
 | 
			
		||||
	for (auto &s : ss.subsheets) {
 | 
			
		||||
		repair(s, bpp);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -544,7 +544,7 @@ void TileSheetEditorImGui::SubSheetEditor::draw(turbine::Context &tctx) noexcept
 | 
			
		||||
	auto const popupHeight = modSize ? 130.f : 85.f;
 | 
			
		||||
	auto const popupSz = ImVec2{popupWidth, popupHeight};
 | 
			
		||||
	if (ig::BeginPopup(tctx, popupName, m_show, popupSz)) {
 | 
			
		||||
		ImGui::InputText("Name", m_name.data(), m_name.cap());
 | 
			
		||||
		ig::InputText("Name", m_name);
 | 
			
		||||
		if (modSize) {
 | 
			
		||||
			ImGui::InputInt("Columns", &m_cols);
 | 
			
		||||
			ImGui::InputInt("Rows", &m_rows);
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,7 @@ void NewProject::draw(studio::StudioContext &ctx) noexcept {
 | 
			
		||||
 | 
			
		||||
void NewProject::drawNewProjectName(studio::StudioContext &sctx) noexcept {
 | 
			
		||||
	drawWindow(sctx.tctx, &m_open, [this, &sctx] {
 | 
			
		||||
		ImGui::InputText("Name", m_projectName.data(), m_projectName.cap());
 | 
			
		||||
		ig::InputText("Name", m_projectName);
 | 
			
		||||
		ImGui::Text("Path: %s", m_projectPath.c_str());
 | 
			
		||||
		if (ImGui::Button("Browse")) {
 | 
			
		||||
			oxLogError(studio::chooseDirectory().moveTo(m_projectPath));
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user