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

Include this file only once, as it defines the main function. More...

#include "AppParameters.hpp"
#include "main.hpp"
#include "message.hpp"
#include <cmath>
Include dependency graph for init.hpp:

Go to the source code of this file.

Namespaces

namespace  jngl
 JNGL's main namespace.
 

Functions

void mainLoop (AppParameters)
 
jngl::AppParameters jnglInit ()
 Implement this function and set AppParameters::start. More...
 
int main (int argc, char **argv)
 

Detailed Description

Include this file only once, as it defines the main function.

Definition in file init.hpp.

Function Documentation

◆ jnglInit()

jngl::AppParameters jnglInit ( )

Implement this function and set AppParameters::start.

Usually you'd want to do this in a file called e.g. main.cpp:

#include "MyGame.hpp" // class that derives from jngl::Work
#include <jngl/init.hpp>
params.displayName = "My Game";
params.screenSize = { 1920, 1080 };
params.start = []() {
return std::make_shared<MyGame>();
};
return params;
}
Include this file only once, as it defines the main function.
jngl::AppParameters jnglInit()
Implement this function and set AppParameters::start.
Parameters used to initialize the main window.
std::function< std::shared_ptr< jngl::Work >()> start
A factory function which creates the first jngl::Work.
std::string displayName
Display name of the application which will be used in the window title for example.
std::optional< jngl::Vec2 > screenSize
Size of the canvas in screen pixels, see jngl::getScreenSize()

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 46 of file init.hpp.