本文整理汇总了C++中GraphicsObject类的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsObject类的具体用法?C++ GraphicsObject怎么用?C++ GraphicsObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GraphicsObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void GraphicsObjectManager::privDrawObjectsDepthFirst( GraphicsObject *node ) const
{
GraphicsObject *child = 0;
// --------- Do draw stuff here -----------------------
// node->print();
node->transform();
node->setRenderState();
node->draw();
// --------- Do draw stuff here -----------------------
// iterate through all of the active children
if (node->getChild() != 0)
{
child = (GraphicsObject *)node->getChild();
// make sure that allocation is not a child node
while (child != 0)
{
privDrawObjectsDepthFirst( child );
// goto next sibling
child = (GraphicsObject *)child->getSibling();
}
}
else
{
// bye bye exit condition
}
}
示例2: while
void Skeleton::updateSkeleton(GraphicsObject *node, FrameBucket* pResult)
{
// --------- Do pose stuff here -----------------------
this->setBonePose(node, pResult);
// iterate through all of the active children - copied from GOM, will it work here???
GraphicsObject *child = 0;
if (node->getChild() != 0)
{
child = (GraphicsObject *)node->getChild();
// make sure that allocation is not a child node
while (child != 0)
{
updateSkeleton( child, pResult );
// goto next sibling - node's child, but now we are iterating SIBLINGS
child = (GraphicsObject *)child->getSibling();
}
}
else
{
// bye bye exit condition
}
}
示例3: QGraphicsPixmapItem
GraphicsObject::GraphicsObject(const GraphicsObject &other) : QGraphicsPixmapItem() {
m_type = other.m_type;
setFlags(other.flags());
setPos(other.pos());
setRotation(other.rotation());
setToolTip("");
}
示例4: PrintGraphicsObjectToTree
void ColourFilterObjectData::render(const GraphicsObject& go,
const GraphicsObject* parent,
std::ostream* tree) {
if (go.width() != 100 || go.height() != 100) {
static bool printed = false;
if (!printed) {
printed = true;
cerr << "We can't yet scaling colour filters." << endl;
}
}
// Lazily create colour object.
if (!colour_filer_) {
colour_filer_.reset(graphics_system_.BuildColourFiller(screen_rect_));
}
RGBAColour colour = go.colour();
colour.setAlpha(
static_cast<int>(colour.a_float() * go.computedAlpha()));
colour_filer_->Fill(go, colour);
if (tree) {
*tree << " ColourFilterObjectData" << std::endl
<< " Screen rect: " << screen_rect_ << std::endl
<< " Colour: " << colour << std::endl
<< " Properties: ";
PrintGraphicsObjectToTree(go, tree);
*tree << endl;
}
}
示例5: privDrawObjectsTreeDepthFirst
void GraphicsObjectManager::privDrawObjectsTreeDepthFirst( PCSNode *node ) const
{
PCSNode *child = 0;
GraphicsObject *go = (GraphicsObject *)node;
// Transform and draw graphics object
go->transform();
go->setRenderState();
go->draw();
// iterate through all of the active children
if (node->getChild() != 0)
{
child = node->getChild();
// make sure that allocation is not a child node
while (child != 0)
{
privDrawObjectsTreeDepthFirst( child );
// goto next sibling
child = child->getSibling();
}
}
else
{
// bye bye exit condition
}
}
示例6: sprintf
//---------------------------------------------------------------------------------
// Name: updateGui()
//---------------------------------------------------------------------------------
void GameplayState::updateGui()
{
unsigned data[4] = {0};
data[0] = BATTLE_CITY->getEnemiesLeft();
data[1] = BATTLE_CITY->getPlayerLivesNum( PLAYER_ONE_TANK );
data[2] = BATTLE_CITY->getPlayerLivesNum( PLAYER_TWO_TANK );
data[3] = BATTLE_CITY->getCurrMapNumber();
if ( (data[0] ^ m_tdata[0]) | (data[1] ^ m_tdata[1]) | (data[2] ^ m_tdata[2] ) )
{
char buff[100] = {0};
sprintf( buff,
"T : %.2d | 1P : %.2d | 2P : %.2d | M : %.2d",
data[0],
data[1],
data[2],
data[3] );
if ( BATTLE_CITY->getGameMode() == _1PLAYER_MODE )
memset( buff + 19, ' ', sizeof(char) << 3 );
int buff_w, buff_h;
RENDER_MGR->getFontManager()->getStringSize(buff, &buff_w, &buff_h, m_font_id );
if ( !m_data_gui_go.expired() )
{
GraphicsObject * obj = m_data_gui_go._Get();
obj->setTemporary(true);
}
m_data_gui_go = GUI_TEXT( buff, ( BASE_SCREEN_WIDTH - buff_w ) >> 1, buff_h, CYAN_COLOR );
memcpy( m_tdata, data, sizeof(unsigned) << 2 );
}
示例7: getRenderingAlpha
int GraphicsObjectData::getRenderingAlpha(const GraphicsObject& go,
const GraphicsObject* parent) {
if (!parent) {
return go.computedAlpha();
} else {
return int((parent->computedAlpha() / 255.0f) *
(go.computedAlpha() / 255.0f) * 255);
}
}
示例8: ensureIsParentObject
void ensureIsParentObject(GraphicsObject& parent, int size) {
if (parent.hasObjectData()) {
if (parent.objectData().isParentLayer()) {
return;
}
}
parent.setObjectData(new ParentGraphicsObjectData(size));
}
示例9: dstOrigin
Point GraphicsObjectData::dstOrigin(const GraphicsObject& go) {
if (go.xOrigin() || go.yOrigin()) {
return Point(go.xOrigin(), go.yOrigin());
}
boost::shared_ptr<const Surface> surface = currentSurface(go);
if (surface) {
return Point(surface->getPattern(go.pattNo()).originX,
surface->getPattern(go.pattNo()).originY);
}
return Point();
}
示例10: drawObjectsList
void GraphicsObjectManager::drawObjectsList()
{
// Walk the graphics object list
std::list<GraphicsObject *>::iterator it;
for ( it=goList.begin(); it != goList.end(); it++ )
{
// local pointer
GraphicsObject *go = *it;
// Transform and draw graphics object
go->transform();
go->setRenderState();
go->draw();
}
}
示例11: render
void ColourFilterObjectData::render(const GraphicsObject& go,
const GraphicsObject* parent,
std::ostream* tree) {
if (go.mono() == 0) {
RGBAColour colour = go.colour();
colour.setAlpha(
static_cast<int>(colour.a_float() * go.computedAlpha()));
graphics_system_.fillScreenArea(screen_rect_, colour);
if (tree)
objectInfo(*tree);
} else {
static bool printed = false;
if (!printed) {
printed = true;
cerr << "We don't yet deal with objMono() and colour filters." << endl;
}
}
}
示例12: dstRect
Rect GraphicsObjectData::dstRect(const GraphicsObject& go,
const GraphicsObject* parent) {
Point origin = dstOrigin(go);
Rect src = srcRect(go);
int center_x = go.x() + go.xAdjustmentSum() - origin.x() +
(src.width() / 2.0f);
int center_y = go.y() + go.yAdjustmentSum() - origin.y() +
(src.height() / 2.0f);
float second_factor_x = 1.0f;
float second_factor_y = 1.0f;
if (parent) {
center_x += parent->x() + parent->xAdjustmentSum();
center_y += parent->y() + parent->yAdjustmentSum();
second_factor_x = parent->getWidthScaleFactor();
second_factor_y = parent->getHeightScaleFactor();
}
int half_real_width = (src.width() * second_factor_x *
go.getWidthScaleFactor()) / 2.0f;
int half_real_height = (src.height() * second_factor_y *
go.getHeightScaleFactor()) / 2.0f;
int xPos1 = center_x - half_real_width;
int yPos1 = center_y - half_real_height;
int xPos2 = center_x + half_real_width;
int yPos2 = center_y + half_real_height;
return Rect::GRP(xPos1, yPos1, xPos2, yPos2);
}
示例13: ProcessRange
void GraphicsScene::ProcessRange( u32 begin, u32 end )
{
static const u32 nonPausable =
GraphicsObject::Type_Camera |
GraphicsObject::Type_Window |
GraphicsObject::Type_StatWindow |
GraphicsObject::Type_Chart |
GraphicsObject::Type_CPUChart |
GraphicsObject::Type_WorkloadWindow;
for ( size_t i = begin; i < end; ++i )
{
GraphicsObject* pObject = m_Objects[i];
// Update objects based on paused state
if ( !m_bPause || pObject->GetType() & nonPausable )
{
// Process this object
pObject->Update( m_fDeltaTime );
}
}
}
示例14: dstRect
Rect GraphicsObjectData::dstRect(const GraphicsObject& go) {
Point origin = dstOrigin(go);
Rect src = srcRect(go);
int xPos1 = go.x() + go.xAdjustmentSum() - origin.x();
int yPos1 = go.y() + go.yAdjustmentSum() - origin.y();
int xPos2 = int(xPos1 + src.width() * (go.width() / 100.0f));
int yPos2 = int(yPos1 + src.height() * (go.height() / 100.0f));
return Rect::GRP(xPos1, yPos1, xPos2, yPos2);
}
示例15: render
void GraphicsObjectData::render(const GraphicsObject& go, std::ostream* tree) {
boost::shared_ptr<const Surface> surface = currentSurface(go);
if (surface) {
Rect src = srcRect(go);
Rect dst = dstRect(go);
int alpha = getRenderingAlpha(go);
// TODO: Anyone attempting moving the clip area calculations here should
// verify that it doesn't break the final pan scene of Yumemi in
// Planetarian.
if (tree) {
objectInfo(*tree);
*tree << " Rendering " << src << " to " << dst;
if (alpha != 255)
*tree << " (alpha=" << alpha << ")";
if (go.hasClip())
*tree << " [Warning: Clip rectangle calculations not applied.]";
*tree << endl;
}
surface->renderToScreenAsObject(go, src, dst, alpha);
}
}