Skip to content

Commit

Permalink
Use title passed to showWindow as display name if none has been set
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed Aug 29, 2024
1 parent ea0db95 commit 459a251
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions examples/videoplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ JNGL_MAIN_BEGIN {
}
jngl::swapBuffers();
}
jngl::trace("quit");
} JNGL_MAIN_END
2 changes: 1 addition & 1 deletion src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void App::callAtExitFunctions() {
}

std::string App::getDisplayName() const {
return impl->displayName;
return impl ? impl->displayName : "";
}

void App::setDisplayName(const std::string& displayName) {
Expand Down
2 changes: 1 addition & 1 deletion src/jngl/Vec2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Vec2 {
/// returns true if both x and y are exactly 0
bool isNull() const;

/// rotates the vector clock-wise
/// rotates the vector clock-wise by \a angle (radian)
void rotate(float angle);

/// Helper function to use with cereal or Boost.Serialization
Expand Down
3 changes: 3 additions & 0 deletions src/jngl/window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
namespace jngl {

/// Creates the main window
///
/// If you haven't set a display name for your app using AppParameters::displayName, \a title will
/// set for the display name.
void showWindow(const std::string& title, int width, int height, bool fullscreen = false,
std::pair<int, int> minAspectRatio = { 4, 3 },
std::pair<int, int> maxAspectRatio = { 16, 9 });
Expand Down
3 changes: 3 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ void showWindow(const std::string& title, const int width, const int height, boo
throw std::runtime_error("Height Is 0");
}
pWindow.Set(new Window(title, width, height, fullscreen, minAspectRatio, maxAspectRatio));
if (App::instance().getDisplayName().empty()) {
App::instance().setDisplayName(title);
}
pWindow->SetMouseVisible(isMouseVisible);
setAntiAliasing(antiAliasingEnabled);
pWindow->initGlObjects();
Expand Down

0 comments on commit 459a251

Please sign in to comment.