private void DrawEntryWindow(Sdl2Window window)
        {
            Vector2 pos = Vector2.One;

            pos.X = 500;
            pos.Y = 18;
            ImGui.SetNextWindowPos(pos, ImGuiCond.Always, Vector2.Zero);
            ImGui.SetNextWindowSize(new Vector2(350.0f, window.Height - 18), ImGuiCond.Always);

            if (ImGui.Begin("##entry_window", ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoTitleBar))
            {
                AlfModule levelModule   = Alf.Modules[SelectedEntry];
                AlfModule textureModule = Alf.Modules[SelectedEntry + 1];

                ImGui.Text($"Level: {levelModule.Name}");
                ImGui.Text($"3D-Definition: {levelModule.Entries.First(e => e.Name.EndsWith("3DM")).Name}");
                ImGui.Text($"Palette: {levelModule.Entries.First(e => e.Name.EndsWith("PAL")).Name}");

                ImGui.BeginChild("##text_list");

                ImGui.Columns(2);
                ImGui.Text("idx"); ImGui.NextColumn();
                ImGui.Text("Name"); ImGui.NextColumn();
                ImGui.Separator();

                ImGui.SetColumnWidth(0, 50.0f);

                for (int i = 0; i < textureModule.Entries.Count; i++)
                {
                    if (ImGui.Selectable(i.ToString(), i == SelectedTexture, ImGuiSelectableFlags.SpanAllColumns))
                    {
                        SelectTexture(i);
                    }
                    ImGui.NextColumn();
                    ImGui.Text(textureModule.Entries[i].Name); ImGui.NextColumn();
                }

                ImGui.Columns(1);

                ImGui.EndChild();

                ImGui.End();
            }

            if (SelectedTexture != -1)
            {
                DrawTextureWindow(window);
            }
        }
        private void DrawContentList()
        {
            ImGui.Separator();

            ImGui.BeginChild("##file_list");

            ImGui.Columns(3);
            ImGui.Text("idx"); ImGui.NextColumn();
            ImGui.Text("level"); ImGui.NextColumn();
            ImGui.Text("textures"); ImGui.NextColumn();
            ImGui.Separator();

            ImGui.SetColumnWidth(0, 50.0f);

            for (int i = 0; i < Alf.Modules.Count - 1; i += 2)
            {
                AlfModule levelMod = Alf.Modules[i];

                if (levelMod.Name == "FINAL03")
                {
                    continue;
                }

                AlfModule textureMod = Alf.Modules[i + 1];

                if (ImGui.Selectable(i.ToString(), i == SelectedEntry, ImGuiSelectableFlags.SpanAllColumns))
                {
                    SelectEntry(i);
                }
                ImGui.NextColumn();
                ImGui.Text(levelMod.Name);
                ImGui.NextColumn();
                ImGui.Text(textureMod.Name);
                ImGui.NextColumn();
            }

            ImGui.Columns(1);

            ImGui.EndChild();
        }
        private void DrawTextureWindow(Sdl2Window window)
        {
            Vector2 pos = Vector2.One;

            pos.X = 500 + 350 - 1;
            pos.Y = 18;
            ImGui.SetNextWindowPos(pos, ImGuiCond.Always, Vector2.Zero);
            ImGui.SetNextWindowSize(new Vector2(window.Width - pos.X, window.Height - 18), ImGuiCond.Always);

            if (ImGui.Begin("##texture_window", ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoTitleBar))
            {
                AlfModule levelModule     = Alf.Modules[SelectedEntry];
                AlfModule textureModule   = Alf.Modules[SelectedEntry + 1];
                AlfEntry  selectedTexture = textureModule.Entries[SelectedTexture];

                ImGui.Text($"Texture: {selectedTexture.Name}");

                if (!HasImage && ImGui.Button("View me"))
                {
                    byte[]  paletteData = levelModule.Entries.Find(e => e.Name.EndsWith("PAL")).GetContents();
                    var     br          = new BinaryReader(new MemoryStream(paletteData));
                    Palette p           = Palette.LoadFromPal(br);

                    byte[]    imageData = selectedTexture.GetContents();
                    ImageData temp      = PixExtractor.ExtractImage(imageData, p);

                    Texture img = Gd.ResourceFactory.CreateTexture(new TextureDescription
                    {
                        Height      = (uint)temp.Height,
                        Width       = (uint)temp.Width,
                        Format      = PixelFormat.R8_G8_B8_A8_UNorm_SRgb,
                        Type        = TextureType.Texture2D,
                        Usage       = TextureUsage.Sampled,
                        MipLevels   = 1,
                        Depth       = 1,
                        ArrayLayers = 1
                    });

                    GCHandle pinnedArray = GCHandle.Alloc(temp.PixelData, GCHandleType.Pinned);
                    IntPtr   pointer     = pinnedArray.AddrOfPinnedObject();

                    Gd.UpdateTexture(img, pointer, (uint)temp.PixelData.Length, 0, 0, 0, (uint)temp.Width, (uint)temp.Height, 1, 0, 0);

                    pinnedArray.Free();

                    CurrentImage = img;
                    HasImage     = true;
                    ZoomFactor   = 1;
                }

                if (HasImage && CurrentImage != null)
                {
                    if (ImGui.Button("Close me"))
                    {
                        HasImage = false;
                        CurrentImage.Dispose();
                    }

                    ImGui.SameLine();

                    if (ImGui.Button("+"))
                    {
                        ZoomFactor++;
                    }

                    ImGui.SameLine();

                    if (ImGui.Button("-"))
                    {
                        ZoomFactor = ZoomFactor == 1 ? 1 : ZoomFactor - 1;
                    }

                    ImGui.Text($"Image Size: {CurrentImage.Width}x{CurrentImage.Height}");

                    ImGui.Image(ImGuiRenderer.GetOrCreateImGuiBinding(Gd.ResourceFactory, CurrentImage), new Vector2(CurrentImage.Width * ZoomFactor, CurrentImage.Height * ZoomFactor));
                }

                ImGui.End();
            }
        }