本文整理汇总了C++中Background类的典型用法代码示例。如果您正苦于以下问题:C++ Background类的具体用法?C++ Background怎么用?C++ Background使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Background类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setBackground
/**
* Changes the window background.
*
* @param path image file
* @param alpha values between 0-255
*/
void MEdiText::setBackground(QString path, int alpha)
{
Background back;
QPalette palette;
palette.setBrush(this->backgroundRole(), back.getBrush(path, alpha));
this->setPalette(palette);
}
示例2: setBackgroundParameters
void FileSet::initBackgrounds(map<fluorInfo, backgroundPars> bgp){
if(backgrounds.size()){
setBackgroundParameters(bgp);
return;
}
int wcounter = 0; // horrible kludge warning
for(set<fluorInfo>::iterator it=flInfo.begin(); it != flInfo.end(); it++){
ImageData* id = new ImageData(this);
Background* bg = 0;
if(!bgp.count((*it))){
bg = new Background(id, 16, 16, 8, 75); // default background parameters
}else{
bg = new Background(id, bgp[(*it)]);
}
backgrounds.insert(make_pair((*it), bg));
cout << "setting background for " << wcounter << endl;
bg->setBackground(wcounter);
wcounter++;
}
// The backgrounds will need to be passed on to the frame-stacks, and so on..
// frameStacks are arranged by x and y position. hence a painful double map
for(map<float, map<float, FrameStack*> >::iterator it=frames.begin();
it != frames.end(); it++){
for(map<float, FrameStack*>::iterator jt=it->second.begin();
jt != it->second.end(); jt++){
jt->second->setBackgrounds(backgrounds);
}
}
}
示例3:
MenuScreen::MenuScreen()
{
game = NULL;
app = NULL;
Player *p1 = new Player;
Player *p2 = new Player;
Player *p3 = new Player;
Player *p4 = new Player;
Player *p5 = new Player;
p1->Init("monster1.png");
p2->Init("monster2.png");
p3->Init("monster3.png");
p4->Init("monster4.png");
p5->Init("monster5.png");
p1->SetPosition((float)((Iw2DGetSurfaceWidth()/2)-65),(float)(Iw2DGetSurfaceHeight()/2-58));
p2->SetPosition((float)((Iw2DGetSurfaceWidth()/2)+10),(float)(Iw2DGetSurfaceHeight()/2-58));
p3->SetPosition((float)((Iw2DGetSurfaceWidth()/2)-92),(float)(Iw2DGetSurfaceHeight()/2+10));
p4->SetPosition((float)((Iw2DGetSurfaceWidth()/2)-28),(float)(Iw2DGetSurfaceHeight()/2+10));
p5->SetPosition((float)((Iw2DGetSurfaceWidth()/2)+38),(float)(Iw2DGetSurfaceHeight()/2+10));
Background *bg = new Background;
bg->Init("bg2.png",(float)Iw2DGetSurfaceWidth(),(float)Iw2DGetSurfaceHeight(),true);
SetBackGround(bg);
AddPlayer("monster1",p1);
AddPlayer("monster2",p2);
AddPlayer("monster3",p3);
AddPlayer("monster4",p4);
AddPlayer("monster5",p5);
}
示例4: addBackground
void ToyExperiments::addBackground(const Background &bkg) {
assert( bkg.nBins() >= Parameters::nBins() );
std::vector<double>::iterator iTot;
std::vector<double>::const_iterator iBkg;
// Add yields to total background
iTot = meanPredictions_.begin();
iBkg = bkg.meanPredictions();
for(; iTot != meanPredictions_.end(); ++iTot, ++iBkg) {
*iTot += *iBkg;
}
// Add uncertainties in quadrature
iTot = uncorrelatedUncerts_.begin();
iBkg = bkg.uncorrelatedUncerts();
for(; iTot != uncorrelatedUncerts_.end(); ++iTot, ++iBkg) {
double t = *iTot;
double b = *iBkg;
*iTot = sqrt( t*t + b*b );
}
iTot = correlatedUncerts_.begin();
iBkg = bkg.correlatedUncerts();
for(; iTot != correlatedUncerts_.end(); ++iTot, ++iBkg) {
double t = *iTot;
double b = *iBkg;
*iTot = sqrt( t*t + b*b );
}
}
示例5: ShaderGraph
void BlenderSync::sync_world(bool update_all)
{
Background *background = scene->background;
Background prevbackground = *background;
BL::World b_world = b_scene.world();
if(world_recalc || update_all || b_world.ptr.data != world_map) {
Shader *shader = scene->shaders[scene->default_background];
ShaderGraph *graph = new ShaderGraph();
/* create nodes */
if(b_world && b_world.use_nodes() && b_world.node_tree()) {
BL::ShaderNodeTree b_ntree(b_world.node_tree());
add_nodes(scene, b_data, b_scene, graph, b_ntree);
}
else if(b_world) {
ShaderNode *closure, *out;
closure = graph->add(new BackgroundNode());
closure->input("Color")->value = get_float3(b_world.horizon_color());
out = graph->output();
graph->connect(closure->output("Background"), out->input("Surface"));
}
/* AO */
if(b_world) {
BL::WorldLighting b_light = b_world.light_settings();
if(b_light.use_ambient_occlusion())
background->ao_factor = b_light.ao_factor();
else
background->ao_factor = 0.0f;
background->ao_distance = b_light.distance();
}
shader->set_graph(graph);
shader->tag_update(scene);
}
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
/* when doing preview render check for BI's transparency settings,
* this is so because bledner's preview render routines are not able
* to tweak all cycles's settings depending on different circumstances
*/
if(b_engine.is_preview() == false)
background->transparent = get_boolean(cscene, "film_transparent");
else
background->transparent = b_scene.render().alpha_mode() == BL::RenderSettings::alpha_mode_TRANSPARENT;
background->use = render_layer.use_background;
if(background->modified(prevbackground))
background->tag_update(scene);
}
示例6:
Background::Background(Background const & cp)
{
this->_maxHeight = cp.getHeight();
this->_base = cp.getBase();
this->_nbLine = cp.getNbLine();
this->_win = cp.getWin();
return;
}
示例7: Background
Background* Background::create(const std::string& filename) {
Background *backLayer = new Background();
if (backLayer && backLayer->init(filename)) {
backLayer->autorelease();
return backLayer;
}
CC_SAFE_DELETE(backLayer);
return NULL;
}
示例8: Background
Background* Background::create(std::string backgroundFileName)
{
Background *pGOL = new Background();
if (pGOL && pGOL->init(backgroundFileName)) {
pGOL->autorelease();
return pGOL;
}
CC_SAFE_DELETE(pGOL);
return NULL;
}
示例9: CreateBackgroundPainter
//static
Background* Background::CreateVerticalGradientBackground(
const gfx::Color& color1, const gfx::Color& color2)
{
Background* background = CreateBackgroundPainter(
true, Painter::CreateVerticalGradient(color1, color2));
background->SetNativeControlColor(
gfx::AlphaBlend(color1, color2, 128));
return background;
}
示例10: Background
Background* Background::create()
{
Background *background = new Background();
if (background && background->init()){
background->autorelease();
return background;
}
CC_SAFE_DELETE(background);
return nullptr;
}
示例11: ShaderGraph
void BlenderSync::sync_world(bool update_all)
{
Background *background = scene->background;
Background prevbackground = *background;
BL::World b_world = b_scene.world();
if(world_recalc || update_all || b_world.ptr.data != world_map) {
Shader *shader = scene->shaders[scene->default_background];
ShaderGraph *graph = new ShaderGraph();
/* create nodes */
if(b_world && b_world.use_nodes() && b_world.node_tree()) {
PtrSockMap sock_to_node;
BL::ShaderNodeTree b_ntree(b_world.node_tree());
add_nodes(scene, b_data, b_scene, graph, b_ntree, sock_to_node);
}
else if(b_world) {
ShaderNode *closure, *out;
closure = graph->add(new BackgroundNode());
closure->input("Color")->value = get_float3(b_world.horizon_color());
out = graph->output();
graph->connect(closure->output("Background"), out->input("Surface"));
}
/* AO */
if(b_world) {
BL::WorldLighting b_light = b_world.light_settings();
if(b_light.use_ambient_occlusion())
background->ao_factor = b_light.ao_factor();
else
background->ao_factor = 0.0f;
background->ao_distance = b_light.distance();
}
shader->set_graph(graph);
shader->tag_update(scene);
}
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
background->transparent = get_boolean(cscene, "film_transparent");
background->use = render_layer.use_background;
if(background->modified(prevbackground))
background->tag_update(scene);
}
示例12: while
Background* Background::CreateBackground()
{
do
{
Background* pRet = new Background;
if (pRet && pRet->Init())
{
pRet->autorelease();
return pRet;
}
delete pRet;
} while (false);
CCLog("Function Background::CreateBackground Error!");
return NULL;
}
示例13: draw
void StarsApp::draw()
{
gl::clear( Color::black() );
gl::pushMatrices();
gl::setMatrices( mCamera.getCamera() );
{
// draw background
mBackground.draw();
// draw grid
if(mIsGridVisible)
mGrid.draw();
// draw stars
mStars.draw();
}
gl::popMatrices();
// draw user interface
mUserInterface.draw();
// fade in at start of application
gl::enableAlphaBlending();
double t = math<double>::clamp( mTimer.getSeconds() / 3.0, 0.0, 1.0 );
float a = ci::lerp<float>(1.0f, 0.0f, (float) t);
if( a > 0.0f ) {
gl::color( ColorA(0,0,0,a) );
gl::drawSolidRect( getWindowBounds() );
}
gl::disableAlphaBlending();
}
示例14: Cast
//------------------------------------------------------------------------------
void OneHit::Cast(TaggedRay & ray,const RenderableDB & db,const ds::List<Renderable*,
mem::KillDel<Light> > & inside,const ds::List<Light*> & ll,const Background & bg) const
{
if (db.Intercept(ray,ray.hit,ray.inter))
{
// Hit an object - respond accordingly...
ray.irradiance = bs::ColourRGB(0.0,0.0,0.0);
Renderable::MatSpec & ms = ray.hit->mat[ray.inter.coord.material];
if (ms.im) ms.im->Modify(ray.inter);
ds::List<Light*>::Cursor targ = ll.FrontPtr();
while (!targ.Bad())
{
bs::ColourRGB out;
bs::Normal norm = ray.n; norm.Neg();
(*targ)->Calc(norm,ray.inter,*ms.mat,db,out);
ray.irradiance += out;
++targ;
}
}
else
{
// Missed all objects - use the background instead...
ray.hit = null<Renderable*>();
bg.Calc(ray,ray.irradiance);
}
}
示例15: getElapsedSeconds
void StarsApp::setup()
{
mTime = getElapsedSeconds();
// create the spherical grid mesh
mGrid.setup();
// load the star database and create the VBO mesh
mStars.load( loadAsset("hygxyz.csv") );
//mStars.write( writeFile( getAssetPath("") / "hygxyz.dat" ) ); // TODO
// load texture and shader
mStars.setup();
// create user interface
mUserInterface.setup();
// initialize background image
mBackground.setup();
// initialize camera
mCamera.setup();
//
mIsGridVisible = false;
//
forceHideCursor();
//
mTimer.start();
}