added TileMaps to TSE

This commit is contained in:
2026-02-08 18:09:46 +01:00
parent ea2dc4f6b5
commit 330d4b26dc
12 changed files with 643 additions and 9 deletions

View File

@@ -64,7 +64,7 @@ namespace TSE::EDITOR
// Suchfeld mit X Button
ImGui::PushItemWidth(-style.FramePadding.x * 4 - 24); // Platz für Clear Button
ImGui::InputTextWithHint("##SearchField", "Suchfeld", searchBuffer, IM_ARRAYSIZE(searchBuffer));
ImGui::InputTextWithHint("##SearchField", "Search", searchBuffer, IM_ARRAYSIZE(searchBuffer));
ImGui::PopItemWidth();
ImGui::SameLine();
@@ -203,6 +203,10 @@ namespace TSE::EDITOR
{
Draw((ParticleSystem*)element, debug);
}
else if (name == "Tile Map")
{
Draw((TileMap*)element, debug);
}
else
{
element->CustomDraw(debug);
@@ -813,6 +817,44 @@ namespace TSE::EDITOR
ImGui::Unindent(20.0f);
}
}
void ElementDrawer::Draw(TileMap *element, const bool &debug)
{
int orderIndex = static_cast<int>(element->order);
const char* orderItems[] = { "TopRight", "TopLeft", "BottomRight", "BottomLeft" };
if (ImGui::Combo("Order", &orderIndex, orderItems, IM_ARRAYSIZE(orderItems)))
{
element->order = static_cast<SortingOrder>(orderIndex);
for (auto& [_, chunk] : element->chunks)
{
chunk.SetOrdering(element->order);
}
}
ImGui::BeginDisabled();
ImGui::DragInt("Chunk Size", &element->chunkSize, 1.0f);
ImGui::EndDisabled();
Vector2 nextLine = element->GetNextLineOffset();
if (ImGui::DragFloat2("Next Line Offset", &nextLine.x, 0.01f))
{
element->SetNextLineOffset(nextLine);
}
ImGui::DragFloat2("Sprite Scale", &element->SpriteScale.x, 0.01f);
if (debug)
{
Rect bounds = element->GetBounds();
ImGui::Separator();
ImGui::TextDisabled("Bounds");
ImGui::BeginDisabled();
ImGui::InputFloat2("Min", &bounds.p1.x);
ImGui::InputFloat2("Max", &bounds.p2.x);
ImGui::EndDisabled();
ImGui::TextDisabled(("Chunk Count: " + std::to_string(element->GetChunkCount())).c_str());
}
}
void ElementDrawer::DrawAudioClipCompact(AudioClip *element, const bool &debug, const std::string &label)
{
float item_spacing = ImGui::GetStyle().ItemSpacing.x;

View File

@@ -13,6 +13,7 @@
#include "BehaviourScripts/ParticleSystem.hpp"
#include "BehaviourScripts/AudioListener.hpp"
#include "BehaviourScripts/AudioSource.hpp"
#include "BehaviourScripts/TileMap.hpp"
namespace TSE::EDITOR
{
@@ -79,6 +80,7 @@ namespace TSE::EDITOR
static void Draw(AudioClip* element, const bool& debug, const std::string& label = "", const bool small = false);
static void Draw(Camera* element, const bool& debug);
static void Draw(ParticleSystem* element, const bool& debug);
static void Draw(TileMap* element, const bool& debug);
static void DrawAudioClipCompact(AudioClip* element, const bool& debug, const std::string& label);
static void DrawAudioClipNormal(AudioClip* element, const bool& debug, const std::string& label);