MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / EmbeddedMain

Function EmbeddedMain

Tests/PlayPen/src/WindowEmbedding.cpp:132–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130
131
132INT WINAPI EmbeddedMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
133{
134 try
135 {
136 // Create a new window
137
138 // Style & size
139 DWORD dwStyle = WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW;
140
141 // Register the window class
142 WNDCLASS wc = { 0, TestWndProc, 0, 0, hInst,
143 LoadIcon(0, IDI_APPLICATION), LoadCursor(NULL, IDC_ARROW),
144 (HBRUSH)GetStockObject(BLACK_BRUSH), 0, "TestWnd" };
145 RegisterClass(&wc);
146
147 HWND hwnd = CreateWindow("TestWnd", "Test embedding", dwStyle,
148 0, 0, 800, 600, 0, 0, hInst, 0);
149
150 Root root("", "");
151
152 root.loadPlugin("RenderSystem_GL");
153 //root.loadPlugin("RenderSystem_Direct3D9");
154 root.loadPlugin("Plugin_ParticleFX");
155 root.loadPlugin("Plugin_CgProgramManager");
156
157 // select first renderer & init with no window
158 root.setRenderSystem(*(root.getAvailableRenderers().begin()));
159 root.initialise(false);
160
161 // create first window manually
162 NameValuePairList options;
163 options["externalWindowHandle"] =
164 StringConverter::toString((size_t)hwnd);
165
166 renderWindow = root.createRenderWindow("embedded", 800, 600, false, &options);
167
168 setupResources();
169 ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
170
171 SceneManager *scene = root.createSceneManager(Ogre::ST_GENERIC, "default");
172
173
174 Camera *cam = scene->createCamera("cam");
175
176
177 Viewport* vp = renderWindow->addViewport(cam);
178 vp->setBackgroundColour(Ogre::ColourValue(0.5, 0.5, 0.7));
179 cam->setAutoAspectRatio(true);
180 cam->setPosition(0,0,300);
181 cam->setDirection(0,0,-1);
182
183 Entity* e = scene->createEntity("1", "ogrehead.mesh");
184 scene->getRootSceneNode()->createChildSceneNode()->attachObject(e);
185 Light* l = scene->createLight("l");
186 l->setPosition(300, 100, -100);
187
188 // message loop
189 MSG msg;

Callers

nothing calls this directly

Calls 15

setupResourcesFunction · 0.85
GetMessageFunction · 0.85
loadPluginMethod · 0.80
createRenderWindowMethod · 0.80
setAutoAspectRatioMethod · 0.80
createEntityMethod · 0.80
attachObjectMethod · 0.80
createChildSceneNodeMethod · 0.80
getRootSceneNodeMethod · 0.80
toStringFunction · 0.50
ColourValueClass · 0.50
setRenderSystemMethod · 0.45

Tested by

no test coverage detected