GameEngine::GameEngine( const std::string& title, const unsigned int width, const unsigned int height, const unsigned int bpp, const bool fullscreen ) : m_resume( false ), m_running( false ), m_fullscreen( fullscreen ) { int flags = 0; if( fullscreen ) flags = sf::Style::Fullscreen; else flags = sf::Style::Default; // Create render window screen.create( sf::VideoMode( width, height, bpp ), title, flags, sf::ContextSettings::ContextSettings(0,0,8,0,0) ); screen.setFramerateLimit( 30 ); sf::Vector2f center(400,300); sf::Vector2f halfsize(800,600); sf::View screenView(center,halfsize); // Set the view screen.setView(screenView); std::cout << "GameEngine Init" << std::endl; }
void CMatCanvas::Create(CWnd* parent,CRect pos,UINT in_winId) { const char* cName = AfxRegisterWndClass(CS_OWNDC | CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNCLIENT, ::LoadCursor(NULL,IDC_ARROW)); Base::Create(cName, "Canvas" ,WS_VISIBLE, pos, parent, in_winId,NULL); // DMMSOLID added point Point2I temp(0,0); GFXCDSSurface::create(m_pSurface, TRUE, pos.Width(), pos.Height(), GetSafeHwnd(), &temp); RectI screenView(Point2I(0,0),Point2I(pos.Width()-1, pos.Height()-1)); // double max_dim = (pos.Width() > pos.Height()) ? (double)pos.Width() : (double)pos.Height(); // RectF worldView(Point2F(-pos.Width()/max_dim, pos.Height()/max_dim), // Point2F(pos.Width()/max_dim, -pos.Height()/max_dim)); RectF worldView(Point2F(0, 0), Point2F(pos.Width(), pos.Height())); m_pTSCamera = new TSPerspectiveCamera(screenView, worldView, 1.F, 1.0E4f); m_renderContext->setSurface(m_pSurface); m_renderContext->setPointArray(&DefaultPointArray); m_renderContext->setCamera(m_pTSCamera); m_renderContext->setLights(m_GSceneLights); m_renderContext->getSurface()->setHazeSource(GFX_HAZE_NONE); // m_renderContext->getSurface()->setShadeSource(GFX_SHADE_NONE); m_renderContext->getSurface()->setAlphaSource(GFX_ALPHA_NONE); m_renderContext->getSurface()->setTransparency(FALSE); }
void DisplayManager::DrawThisOnly (DISPLAY_INT x, DISPLAY_INT y, WebGraphics *gc) { DISPLAY_INT scrollLeft = (mpHScroll)? mpHScroll->GetPosition() : mViewRect.left; DISPLAY_INT scrollTop = (mpVScroll)? mpVScroll->GetPosition() : mViewRect.top; mViewRect.MoveTo(scrollLeft, scrollTop); WebRect padding; GetPaddingWidth(&padding); // find our viewport rect in screen coordinates WebRect screenRect(mRect); screenRect.MoveTo(x,y); WebRect screenView(screenRect); screenView.Shift(padding.left, padding.top); screenView.SizeTo(mViewRect.Width(), mViewRect.Height()); WebRect saveClip; gc->GetClip(&saveClip); WebRect screenDirty(screenView); if (saveClip.Overlaps(&screenDirty)) { screenDirty.And(&saveClip); #ifdef WEBC_BUFFER_SCROLLING if ((GetManagerFlags() & MANAGER_FLAG_BUFFER_SCROLL) && mScrollBuffer) { if (GetManagerFlags() & MANAGER_FLAG_BUFFER_DIRTY) { UpdateScrollBuffer(); } // instead of invoking the Draw method of mRoot, just copy the contents of the // buffer at this location. gc->CopyBufferRegion ( &screenDirty, mScrollBuffer, screenDirty.left - screenView.left + (mViewRect.left % mViewRect.Width()), screenDirty.top - screenView.top + (mViewRect.top % mViewRect.Height())); } else { #endif gc->SetClip(&screenDirty); if (mRoot.Get()) { mRoot.Get()->Draw(screenView.left + mRoot.Get()->mRect.left - scrollLeft, screenView.top + mRoot.Get()->mRect.top - scrollTop, &screenView, gc); } #ifdef WEBC_BUFFER_SCROLLING } #endif gc->SetClip(&saveClip); } // draw the little gray rectangle if (mpVScroll && mpHScroll && webc_GetDefaultBoolean(WEBC_DEFAULT_DRAW_SCROLL_CORNER)) { WebRect box; WebColor c = gc->RGBToColor(webc_GetDefaultColor(WEBC_DEFAULT_SCROLL_CORNER_COLOR)); box.SetSizeAndPosition(screenView.right + 1, screenView.bottom + 1, mpVScroll->Width(), mpHScroll->Height()); gc->Rectangle(&box, c, c, 1); } }