MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / createWindow

Method createWindow

Engine/source/windowManager/win32/win32WindowMgr.cpp:209–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209PlatformWindow *Win32WindowManager::createWindow(GFXDevice *device, const GFXVideoMode &mode)
210{
211 // Do the allocation.
212 Win32Window *w32w = new Win32Window();
213 w32w->setOffscreenRender(mOffscreenRender);
214 w32w->mWindowId = getNextId();
215 w32w->mOwningManager = this;
216
217 // Link into our list of windows.
218 linkWindow(w32w);
219
220 DWORD dwExStyle;
221 DWORD dwStyle = WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
222 dwStyle |= WS_OVERLAPPEDWINDOW | WS_THICKFRAME | WS_CAPTION;
223 dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
224
225 // If we're parented, we want a different set of window styles.
226 if(mParentWindow)
227 dwStyle = WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CHILDWINDOW;
228
229 if (mOffscreenRender)
230 {
231 dwStyle = WS_OVERLAPPEDWINDOW;
232 dwExStyle = 0;
233 }
234
235 // Create the window handle
236 w32w->mWindowHandle = CreateWindowEx(
237 dwExStyle,
238 Win32Window::getWindowClassName(), //class name
239 String( getEngineProductString() ).utf16(), //window title
240 dwStyle, //style - need clip siblings/children for opengl
241 0,
242 0,
243 0,
244 0,
245 mParentWindow, //parent window
246 NULL, //menu? No.
247 NULL, //the hInstance
248 NULL ); //no funky params
249
250 // Note the style we created with so we can switch back to it when we're
251 // done with full-screen mode.
252 w32w->mWindowedWindowStyle = dwStyle;
253
254 // Set the video mode on the window
255 w32w->setVideoMode(mode);
256
257 // Associate our window struct with the HWND.
258 SetWindowLongPtr(w32w->mWindowHandle, GWLP_USERDATA, (LONG_PTR)w32w);
259
260 // Do some error checking.
261 AssertFatal(w32w->mWindowHandle != NULL, "Win32WindowManager::createWindow - Could not create window!");
262 if(w32w->mWindowHandle == NULL)
263 {
264 Con::errorf("Win32WindowManager::createWindow - Could not create window!");
265 delete w32w;
266 return NULL;

Callers

nothing calls this directly

Calls 10

getEngineProductStringFunction · 0.85
errorfFunction · 0.85
CloseSplashWindowFunction · 0.85
warnfFunction · 0.85
setOffscreenRenderMethod · 0.80
StringClass · 0.50
utf16Method · 0.45
setVideoModeMethod · 0.45
setDisplayWindowMethod · 0.45
allocWindowTargetMethod · 0.45

Tested by

no test coverage detected