MCPcopy Create free account
hub / github.com/TheRealMJP/BakingLab / Run

Method Run

SampleFramework11/v1.02/App.cpp:52–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52int32 App::Run()
53{
54 try
55 {
56 if(createConsole)
57 {
58 Win32Call(AllocConsole());
59 Win32Call(SetConsoleTitle(applicationName.c_str()));
60 FILE* consoleFile = nullptr;
61 freopen_s(&consoleFile, "CONOUT$", "wb", stdout);
62 }
63
64 window.SetClientArea(deviceManager.BackBufferWidth(), deviceManager.BackBufferHeight());
65 deviceManager.Initialize(window);
66
67 if(showWindow)
68 window.ShowWindow();
69
70 blendStates.Initialize(deviceManager.Device());
71 rasterizerStates.Initialize(deviceManager.Device());
72 depthStencilStates.Initialize(deviceManager.Device());
73 samplerStates.Initialize(deviceManager.Device());
74
75 // Create a font + SpriteRenderer
76 font.Initialize(L"Arial", 18, SpriteFont::Regular, true, deviceManager.Device());
77 spriteRenderer.Initialize(deviceManager.Device());
78
79 Profiler::GlobalProfiler.Initialize(deviceManager.Device(), deviceManager.ImmediateContext());
80
81 window.RegisterMessageCallback(WM_SIZE, OnWindowResized, this);
82
83 // Initialize AntTweakBar
84 TwCall(TwInit(TW_DIRECT3D11, deviceManager.Device()));
85
86 // Create a tweak bar
87 tweakBar = TwNewBar("Settings");
88 std::string helpTextDefinition = MakeAnsiString(" GLOBAL help='%s' ", globalHelpText.c_str());
89 TwCall(TwDefine(helpTextDefinition.c_str()));
90 TwCall(TwDefine(" GLOBAL fontsize=3 "));
91
92 Settings.Initialize(tweakBar);
93
94 TwHelper::SetValuesWidth(Settings.TweakBar(), 120, false);
95
96 AppSettings::Initialize(deviceManager.Device());
97
98 Initialize();
99
100 AfterReset();
101
102 while(window.IsAlive())
103 {
104 if(!window.IsMinimized())
105 {
106 timer.Update();
107 Settings.Update();
108
109 CalculateFPS();

Callers 1

wWinMainFunction · 0.45

Calls 15

Win32CallFunction · 0.85
TwCallFunction · 0.85
MakeAnsiStringFunction · 0.85
SetValuesWidthFunction · 0.85
InitializeFunction · 0.85
UpdateFunction · 0.85
UpdateShadersFunction · 0.85
UpdateCBufferFunction · 0.85
ShutdownShadersFunction · 0.85
SetClientAreaMethod · 0.80
BackBufferWidthMethod · 0.80
BackBufferHeightMethod · 0.80

Tested by

no test coverage detected