本文整理汇总了C++中WindowPtr类的典型用法代码示例。如果您正苦于以下问题:C++ WindowPtr类的具体用法?C++ WindowPtr怎么用?C++ WindowPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WindowPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: EventCallbackPtr
void
Statistic::realize() {
Transform::realize();
WindowPtr myWindow = boost::static_pointer_cast<spark::Window>(getRoot());
StatisticPtr ptr = boost::static_pointer_cast<Statistic>(shared_from_this());
spark::EventCallbackPtr myFrameCB = EventCallbackPtr(new StatisticCB(ptr, &Statistic::onFrame));
myWindow->addEventListener(StageEvent::FRAME, myFrameCB);
int myStatisticHeight = 0;
ContainerPtr myContainer = boost::static_pointer_cast<spark::Container>(shared_from_this());
ComponentPtr myCreated = SparkComponentFactory::get().loadSparkComponentsFromString(myContainer->getApp(),
"<Text name=\"fps\" y=\"-10\" maxWidth=\"0\" z=\"100\" text=\"fps:\" height=\"-16\" color=\"[1.0,0.0,0.0, 1.0]\" fontsize=\"16\"/>");
myContainer->addChild(myCreated);
_myFPSText = boost::static_pointer_cast<spark::Text>(myCreated);
myCreated = SparkComponentFactory::get().loadSparkComponentsFromString(myContainer->getApp(),
"<Text name=\"memory_usage\" y=\"-30\" z=\"100\" maxWidth=\"0\" text=\"memory:\" height=\"-16\" color=\"[1.0,0.0,0.0, 1.0]\" fontsize=\"16\"/>");
myContainer->addChild(myCreated);
_myMemoryText = boost::static_pointer_cast<spark::Text>(myCreated);
myStatisticHeight += _myFPSText->getTextSize()[1];
myCreated = SparkComponentFactory::get().loadSparkComponentsFromString(myContainer->getApp(),
"<Text name=\"battery_level\" y=\"-50\" z=\"100\" maxWidth=\"0\" text=\"memory:\" height=\"-16\" color=\"[1.0,0.0,0.0, 1.0]\" fontsize=\"16\"/>");
myContainer->addChild(myCreated);
_myBatteryLevelText = boost::static_pointer_cast<spark::Text>(myCreated);
myStatisticHeight += _myFPSText->getTextSize()[1];
setY(myWindow->getSize()[1] - myStatisticHeight);
setX(10);
}
开发者ID:artcom,项目名称:mobile-spark,代码行数:33,代码来源:Statistic.cpp
示例2: renderWindow
void Canvas::renderWindow(WindowPtr pWindow, MCFBOPtr pFBO, const IntRect& viewport)
{
GLContext* pContext = pWindow->getGLContext();
pContext->activate();
GLContextManager::get()->uploadDataForContext();
renderFX(pContext);
glm::mat4 projMat;
if (pFBO) {
pFBO->activate(pContext);
glm::vec2 size = m_pRootNode->getSize();
projMat = glm::ortho(0.f, size.x, 0.f, size.y);
glViewport(0, 0, GLsizei(size.x), GLsizei(size.y));
} else {
glproc::BindFramebuffer(GL_FRAMEBUFFER, 0);
projMat = glm::ortho(float(viewport.tl.x), float(viewport.br.x),
float(viewport.br.y), float(viewport.tl.y));
IntPoint windowSize = pWindow->getSize();
glViewport(0, 0, windowSize.x, windowSize.y);
}
{
ScopeTimer Timer(VATransferProfilingZone);
m_pVertexArray->update(pContext);
}
clearGLBuffers(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT,
!pFBO);
GLContext::checkError("Canvas::renderWindow: glViewport()");
m_pVertexArray->activate(pContext);
{
ScopeTimer timer(RootRenderProfilingZone);
m_pRootNode->maybeRender(pContext, projMat);
}
renderOutlines(pContext, projMat);
}
开发者ID:eladm29,项目名称:libavg,代码行数:34,代码来源:Canvas.cpp
示例3: main
int main(int argc, char** argv)
{
css::CSSStyleSheet defaultStyleSheet;
Document document;
// Load the default CSS file
if (1 < argc) {
std::ifstream stream(argv[1]);
if (!stream) {
std::cerr << "error: cannot open " << argv[1] << ".\n";
return EXIT_FAILURE;
}
defaultStyleSheet = loadStyleSheet(stream);
getDOMImplementation()->setDefaultStyleSheet(defaultStyleSheet);
}
document = loadDocument(htmlDocument);
assert(document);
// create the default view
WindowPtr window = std::make_shared<WindowImp>();
window->setDocument(std::static_pointer_cast<bootstrap::DocumentImp>(document.self()));
ViewCSSImp* view = new ViewCSSImp(window);
view->constructComputedStyles();
view->calculateComputedStyles();
printComputedValues(document, view);
std::cout << "done.\n";
return 0;
}
开发者ID:UIKit0,项目名称:escudo,代码行数:30,代码来源:CSSStyle.test.cpp
示例4: createAsTexture
TexturePtr LinearGradient::createAsTexture(int width, int height)
{
const float w = static_cast<float>(width);
const float h = static_cast<float>(height);
const float sa = std::abs(std::sin(-angle_ / 180.0f * static_cast<float>(M_PI)));
const float ca = std::abs(std::cos(-angle_ / 180.0f * static_cast<float>(M_PI)));
//const float length = std::min(ca < FLT_EPSILON ? FLT_MAX : width / ca, sa < FLT_EPSILON ? FLT_MAX : height / sa);
//const float length = std::min(ca < FLT_EPSILON ? w : 2.0f * ca * w, sa < FLT_EPSILON ? h : 2.0f * sa * h);
WindowPtr wnd = WindowManager::getMainWindow();
CameraPtr cam = std::make_shared<Camera>("ortho_lg", 0, width, 0, height);
auto grad = createRenderable();
grad->setCamera(cam);
grad->setScale(ca < FLT_EPSILON ? w : 2.0f * w / ca, sa < FLT_EPSILON ? h : 2.0f * h / sa);
grad->setPosition(w/2.0f, h/2.0f);
RenderTargetPtr rt = RenderTarget::create(width, height);
rt->getTexture()->setFiltering(-1, Texture::Filtering::LINEAR, Texture::Filtering::LINEAR, Texture::Filtering::POINT);
rt->getTexture()->setAddressModes(-1, Texture::AddressMode::CLAMP, Texture::AddressMode::CLAMP);
rt->setCentre(Blittable::Centre::TOP_LEFT);
rt->setClearColor(Color(0,0,0,0));
{
RenderTarget::RenderScope rs(rt, rect(0, 0, width, height));
grad->preRender(wnd);
wnd->render(grad.get());
}
return rt->getTexture();
}
开发者ID:sweetkristas,项目名称:hex_test,代码行数:30,代码来源:Gradients.cpp
示例5: throw
void
SpinnerDialog::set_busy(bool busy) throw()
{
WindowPtr window = get_window();
if (0 == window)
{
return;
}
switch (busy)
{
case true:
{
Gdk::Cursor cursor(Gdk::WATCH);
window->set_cursor(cursor);
spinner_.start();
break;
}
case false:
{
window->set_cursor();
spinner_.stop();
break;
}
}
}
开发者ID:GNOME,项目名称:solang,代码行数:28,代码来源:spinner-dialog.cpp
示例6: _ptr
Window2D::Window2D(WindowPtr ptr) : _ptr(ptr)
{
_rend = SDL_CreateRenderer(_ptr->getSDLWindow(), -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
Image img(glm::ivec2(ptr->getWidth(), ptr->getHeight()));
SDL_SetRenderDrawColor(_rend, 0, 255, 255, 255);
SDL_RenderClear(_rend);
}
开发者ID:jetSett,项目名称:yage,代码行数:8,代码来源:Window2D.cpp
示例7: windowDestroyed
bool WindowManager::windowDestroyed(WindowPtr window)
{
if(mWindows.count(window->getName()) > 0) {
fireWindowEvent(WindowEvent::CLOSE, window->getWindowHandle());
mWindows.erase(window->getName());
return true;
}
return false;
}
开发者ID:gsage,项目名称:engine,代码行数:9,代码来源:WindowManager.cpp
示例8: createWindow
void WindowManager::createWindow(WindowPtr wnd)
{
wnd->createWindow();
// Add a weak_ptr to our window to the list of id versus windows.
get_window_list()[wnd->getWindowID()] = wnd;
// We consider the first window created the main one.
if(get_main_window().lock() == nullptr) {
get_main_window() = wnd;
}
}
开发者ID:sweetkristas,项目名称:render_engine,代码行数:11,代码来源:WindowManager.cpp
示例9: preRender
void MainCanvas::renderTree()
{
preRender();
DisplayEngine* pDisplayEngine = getPlayer()->getDisplayEngine();
unsigned numWindows = pDisplayEngine->getNumWindows();
for (unsigned i=0; i<numWindows; ++i) {
ScopeTimer Timer(RootRenderProfilingZone);
WindowPtr pWindow = pDisplayEngine->getWindow(i);
IntRect viewport = pWindow->getViewport();
renderWindow(pWindow, MCFBOPtr(), viewport);
}
GLContextManager::get()->reset();
}
开发者ID:derric,项目名称:libavg,代码行数:13,代码来源:MainCanvas.cpp
示例10: throw
WindowPtr WindowManager::FindWindow(LPCTSTR pszWindowName) throw()
{
// check root window
WindowPtr spWindow = m_spRootWindow;
if (spWindow->GetAttr(WindowAttr::Name) == pszWindowName)
return spWindow;
// since the root window is a Panel, ask it
std::shared_ptr<Panel> spPanel = std::dynamic_pointer_cast<Panel, Window>(spWindow);
ATLASSERT(spPanel != NULL);
return spPanel->FindByName(pszWindowName);
}
开发者ID:zengnotes,项目名称:MultiplayerOnlineGame,代码行数:14,代码来源:WindowManager.cpp
示例11: setWindow
void Canvas::setWindow(WindowPtr wnd)
{
window_ = wnd;
if(wnd) {
if(size_change_key_ >= 0) {
wnd->registerSizeChangeObserver(size_change_key_, [this](int w, int h) {
this->setDimensions(w, h);
});
} else {
size_change_key_ = wnd->registerSizeChangeObserver([this](int w, int h) {
this->setDimensions(w, h);
});
}
}
}
开发者ID:sweetkristas,项目名称:Castles,代码行数:15,代码来源:Canvas.cpp
示例12: _createWindowQmlItem
void DisplayGroupRenderer::_createWindowQmlItem(WindowPtr window)
{
const auto& id = window->getID();
auto sync = _context.provider.createSynchronizer(*window, _context.view);
_windowItems[id].reset(
new WindowRenderer(std::move(sync), std::move(window),
*_displayGroupItem, _qmlContext.get()));
}
开发者ID:BlueBrain,项目名称:Tide,代码行数:8,代码来源:DisplayGroupRenderer.cpp
示例13: display
// redraw the window
void display(void)
{
WindowPtr win = mgr->getWindow();
//mgr->redraw();
win->activate();
win->frameInit();
//RenderAction *rAct = (RenderAction*)mgr->getAction();
if (multipass)
{
RenderAction *rAct = RenderAction::create();
fbo_vp->setParent(win);
rAct->setWindow(get_pointer(win));
fbo_vp->render(rAct);
fbo_vp->setParent(NullFC);
delete rAct;
//multipass = false;
}
win->getPort(0)->render(dynamic_cast<RenderAction *>(mgr->getAction()));
//win->renderAllViewports(rAct);
win->swap();
win->frameExit();
win->deactivate();
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:35,代码来源:testFboVP.cpp
示例14: aproassert1
WindowPtr RenderingAPI::createWindow(const String& windowname, uint32_t width, uint32_t height, bool fullscreen)
{
aproassert1(width != 0 && height != 0 && !windowname.isEmpty());
APRO_THREADSAFE_AUTOLOCK
// Call the implementation to create the Window object.
WindowPtr retwin = _createWindowImpl(windowname, width, height, fullscreen);
if(!retwin) {
aprodebug("Couldn't create Appropriate Window !");
return WindowPtr::Null;
}
renderingtargets.append(retwin);
retwin->setActivated(false); // This should be activated when Window::show() is called.
return retwin;
}
开发者ID:luk2010,项目名称:aproe,代码行数:18,代码来源:RenderingAPI.cpp
示例15: GetCursorPosition
Vector2i WinInput::GetCursorPosition(WindowPtr pWindow) const
{
POINT point;
GetCursorPos(&point);
Vector2i r(point.x, point.y);
if (pWindow)
{
r = pWindow->ScreenToWindow(r);
}
return r;
}
开发者ID:CeroOscura,项目名称:ethanon,代码行数:11,代码来源:WinInput.cpp
示例16:
boolean RendererD3D11::assembleUnit()
{
ProcessingUnitPtr windowUnit = ProcessingUnitPtr::null;
window->getData( windowUnit );
if( !windowUnit.isNull() )
{
WindowPtr wnd = staticCast<Window>( windowUnit );
RenderDeviceD3D11* rd = static_cast<RenderDeviceD3D11*>( owner );
IDXGIFactory* dxgiFactory = rd->getDXGIFactory();
DXGI_SWAP_CHAIN_DESC desc;
desc.BufferCount = 1;
desc.BufferDesc.Width = wnd->getWidth();
desc.BufferDesc.Height = wnd->getHeight();
desc.BufferDesc.Format = MapperD3D11::mapPixelFormat( Render::PF_RGBA8UN );
desc.BufferDesc.RefreshRate.Numerator = 60;
desc.BufferDesc.RefreshRate.Denominator = 1;
desc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
desc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
desc.OutputWindow = (HWND)wnd->getHandle();
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Windowed = !wnd->isFullscreen();
desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
IDXGISwapChain* sc = 0;
HRESULT hr = dxgiFactory->CreateSwapChain( rd->getD3DDevice(), &desc, &sc );
if( SUCCEEDED( hr ) )
{
swapchains.add( sc );
wnd->setSwapChain( sc );
return true;
}
}
return false;
}
开发者ID:yuen33,项目名称:Neutron,代码行数:39,代码来源:RendererD3D11.cpp
示例17: determinePerformance
/** get graphics performance
*
* This is a rough estimation of rendering costst for visible faces,
* faces outside of the viewport and size dependent rendering costs.
* <pre>
* // face cost calculation
* cost = invisible * invisibleFaceCost +
* max( visible * visibleFaceCost +
* pixel * pixelCost)
* </pre>
*
**/
void RenderNode::determinePerformance( WindowPtr &window )
{
int c;
double faces=0;
double A,B,C;
double t;
setVendor((const char*)glGetString(GL_VENDOR));
setRenderer((const char*)glGetString(GL_RENDERER));
// try to find precalculated values
for(c=0;_prefefined[c]!=NULL;++c)
{
if(_prefefined[c]->getVendor() == getVendor() &&
_prefefined[c]->getRenderer() == getRenderer())
{
SLOG << "Predefined performance values used." << endl;
*this=*_prefefined[c];
return;
}
}
SLOG << "Start rendering benchmark" << endl;
window->activate();
// create display list
GLuint dList1 = glGenLists(1);
glNewList(dList1, GL_COMPILE);
float step = .1;
int count = 400;
for(float y=0;y<(1-step/2);y+=step)
{
glBegin(GL_TRIANGLE_STRIP);
glVertex3f(0,y ,-1);
glVertex3f(0,y+step,-1);
for(float x=step;x<(1+step/2);x+=step)
{
glVertex3f(x,y ,-1);
glVertex3f(x,y+step,-1);
faces+=2;
}
glEnd();
}
glEndList();
glFinish();
GLuint dList2 = glGenLists(1);
glNewList(dList2, GL_COMPILE);
for(c=0;c<count;++c)
{
glCallList(dList1);
}
glEndList();
glFlush();
t=runFaceBench(dList2,128,128,1.0);
count=(int)(count/t);
glNewList(dList2, GL_COMPILE);
for(c=0;c<count;++c)
{
glCallList(dList1);
}
glEndList();
runFaceBench(dList2,1,1,1.0);
glFinish();
Real32 aSize=2;
Real32 bSize=2;
Real32 cSize=128;
do
{
for(A=0,c=0;A<1.0;++c)
{
A += runFaceBench(dList2,aSize,aSize,1.000);
}
A/=c*count;
for(B=0,c=0;B<1.0;++c)
{
B += runFaceBench(dList2,bSize,bSize,0.001);
}
B/=c*count;
C = runFaceBench(dList2,cSize,cSize,1.000)/count;
} while(A>C);
_visibleFaceCost =A/faces;
_invisibleFaceCost =B/faces;
_drawPixelCost =C/(cSize*cSize);
glViewport(0, 0, window->getWidth(), window->getHeight());
UInt32 width,height;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:opensgplus,代码行数:101,代码来源:OSGRenderNode.cpp
示例18: glutGet
void
display(void)
{
Matrix m1, m2;
m1.setRotate( tball.getRotation() );
m2.setTranslate( tball.getPosition() );
m1.mult( m2 );
cam_trans->editSFMatrix()->setValue( m1 );
// move the object
float t = glutGet(GLUT_ELAPSED_TIME);
Quaternion q;
q.setValueAsAxisDeg(0, 1, 0, t / 5000);
m1.setTransform(Vec3f(osgsin(t / 500.), 0, osgcos(t / 500)), q);
tr->setMatrix(m1);
if ( doRender )
win->render( ract );
else
win->draw( dact );
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:28,代码来源:testBillboardRender.cpp
示例19: glutGet
void
display(void)
{
float t = glutGet( GLUT_ELAPSED_TIME );
win->frameInit();
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
Matrix m;
Quaternion q;
q.setValueAsAxisDeg( 0,1,0, -t/20 );
m.setRotate( q );
tchunk1->setMatrix( m );
tchunk1->activate( dact );
mchunk1->activate( dact );
glCallList( dlid );
m.setIdentity();
m.setTranslate( cos(t/1000), 0, sin(t/1000) );
tchunk2->setMatrix( m );
tchunk2->changeFrom( dact, get_pointer(tchunk1));
mchunk2->changeFrom( dact, get_pointer(mchunk1));
blchunk->activate( dact );
blchunk->activate( dact );
cchunk1->activate( dact );
gchunk1->activate( dact );
glCallList( dlid );
tchunk2->deactivate( dact );
mchunk2->deactivate( dact );
blchunk->deactivate( dact );
cchunk1->deactivate( dact );
gchunk1->deactivate( dact );
xchunk1->activate( dact );
txchunk->activate( dact );
glCallList( dlid2 );
xchunk1->deactivate( dact );
txchunk->deactivate( dact );
win->frameExit();
glutSwapBuffers();
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:52,代码来源:testCubeTextureRender.cpp
示例20: display
void display(void)
{
Matrix m1, m2;
m1.setRotate(tball.getRotation());
m2.setTranslate(tball.getPosition());
m1.mult(m2);
cam_trans->editSFMatrix()->setValue(m1);
if(doRender)
win->render(ract);
else
win->draw(dact);
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:15,代码来源:testBINLoader.cpp
注:本文中的WindowPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论