本文整理汇总了C++中Drawer类的典型用法代码示例。如果您正苦于以下问题:C++ Drawer类的具体用法?C++ Drawer怎么用?C++ Drawer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Drawer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unset
void AlphaBlend::unset(){
Drawer *drawer = Drawer::getInstance();
drawer->disable(InGE_BLEND);
m_component->unset();
}
示例2: draw
void draw(){
const float *eyePos = camera.getEyePos();
const float *target = camera.getTarget();
const float *upVector = camera.getUpVector();
int index = current / total;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(eyePos[0], eyePos[1], eyePos[2], target[0], target[1], target[2],
upVector[0], upVector[1], upVector[2]);
SurfaceGeometryF tmp;
Drawer drawer;
tmp.rows = tmp.cols = 100;
tmp.startX = tmp.startY = -1.0;
tmp.endX = tmp.endY = 1.0;
tmp.calculateNorm = true;
tmp.evalFunc = calc;
for(size_t i = 0;i < surfs.size();++ i){
surf = surfs[i].surf;
mat(&surfs[i].color);
//cout << surfs[i].color.x() << ' ' << surfs[i].color.y() << ' ' << surfs[i].color.z() << endl;
drawer.draw(tmp);
}
if(index + 1 < surfs.size()){
surf = interpolated.surf;
mat(&interpolated.color);
drawer.draw(tmp);
}
}
示例3: run
void ConsoleModeController::run(QString pathToConfigFile, QString pathToOutputFile)
{
saveAndLoadConfig::ConfigParser parser;
try
{
Configuration* config = parser.parse(pathToConfigFile);
Drawer drawer;
Lemniscate* lemniscate = config->getLemniscate();
int width = config->getPanel()->getWidth();
int height = config->getPanel()->getHeight();
QImage* image = new QImage(width, height, QImage::Format_RGB888);
const int whiteColorValue = 255;
memset(image->bits(), whiteColorValue, image->byteCount());
drawer.drawLemniscate(image, lemniscate);
if (!image->save(pathToOutputFile))
{
std::cerr << "image wasn't saved" << std::endl;
}
}
catch (JsonParserException& exception)
{
std::cerr << exception.what() << std::endl;
}
}
示例4: render
void Level::render(Drawer& drawer)
{
b2Transform trans = mTop->GetTransform();
drawer.DrawShape(trans, mTop->GetFixtureList(), b2Color(1, 1, 1));
trans = mBot->GetTransform();
drawer.DrawShape(trans, mTop->GetFixtureList(), b2Color(1, 1, 1));
}
示例5: draw
// Draw the game according the the time elapsed since the last draw
// The elapsed time is in seconds
void MainMenu::draw(const Drawer& drawer, float elapsedTime)
{
drawer.clear(_backgroundColor);
drawer.draw(_mainMenu);
drawer.present();
}
示例6: set
void AlphaBlend::set(bool setup){
Drawer *drawer = Drawer::getInstance();
drawer->enable(InGE_BLEND);
drawer->blendFunc( InGE_SRC_ALPHA, InGE_ONE_MINUS_SRC_ALPHA );
m_component->set(setup);
}
示例7: SetAuiManager
void DrawerManager::SetAuiManager( wxAuiManager* auiManager )
{
for ( M_DrawerButtonIDs::const_iterator drawerItr = m_Drawers.begin(), drawerEnd = m_Drawers.end(); drawerItr != drawerEnd; ++drawerItr )
{
Drawer* drawer = drawerItr->second;
drawer->SetAuiManager( auiManager );
}
}
示例8: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Drawer drawer;
drawer.show();
return a.exec();
}
示例9: draw
spn::SizeF Node::draw(const Vec2& offset, const Vec2& unit, Drawer& d) const {
const auto sz = _text->getSize();
d.drawRectBoth({
offset.x,
offset.x+sz.width,
offset.y,
offset.y-sz.height
}, {Color::Node});
// ノード名
d.drawText(offset, _text, {Color::Node});
// ノードを開いた印
d.drawText(offset + Vec2(sz.width + 8, 0), _mark[_expanded], {Color::Node});
return {sz.width+16, unit.y};
}
示例10: ofSetFrameRate
//--------------------------------------------------------------
void ofApp::setup() {
ofSetFrameRate(60);
ofSetVerticalSync(true);
rotate = 0;
// setup bvh
bvh[0].load("bvhfiles/kashiyuka.bvh");
bvh[1].load("bvhfiles/nocchi.bvh");
bvh[2].load("bvhfiles/aachan.bvh");
for (int i = 0; i < 3; i++) {
bvh[i].play();
}
track.loadSound("Perfume_globalsite_sound.wav");
track.play();
track.setLoop(true);
// setup tracker and drawer
for (int i = 0; i < 3; i++)
{
ofxBvh &b = bvh[i];
Drawer *d = new Drawer;
for (int n = 0; n < b.getNumJoints(); n++) {
const ofxBvhJoint *o = b.getJoint(n);
Tracker *t = new Tracker;
t->setup(o);
t->setTrackerLength(trackerLength);
trackers.push_back(t);
d->add(o);
}
drawers.push_back(d);
}
ofPushMatrix();
ofTranslate(0, -100);
ofScale(1, 1, 1);
ofRotateX(90);
camera.setFov(90);
camera.lookAt(ofVec3f(0,0,0));
camera.setPosition(300, 30, 300);
//camera.disableMouseInput();
ofPopMatrix();
background.loadImage("background.png");
}
示例11: display
void display(){
GLfloat texParams[4] = {0, 0, 0.5, 0.5};
const float *eyePos = camera.getEyePos();
const float *target = camera.getTarget();
const float *upVector = camera.getUpVector();
GLfloat white[] = {1.0, 1.0, 1.0, 1.0};
GLfloat yellow[]= {1.0, 1.0, 0.0, 1.0};
GLfloat mat_shininess[]={ 30.0 };
SurfaceGeometryF tmp;
Drawer drawer;
//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
tmp.startX = tmp.startY = -4;
tmp.endX = tmp.endY = 4;
tmp.rows = tmp.cols = slice;
tmp.evalFunc = tmpFunc;
tmp.normFunc = normFunc;
tmp.hasTexture = true;
if(tmp.normFunc == NULL)
tmp.calculateNorm = true;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(eyePos[0], eyePos[1], eyePos[2], target[0], target[1], target[2],
upVector[0], upVector[1], upVector[2]);
//glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
//glTexGenfv(GL_S, GL_OBJECT_PLANE, texParams);
glMaterialfv(GL_FRONT, GL_DIFFUSE, white );
glMaterialfv(GL_BACK, GL_DIFFUSE, yellow );
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess );
{
GLuint texName;
glGenTextures(1,&texName); // define texture for sixth face
//glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glBindTexture(GL_TEXTURE_2D,texName);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,texture.textWidth,texture.textHeight,
0,GL_RGB,GL_UNSIGNED_BYTE,texture.texImage);
drawer.draw(tmp);
glDeleteTextures(1, &texName);
}
glutSwapBuffers();
}
示例12: RemoveAllDrawers
void DrawerManager::RemoveAllDrawers()
{
// Close and detach from all drawers
for ( M_DrawerButtonIDs::const_iterator drawerItr = m_Drawers.begin(), drawerEnd = m_Drawers.end(); drawerItr != drawerEnd; ++drawerItr )
{
Drawer* drawer = drawerItr->second;
drawer->e_Opening.RemoveMethod( this, &DrawerManager::OnDrawerOpening );
drawer->e_Opened.RemoveMethod( this, &DrawerManager::OnDrawerOpened );
drawer->e_Closed.RemoveMethod( this, &DrawerManager::OnDrawerClosed );
drawer->Close();
//delete drawer;
}
m_Drawers.clear();
}
示例13: RemoveDrawer
void DrawerManager::RemoveDrawer( Drawer* drawer )
{
// Close and detach from all drawers
M_DrawerButtonIDs::iterator foundDrawerItr = m_Drawers.find( drawer->GetButtonID() );
if ( foundDrawerItr != m_Drawers.end() )
{
Drawer* foundDrawer = foundDrawerItr->second;
foundDrawer->e_Opening.RemoveMethod( this, &DrawerManager::OnDrawerOpening );
foundDrawer->e_Opened.RemoveMethod( this, &DrawerManager::OnDrawerOpened );
foundDrawer->e_Closed.RemoveMethod( this, &DrawerManager::OnDrawerClosed );
foundDrawer->Close();
m_Drawers.erase( foundDrawerItr );
}
}
示例14: DEF_TEST
DEF_TEST(SkRecordingAccuracyXfermode, reporter) {
#define FINEGRAIN 0
const Drawer drawer;
BitmapBackedCanvasStrategy golden(drawer.imageInfo());
PictureStrategy picture(drawer.imageInfo());
#if !FINEGRAIN
unsigned numErrors = 0;
SkString errors;
#endif
for (int iMode = 0; iMode < int(SkBlendMode::kLastMode); iMode++) {
const SkRect& clip = SkRect::MakeXYWH(100, 0, 100, 100);
SkBlendMode mode = SkBlendMode(iMode);
const SkBitmap& goldenBM = golden.recordAndReplay(drawer, clip, mode);
const SkBitmap& pictureBM = picture.recordAndReplay(drawer, clip, mode);
size_t pixelsSize = goldenBM.computeByteSize();
REPORTER_ASSERT(reporter, pixelsSize == pictureBM.computeByteSize());
// The pixel arrays should match.
#if FINEGRAIN
REPORTER_ASSERT(reporter,
0 == memcmp(goldenBM.getPixels(), pictureBM.getPixels(), pixelsSize));
#else
if (memcmp(goldenBM.getPixels(), pictureBM.getPixels(), pixelsSize)) {
numErrors++;
errors.appendf("For SkXfermode %d %s: SkPictureRecorder bitmap is wrong\n",
iMode, SkBlendMode_Name(mode));
}
#endif
}
#if !FINEGRAIN
REPORTER_ASSERT(reporter, 0 == numErrors, errors.c_str());
#endif
}
示例15: display
void display(){
const float *eyePos = camera.getEyePos();
const float *target = camera.getTarget();
const float *upVector = camera.getUpVector();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(eyePos[0], eyePos[1], eyePos[2], target[0], target[1], target[2],
upVector[0], upVector[1], upVector[2]);
glLightfv(GL_LIGHT0, GL_POSITION, light_pos0 ); // light 0
glLightfv(GL_LIGHT1, GL_POSITION, light_pos1 ); // light 1
Drawer drawer;
ParametricSurfaceGeometryF g;
g.startU = g.startV = -len;
g.endU = g.endV = len;
g.rows = 500;
g.cols = 500;
g.evalFunc = paramFunc;
g.normFunc = NULL;
//g.calculateNorm = false;
//glColor3f(1.0, 1.0, 1.0);
//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
drawer.draw(g);
glLineWidth(2);
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);
glVertex3f(-2, 0, 0);
glVertex3f(2, 0, 0);
glColor3f(0.0, 1.0, 0.0);
glVertex3f(0, -2, 0);
glVertex3f(0, 2, 0);
glColor3f(0.0, 0.0, 1.0);
glVertex3f(0, 0, -2);
glVertex3f(0, 0, 2);
glEnd();
glutSwapBuffers();
}