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

Functions related to the main window. More...

#include "Pixels.hpp"
#include <array>
#include <functional>
#include <string>
#include <vector>
Include dependency graph for window.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.
 

Enumerations

enum class  Cursor : uint8_t { ARROW , I }
 

Functions

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 })
 Creates the main window.
 
void hideWindow ()
 Cleans up the window and unloads everything.
 
void atExit (std::function< void()>)
 Call this function once when the window is hidden.
 
int getWindowWidth ()
 Returns the width of the window in actual pixels (i.e. ignoring jngl::getScaleFactor)
 
int getWindowHeight ()
 Returns the height of the window in actual pixels (i.e. ignoring jngl::getScaleFactor)
 
std::array< Pixels, 2 > getWindowSize ()
 Returns {width, height} of the window in actual pixels.
 
int getDesktopWidth ()
 Returns the width of the main display in actual pixels.
 
int getDesktopHeight ()
 Returns the height of the main display in actual pixels.
 
bool getFullscreen ()
 If the window is displayed fullscreen (always true on mobile devices)
 
void setFullscreen (bool)
 Toggle fullscreen window mode.
 
void setTitle (const std::string &title)
 Sets the main window title.
 
void setCursor (Cursor)
 
std::vector< float > readPixels ()
 Read red, green and blue values of the whole window frame buffer.
 

Detailed Description

Functions related to the main window.

Definition in file window.hpp.