JNGL
App.hpp
Go to the documentation of this file.
1 // Copyright 2019 Jan Niklas Hasse <[email protected]>
2 // For conditions of distribution and use, see copyright notice in LICENSE.txt
4 #pragma once
5 
6 #include <memory>
7 #include <string>
8 
9 namespace jngl {
10 
24 class App {
25 public:
26  explicit App(std::string displayName);
27  ~App();
28  App(const App&) = delete;
29  App& operator=(const App&) = delete;
30  App(App&&) = delete;
31  App& operator=(App&&) = delete;
32 
34  static const App& instance();
35 
38  [[nodiscard]] std::string getDisplayName() const;
39 
41  void mainLoop();
42 
46  void setPixelArt(bool);
47 
49  static bool isPixelArt();
50 
51 private:
52  struct Impl;
54 
55  static App* self;
56 };
57 
58 } // namespace jngl
std::string
jngl::App::getDisplayName
std::string getDisplayName() const
Returns the name set by the constructor.
jngl
JNGL's main namespace.
Definition: App.hpp:9
jngl::App::instance
static const App & instance()
Access the instance, throws std::runtime_error if it doesn't exist.
jngl::App::isPixelArt
static bool isPixelArt()
If pixel-perfect magnifying is activated (see setPixelArt)
jngl::App
There can only be one instance of this class which should be created before the window is shown.
Definition: App.hpp:24
jngl::App::mainLoop
void mainLoop()
Starts the main loop, which calls jngl::Work::step and jngl::Work::draw.
memory
jngl::App::setPixelArt
void setPixelArt(bool)
Activates pixel-perfect magnifying of textures (nearest-neighbor interpolation)
std::unique_ptr< Impl >
string