@jpetrie sorry, still not clear ^_^' I guess I am missing the bigger structure here, where everything is placed in comparison to everything else, like in which header is this function compared to who calls it, where are the things result is builted with taken from and how you reach them and so on...
SomeThing& getSomeThing()
{
static SomeThing result(value, of, some, thing);
return result;
}
so this above is the function.
So from what I am understanding, in practice would look something like this, and it will live in the Global.h:
Global.h
#include "App.h"
#include "SDL2\SDL.h"
struct AppInfo {
App* App;
GameMode* Game;
SDL_Window* Window;
SDL_Renderer* Renderer;
Uint32 Width, Height;
};
AppInfo& GetAppInfo()
{
static AppInfo result{MyApp.GetApp(), MyApp.GetGame(), MyApp.GetWindow(), MyApp.GetRenderer(), MyApp.GetWinWidth(), MyApp.GetWinHeight()};
return result;
}
But the problem is, when is that static initialized?! If it is when I run the program, then App wouldn't be initialized yet... is that the case? If so, then I still don't get it how to do it...
Furthermore, where is this "App MyApp" global object created and initialized, I mean where is living? :\
The example is still too abstract for my brain, the problem is I can't see the entire structure pattern here... :\