| 130 | |
| 131 | |
| 132 | INT 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; |
nothing calls this directly
no test coverage detected