--  Populous Reincarnated © 2019
--  Populous is a registered trademark of Electronic Arts Inc.
    
--  Library:    Level Editor Example 1
--  Purpose:    Demo Script For the in game level editor
--  Author:     Brandan Tyler Lasley 
--  Site:       http://popre.net
--  Discord:    https://discord.gg/buRQ4HK
    
--  This program is free software: you can redistribute it and/or modify
--  it under the terms of the GNU General Public License as published by
--  the Free Software Foundation, either version 3 of the License, or
--  (at your option) any later version.

--  This program is distributed in the hope that it will be useful,
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--  GNU General Public License for more details.

--  You should have received a copy of the GNU General Public License
--  along with this program.  If not, see <https://www.gnu.org/licenses/>.
import(Module_LevelEdit)
import(Module_ImGui)

-- Windows Available
is_example_visible = false;

function OnMapEditInit()
    addEditorMenuItem("Hello World!", "Example 1", ToggleExample);
    return 0
end

function ToggleExample()
    is_example_visible = not is_example_visible;
end

function DrawAboutWindow()
    if (is_example_visible) then
        imgui.Begin('About Lua Example', nil, ImGuiWindowFlags_AlwaysAutoResize);
        imgui.TextUnformatted("Hello World - Made By Brandan UwU");
        if (imgui.Button("Close")) then
            ToggleExample();
        end
        imgui.End();
    end
end

function OnImGuiFrame()
    DrawAboutWindow();
end