SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
App.h
Go to the documentation of this file.
1 /**
2  * \file App.h
3  * \brief The App namespace declares the App::Config struct and the App::run function.
4  * \details An App::Config can be passed to the run function defined
5  * Beside this is contains the callback functions typedefs.
6  * For more info on how to create a new app with SLProject see:
7  * https://github.com/cpvrlab/SLProject4/wiki/Creating-a-New-App
8  * For more info about App framework see:
9  * https://cpvrlab.github.io/SLProject4/app-framework.html
10  * \date June 2024
11  * \authors Marino von Wattenwyl
12  * \copyright http://opensource.org/licenses/GPL-3.0
13  * \remarks Please use clangformat to format the code. See more code style on
14  * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
15  */
16 
17 #ifndef APP_H
18 #define APP_H
19 
20 #include <SL.h>
21 #include <SLEnums.h>
22 
23 #ifndef SL_OS_ANDROID
24 # define SL_MAIN_FUNCTION main
25 #else
26 # define SL_MAIN_FUNCTION slAndroidMain
27 #endif
28 
29 //-----------------------------------------------------------------------------
30 class SLScene;
31 class SLSceneView;
32 class SLInputManager;
33 //-----------------------------------------------------------------------------
34 //! The App namespace declares the App::Config struct and the App::run function
35 /*! An App::Config can be passed to the run function defined.
36  Beside this is contains the callback functions typedefs.
37  For more info on how to create a new app with SLProject see:
38  https://github.com/cpvrlab/SLProject4/wiki/Creating-a-New-App
39  For more info about App framework see:
40  https://cpvrlab.github.io/SLProject4/app-framework.html
41  */
42 namespace App
43 {
44 typedef SLSceneView* (*OnNewSceneViewCallback)(SLScene* scene, int curDPI, SLInputManager& inputManager);
45 typedef SLScene* (*OnNewSceneCallback)(SLSceneID sceneID);
50 typedef bool (*OnUpdateCallback)(SLSceneView* sv);
52 typedef void (*OnGuiLoadConfigCallback)(SLint dotsPerInch);
54 
55 //! App configuration struct to be passed to the App::run function
56 struct Config
57 {
58  int argc = 0;
59  char** argv = nullptr;
62  SLstring windowTitle = "SLProject Application";
75 };
76 
77 int run(Config config);
78 
79 extern Config config;
80 };
81 //-----------------------------------------------------------------------------
82 
83 #endif
string SLstring
Definition: SL.h:158
int SLint
Definition: SL.h:170
int SLSceneID
Scene identifier.
Definition: SLEnums.h:91
constexpr SLSceneID SL_EMPTY_SCENE_ID
SLSceneID for an empty scene.
Definition: SLEnums.h:94
typedef void(SL_STDCALL *cbOnImGuiBuild)(SLScene *s
Callback function typedef for ImGui build function.
SLSceneView * sv
Definition: SLGLImGui.h:28
SLScene * s
Definition: SLScene.h:31
SLScene SLSceneView SLint sceneID
Definition: SLScene.h:33
SLInputManager. manages system input and custom input devices.
The SLScene class represents the top level instance holding the scene structure.
Definition: SLScene.h:47
SceneView class represents a dynamic real time 3D view onto the scene.
Definition: SLSceneView.h:69
The App namespace declares the App::Config struct and the App::run function.
Definition: App.h:43
SLScene *(* OnNewSceneCallback)(SLSceneID sceneID)
Definition: App.h:45
void(* OnAfterSceneAssemblyCallback)(SLSceneView *sv, SLScene *s)
Definition: App.h:49
SLSceneView *(* OnNewSceneViewCallback)(SLScene *scene, int curDPI, SLInputManager &inputManager)
Definition: App.h:44
int run(Config config)
App::run implementation from App.h for the Emscripten platform.
Definition: AppAndroid.cpp:78
void(* OnGuiSaveConfigCallback)()
Definition: App.h:53
void(* OnBeforeSceneLoadCallback)(SLSceneView *sv, SLScene *s)
Definition: App.h:47
Config config
The configuration set in App::run.
Definition: AppAndroid.cpp:34
void(* OnBeforeSceneDeleteCallback)(SLSceneView *sv, SLScene *s)
Definition: App.h:46
bool(* OnUpdateCallback)(SLSceneView *sv)
Definition: App.h:50
void(* OnGuiBuildCallback)(SLScene *s, SLSceneView *sv)
Definition: App.h:51
void(* OnBeforeSceneAssemblyCallback)(SLSceneView *sv, SLScene *s)
Definition: App.h:48
void(* OnGuiLoadConfigCallback)(SLint dotsPerInch)
Definition: App.h:52
App configuration struct to be passed to the App::run function.
Definition: App.h:57
OnGuiLoadConfigCallback onGuiLoadConfig
Definition: App.h:73
OnAfterSceneAssemblyCallback onAfterSceneAssembly
Definition: App.h:70
SLSceneID startSceneID
Definition: App.h:64
SLint windowWidth
Definition: App.h:60
SLint windowHeight
Definition: App.h:61
OnNewSceneViewCallback onNewSceneView
Definition: App.h:65
OnUpdateCallback onUpdate
Definition: App.h:71
OnBeforeSceneAssemblyCallback onBeforeSceneAssembly
Definition: App.h:69
OnGuiSaveConfigCallback onGuiSaveConfig
Definition: App.h:74
OnNewSceneCallback onNewScene
Definition: App.h:66
SLint numSamples
Definition: App.h:63
OnGuiBuildCallback onGuiBuild
Definition: App.h:72
int argc
Definition: App.h:58
OnBeforeSceneLoadCallback onBeforeSceneLoad
Definition: App.h:68
OnBeforeSceneDeleteCallback onBeforeSceneDelete
Definition: App.h:67
char ** argv
Definition: App.h:59
SLstring windowTitle
Definition: App.h:62