|
|
|
|
|
using ImGuiNET;
|
|
|
|
|
|
using Num = System.Numerics;
|
|
|
|
|
|
namespace isometricparkfna.UI
|
|
|
{
|
|
|
|
|
|
public struct NewsItem {
|
|
|
public string hed;
|
|
|
public string contents;
|
|
|
}
|
|
|
|
|
|
public static class NewsWindow
|
|
|
{
|
|
|
public static void Render(ref bool show, ImFontPtr font, Simulation sim, NewsItem[] content)
|
|
|
{
|
|
|
if (show)
|
|
|
{
|
|
|
ImGui.PushFont(font);
|
|
|
|
|
|
ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.None;
|
|
|
ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 0.0f);
|
|
|
ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0.0f);
|
|
|
ImGui.PushStyleVar(ImGuiStyleVar.FrameBorderSize, 1.0f);
|
|
|
ImGui.PushStyleVar(ImGuiStyleVar.TabRounding, 0.0f);
|
|
|
ImGui.PushStyleColor(ImGuiCol.WindowBg, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f));
|
|
|
|
|
|
var title_bar = new Num.Vector4(0.65f, 0.65f, 0.65f, 1f);
|
|
|
ImGui.PushStyleColor(ImGuiCol.TitleBg, title_bar);
|
|
|
ImGui.PushStyleColor(ImGuiCol.TitleBgActive, title_bar);
|
|
|
ImGui.PushStyleColor(ImGuiCol.TitleBgCollapsed, title_bar);
|
|
|
|
|
|
ImGui.PushStyleColor(ImGuiCol.Border, new Num.Vector4(0f, 0f, 0f, 1f));
|
|
|
ImGui.PushStyleColor(ImGuiCol.BorderShadow, new Num.Vector4(0f, 0f, 0f, 0.5f));
|
|
|
|
|
|
|
|
|
|
|
|
ImGui.PushStyleColor(ImGuiCol.Button, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f));
|
|
|
ImGui.PushStyleColor(ImGuiCol.Text, new Num.Vector4(0f, 0f, 0f, 1f));
|
|
|
ImGui.Begin("NEWS", ref show, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoSavedSettings);
|
|
|
|
|
|
if (ImGui.BeginTabBar("Sources", 0)) {
|
|
|
if (ImGui.BeginTabItem("Wire")) {
|
|
|
|
|
|
foreach (NewsItem story in content) {
|
|
|
if (ImGui.CollapsingHeader(story.hed, ImGuiTreeNodeFlags.DefaultOpen)) {
|
|
|
ImGui.TextWrapped(story.contents);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
ImGui.EndTabBar();
|
|
|
|
|
|
|
|
|
if (ImGui.Button("Okay"))
|
|
|
{
|
|
|
show = false;
|
|
|
}
|
|
|
|
|
|
ImGui.End();
|
|
|
ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.Left;
|
|
|
ImGui.PopStyleVar(4);
|
|
|
ImGui.PopStyleColor(8);
|
|
|
ImGui.PopFont();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|