JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
Namespaces | Functions
other.hpp File Reference

Miscellaneous functions. More...

#include <sstream>
#include <string>
#include <vector>
Include dependency graph for other.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  jngl
 JNGL's main namespace.
 

Functions

bool running ()
 Returns true until the main window is closed or quit() has been called.
 
void updateInput ()
 Updates the input state.
 
void swapBuffers ()
 Swaps back and front buffer.
 
void clearBackBuffer ()
 Clears the back buffer and resets the ModelView matrix, see jngl::reset()
 
bool canQuit ()
 Some platforms (e.g.
 
void quit () noexcept
 Emit a quit event which will exit App::mainLoop() and set running() to false.
 
void cancelQuit ()
 Undo quit() or ignore a quit event caused by the user closing the main window.
 
double getFPS ()
 Calculates FPS if called once per frame.
 
unsigned int getStepsPerSecond ()
 How many times Work::step is called per second (default: 60)
 
void setStepsPerSecond (unsigned int)
 How many times Work::step should be called per second (default: 60)
 
void setAntiAliasing (bool enabled)
 Toggles Multisample anti-aliasing (MSAA)
 
bool getAntiAliasing ()
 Returns whether MSAA is enabled. If the device doesn't support it, it will always return false.
 
void setVerticalSync (bool enabled)
 Toggles V-SYNC.
 
bool getVerticalSync ()
 Returns whether V-SYNC is enabled. Many devices always enable V-SYNC with no way to turn it off.
 
void setIcon (const std::string &filename)
 Sets the icon for the window (Desktop-only)
 
void setPrefix (const std::string &path)
 Sets a global prefix which will be prepended whenever images or sounds are loaded.
 
std::string getPrefix ()
 Returns the global prefix set by jngl::setPrefix.
 
void setConfigPath (const std::string &path)
 
std::string getConfigPath ()
 
std::string getBinaryPath ()
 Returns the directory of the currently running binary.
 
void setArgs (std::vector< std::string >)
 Called by JNGL_MAIN_BEGIN to set command line arguments.
 
std::vector< std::stringgetArgs ()
 Returns the command line arguments passed to the executable.
 
std::stringstream readAsset (const std::string &filename)
 Returns a stringstream containing the whole file. This will read from the .apk on Android.
 
std::string readConfig (const std::string &key)
 Read in a configuration value which has been saved under key.
 
void writeConfig (const std::string &key, const std::string &value)
 Write value into the persistent storage which can be read in again using jngl::readConfig(key)
 
std::string getPreferredLanguage ()
 Returns user preferred language, i.e. "en" for English, "de" for German.
 
void openURL (const std::string &)
 Opens a link (e.g. https://bixense.com) in the browser.
 
int round (double v)
 Rounds a double to an integer, just like std::lround.
 
std::string getConfigPath ()
 Returns the directory where to store configuration files and save games.
 

Detailed Description

Miscellaneous functions.

Definition in file other.hpp.

Function Documentation

◆ getConfigPath()

std::string getConfigPath ( )

Returns the directory where to store configuration files and save games.

  • Windows: %AppData%/Display Name/
  • Linux: ~/.config/Display Name/
  • macOS: ~/Library/Application Support/Display Name/
  • Android/iOS: Data path provided by the OS