Skip to content

Commit

Permalink
[editor] cleaned up sponsor and introduction windows
Browse files Browse the repository at this point in the history
  • Loading branch information
PanosK92 committed Jan 21, 2025
1 parent 2ed992f commit 7848095
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 59 deletions.
4 changes: 2 additions & 2 deletions editor/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Editor::Editor(const vector<string>& args)
// register imgui as a third party library (will show up in the about window)
spartan::Settings::RegisterThirdPartyLib("ImGui", IMGUI_VERSION, "https://github.com/ocornut/imgui");

EditorWindows::Initialize(this);
GeneralWindows::Initialize(this);
}

Editor::~Editor()
Expand Down Expand Up @@ -159,7 +159,7 @@ void Editor::Tick()
ImGui::End();

// various windows that don't belnog to a certain widget
EditorWindows::Tick();
GeneralWindows::Tick();
}
}

Expand Down
84 changes: 35 additions & 49 deletions editor/EditorWindows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,62 +40,50 @@ namespace
{
Editor* editor = nullptr;

namespace introduction
namespace sponsor
{
bool visible = true;
bool visible = true;
const float width = 512.0f;

void window()
{
const float width = 600.0f;
const float height = 240.0f;

ImVec2 display_size = ImGui::GetIO().DisplaySize;
ImVec2 window_pos = ImVec2((display_size.x - width) * 0.15f, (display_size.y - height) * 0.45f);
ImGui::SetNextWindowPos(window_pos, ImGuiCond_Always);
ImGui::SetNextWindowSize(ImVec2(width, height), ImGuiCond_Always);

if (ImGui::Begin("What should you expect", &visible, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize))
ImGui::SetNextWindowSize(ImVec2(width, width * 0.52f));
if (ImGui::Begin("Support Spartan Engine", &visible, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoDocking))
{
ImGui::TextWrapped("This isn't an engine for the average user, it's designed for advanced research and experimentation, ideal for industry veterans looking to experiment.");
ImGui::SetNextItemWidth(width);
ImGui::TextWrapped(
"I cover the costs for Dropbox hosting and a GitHub Pro subscription for benefits like assets and package bandwidth."
""
"If you enjoy the simplicity of running a single script and have everything just work, please consider sponsoring to help keep everything running smoothly!"
);
ImGui::Separator();
if (ImGuiSp::button_centered_on_line("Sponsor"))
{
spartan::FileSystem::OpenUrl("https://github.com/sponsors/PanosK92");
}
}
ImGui::End();
}
}

namespace sponsor
namespace introduction
{
bool visible = true;
bool visible = true;
const float width = 512.0f;

void window()
{
const float width = 600.0f;
const float height = 240.0f;

ImVec2 display_size = ImGui::GetIO().DisplaySize;
ImVec2 window_pos = ImVec2((display_size.x - width) * 0.15f, (display_size.y - height) * 0.3f);
ImGui::SetNextWindowPos(window_pos, ImGuiCond_Always);
ImGui::SetNextWindowSize(ImVec2(width, height), ImGuiCond_Always);

// set focus
if (ImGui::Begin("Support Spartan Engine", &visible, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize))
ImGui::SetNextWindowSize(ImVec2(width, width * 0.36f));
if (ImGui::Begin("What should you expect", &visible, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoDocking))
{
ImGui::TextWrapped(
"I cover the costs for Dropbox hosting and a GitHub Pro subscription for benefits like assets and package bandwidth."
" "
"If you enjoy the simplicity of running a single script and have everything just work, please consider sponsoring to help keep everything running smoothly!"
);

ImGui::TextWrapped("This isn't an engine for the average user, it's designed for advanced research and experimentation, ideal for industry veterans.");
ImGui::Separator();

float button_width = ImGui::CalcTextSize("Sponsor").x + ImGui::GetStyle().FramePadding.x * 2.0f;
float window_width = ImGui::GetWindowSize().x;
ImGui::SetCursorPosX((window_width - button_width) * 0.5f);

if (ImGui::Button("Sponsor"))
if (ImGuiSp::button_centered_on_line("Ok"))
{
spartan::FileSystem::OpenUrl("https://github.com/sponsors/PanosK92");
visible = false;
}
}
}

ImGui::End();
}
}
Expand Down Expand Up @@ -134,14 +122,12 @@ namespace
"Spartan, Panos Kolyvakis, Greece, LinkedIn, https://www.linkedin.com/in/panos-kolyvakis-66863421a/, Improved water buoyancy, N/A",
"Spartan, Tri Tran, Belgium, LinkedIn, https://www.linkedin.com/in/mtrantr/, Days Gone screen space shadows, Starfield",
"Spartan, Ege, Turkey, X, https://x.com/egedq, Editor theme & ability to save/load themes, N/A",

"Hoplite, Apostolos Bouzalas, Greece, LinkedIn, https://www.linkedin.com/in/apostolos-bouzalas, Provided performance reports, N/A",
"Hoplite, Nikolas Pattakos, Greece, LinkedIn, https://www.linkedin.com/in/nikolaspattakos/, GCC compile fixes, N/A",
"Hoplite, Sandro Mtchedlidze, Georgia, Artstation, https://www.artstation.com/sandromch, Added Nautilus tonemapper & spotted lighting/performance issues, N/A",
"Hoplite, Roman Koshchei, Ukraine, X, https://x.com/roman_koshchei, Circular stack for the undo/redo system, N/A",
"Hoplite, Kristi Kercyku, Albania, GitHub, https://github.com/kristiker, Identified g-buffer depth testing issue, N/A",
"Hoplite, Kinjal Kishor, India, X, https://x.com/kinjalkishor, Supported with testing & technical issues, N/A",

"Patron, Kiss Tibor, Hungary, GitHub, https://github.com/kisstp2006, GitHub Sponsor, N/A"
};

Expand Down Expand Up @@ -527,7 +513,7 @@ namespace
}
}

void EditorWindows::Initialize(Editor* editor_in)
void GeneralWindows::Initialize(Editor* editor_in)
{
editor = editor_in;

Expand All @@ -540,18 +526,18 @@ void EditorWindows::Initialize(Editor* editor_in)
default_worlds::visible = default_worlds::downloaded;
}

void EditorWindows::Tick()
void GeneralWindows::Tick()
{
// visibility
// windows
{
if (introduction::visible)
if (sponsor::visible)
{
introduction::window();
sponsor::window();
}

if (sponsor::visible)
if (introduction::visible)
{
sponsor::window();
introduction::window();
}

if (about::visible)
Expand All @@ -576,12 +562,12 @@ void EditorWindows::Tick()
}
}

bool* EditorWindows::GetVisiblityWindowAbout()
bool* GeneralWindows::GetVisiblityWindowAbout()
{
return &about::visible;
}

bool* EditorWindows::GetVisiblityWindowShortcuts()
bool* GeneralWindows::GetVisiblityWindowShortcuts()
{
return &shortcuts::visible;
}
2 changes: 1 addition & 1 deletion editor/EditorWindows.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

class Editor;

class EditorWindows
class GeneralWindows
{
public:
static void Initialize(Editor* editor);
Expand Down
4 changes: 2 additions & 2 deletions editor/MenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ namespace
{
if (ImGui::BeginMenu("View"))
{
if (ImGui::MenuItem("Shortcuts & Input Reference", "Ctrl+P", EditorWindows::GetVisiblityWindowShortcuts()))
if (ImGui::MenuItem("Shortcuts & Input Reference", "Ctrl+P", GeneralWindows::GetVisiblityWindowShortcuts()))
{

}
Expand Down Expand Up @@ -193,7 +193,7 @@ namespace
{
if (ImGui::BeginMenu("Help"))
{
ImGui::MenuItem("About", nullptr, EditorWindows::GetVisiblityWindowAbout());
ImGui::MenuItem("About", nullptr, GeneralWindows::GetVisiblityWindowAbout());

if (ImGui::MenuItem("Sponsor", nullptr, nullptr))
{
Expand Down
3 changes: 1 addition & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

<p>Spartan Engine is one of the most advanced one-man game engines out there, pushing the limits of real-time approaches.
What started as a portfolio project has evolved into a cutting-edge project for developers to explore, learn, and contribute.
This isn't an engine for the average user, it's designed for advanced research and experimentation, ideal for industry veterans
looking to experiment, not to build a game. With a thriving Discord community of over 500 members, including industry
This isn't an engine for the average user, it's designed for advanced research and experimentation, ideal for industry veterans, not for individuals to build a game. With a thriving Discord community of over 500 members, including industry
veterans, and contribution perks that you won't believe when you see, it's one of the most unique projects you'll come across.</p>

- <img align="left" width="32" src="https://i.pinimg.com/736x/99/65/5e/99655e9fe24eb0a7ea38de683cedb735.jpg"/>For occasional updates regarding the project's development, you can follow me on <a href="https://twitter.com/panoskarabelas1?ref_src=twsrc%5Etfw">X</a>.
Expand Down
6 changes: 3 additions & 3 deletions runtime/Rendering/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ namespace spartan

uint32_t Mesh::GetMemoryUsage() const
{
uint32_t size = 0;
size += uint32_t(m_indices.size() * sizeof(uint32_t));
size += uint32_t(m_vertices.size() * sizeof(RHI_Vertex_PosTexNorTan));
uint32_t size = 0;
size += uint32_t(m_indices.size() * sizeof(uint32_t));
size += uint32_t(m_vertices.size() * sizeof(RHI_Vertex_PosTexNorTan));

return size;
}
Expand Down

0 comments on commit 7848095

Please sign in to comment.