JNGL
other.hpp
Go to the documentation of this file.
1 // Copyright 2014-2021 Jan Niklas Hasse <[email protected]>
2 // For conditions of distribution and use, see copyright notice in LICENSE.txt
5 #pragma once
6 
7 #include <sstream>
8 #include <string>
9 #include <vector>
10 
11 namespace jngl {
12 
14 bool running();
15 
17 void updateInput();
18 
22 void swapBuffers();
23 
28 
30 void quit();
31 
33 void cancelQuit();
34 
38 [[deprecated("Not really intuitive or robust, use your own calculations instead")]] double getFPS();
39 
41 unsigned int getStepsPerSecond();
42 
44 void setStepsPerSecond(unsigned int);
45 
46 void setAntiAliasing(bool enabled);
47 
48 bool getAntiAliasing();
49 
50 void setVerticalSync(bool enabled);
51 
52 bool getVerticalSync();
53 
55 void setIcon(const std::string& filename);
56 
57 void setPrefix(const std::string& path);
58 
59 std::string getPrefix();
60 
61 void setConfigPath(const std::string& path);
62 
70 [[deprecated("use jngl::writeConfig and jngl::readConfig instead")]] std::string getConfigPath();
71 
74 
75 void setArgs(std::vector<std::string>);
76 
79 
82 
91 
98 void writeConfig(const std::string& key, const std::string& value);
99 
102 
103 } // namespace jngl
JNGL's main namespace.
Definition: App.hpp:10
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.
std::string getBinaryPath()
Returns the directory of the currently running binary.
void clearBackBuffer()
Clears the back buffer and resets the ModelView matrix, see jngl::reset()
std::string getPreferredLanguage()
Returns user preferred language, i.e. "en" for English, "de" for German.
void updateInput()
Updates the input state. App::mainLoop() calls this before Work::step()
void quit()
Emit a quit event which will exit App::mainLoop() and set running() to false.
std::stringstream readAsset(const std::string &filename)
Returns a stringstream containing the whole file. This will read from the .apk on Android.
void setIcon(const std::string &filename)
Sets the icon for the window (Desktop-only). Only works with PNG files for now.
unsigned int getStepsPerSecond()
How many times Work::step is called per second (default: 60)
void swapBuffers()
Swaps back and front buffer.
bool running()
Returns true until the main window is closed or quit() has been called.
std::vector< std::string > getArgs()
Returns the command line arguments passed to the executable.
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 getConfigPath()
void setStepsPerSecond(unsigned int)
How many times Work::step should be called per second (default: 60)