JNGL
other.hpp
Go to the documentation of this file.
1 // Copyright 2014-2020 Jan Niklas Hasse <[email protected]>
2 // For conditions of distribution and use, see copyright notice in LICENSE.txt
4 #pragma once
5 
6 #include <sstream>
7 #include <string>
8 #include <vector>
9 
10 namespace jngl {
11 
13 bool running();
14 
16 void updateInput();
17 
19 void swapBuffers();
20 
22 void quit();
23 
25 void cancelQuit();
26 
27 double getFPS();
28 
30 unsigned int getStepsPerSecond();
31 
33 void setStepsPerSecond(unsigned int);
34 
35 [[deprecated]] void readPixel(int x, int y, unsigned char& red, unsigned char& green,
36  unsigned char& blue);
37 
38 void setAntiAliasing(bool enabled);
39 
40 bool getAntiAliasing();
41 
42 void setVerticalSync(bool enabled);
43 
44 bool getVerticalSync();
45 
47 void setIcon(const std::string& filename);
48 
49 void setPrefix(const std::string& path);
50 
51 std::string getPrefix();
52 
53 void setConfigPath(const std::string& path);
54 
61 
64 
65 void setArgs(std::vector<std::string>);
66 
69 
72 
81 
88 void writeConfig(const std::string& key, const std::string& value);
89 
90 } // namespace jngl
jngl::readConfig
std::string readConfig(const std::string &key)
Read in a configuration value which has been saved under key.
sstream
std::string
jngl::setStepsPerSecond
void setStepsPerSecond(unsigned int)
How many times Work::step should be called per second (default: 60)
jngl::writeConfig
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)
vector
std::stringstream
jngl::getArgs
std::vector< std::string > getArgs()
Returns the command line arguments passed to the executable.
jngl::cancelQuit
void cancelQuit()
Undo quit() or ignore a quit event caused by the user closing the main window.
jngl
JNGL's main namespace.
Definition: App.hpp:9
jngl::getConfigPath
std::string getConfigPath()
Returns the directory where to store configuration files and save games.
jngl::getBinaryPath
std::string getBinaryPath()
Returns the directory of the currently running binary.
jngl::getStepsPerSecond
unsigned int getStepsPerSecond()
How many times Work::step is called per second (default: 60)
jngl::setIcon
void setIcon(const std::string &filename)
Sets the icon for the window (Desktop-only). Only works with PNG files for now.
jngl::quit
void quit()
Emit a quit event which will exit App::mainLoop() and set running() to false.
jngl::running
bool running()
Returns true until the main window is closed or quit() has been called.
jngl::readAsset
std::stringstream readAsset(const std::string &filename)
Returns a stringstream containing the whole file. This will read from the .apk on Android.
jngl::updateInput
void updateInput()
Updates the input state. App::mainLoop() calls this before Work::step()
jngl::swapBuffers
void swapBuffers()
Swaps back and front buffer. App::mainLoop() calls this after Work::draw()
string