当前位置: 首页>>代码示例>>C++>>正文


C++ DisplayObject类代码示例

本文整理汇总了C++中DisplayObject的典型用法代码示例。如果您正苦于以下问题:C++ DisplayObject类的具体用法?C++ DisplayObject怎么用?C++ DisplayObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DisplayObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: log_debug

void
Gui::notifyMouseMove(int ux, int uy) 
{
    movie_root* m = _stage;
    
    if ( ! _started ) return;
    
    if ( _stopped ) return;
    
    // A stage pseudopixel is user pixel / _xscale wide
    boost::int32_t x = (ux-_xoffset) / _xscale;
    
    // A stage pseudopixel is user pixel / _xscale high
    boost::int32_t y = (uy-_yoffset) / _yscale;
    
#ifdef DEBUG_MOUSE_COORDINATES
    log_debug("mouse @ %d,%d", x, y);
#endif
    
    if ( m->mouseMoved(x, y) ) {
        // any action triggered by the
        // event required screen refresh
        display(m);
    }
    
    DisplayObject* activeEntity = m->getActiveEntityUnderPointer();
    if ( activeEntity ) {
        if ( activeEntity->isSelectableTextField() ) {
            setCursor(CURSOR_INPUT);
        } else if ( activeEntity->allowHandCursor() ) {
            setCursor(CURSOR_HAND);
        } else {
            setCursor(CURSOR_NORMAL);
        }
    } else {
        setCursor(CURSOR_NORMAL);
    }
    
#ifdef ENABLE_KEYBOARD_MOUSE_MOVEMENTS
    _xpointer = ux;
    _ypointer = uy;
#endif


}
开发者ID:BrandRegard,项目名称:gnash,代码行数:45,代码来源:gui.cpp

示例2: testInvariant

int
DisplayList::getNextHighestDepth() const
{
    testInvariant();

    int nexthighestdepth=0;
    for (const_iterator it = _charsByDepth.begin(),
            itEnd = _charsByDepth.end(); it != itEnd; ++it) {

        DisplayObject* ch = *it;

        const int chdepth = ch->get_depth();
        if (chdepth >= nexthighestdepth) {
            nexthighestdepth = chdepth+1;
        }
    }
    return nexthighestdepth;
}
开发者ID:BrandRegard,项目名称:gnash,代码行数:18,代码来源:DisplayList.cpp

示例3: assert

void
DisplayList::placeDisplayObject(DisplayObject* ch, int depth,
        as_object* initObj)
{
    assert(!ch->unloaded());
    ch->set_invalidated();
    ch->set_depth(depth);

    container_type::iterator it =
        std::find_if( _charsByDepth.begin(), _charsByDepth.end(),
                DepthGreaterOrEqual(depth));

    if (it == _charsByDepth.end() || (*it)->get_depth() != depth) {
        // add the new char
        _charsByDepth.insert(it, DisplayItem(ch));
    }
    else {
        // remember bounds of old char
        InvalidatedRanges old_ranges; 
        (*it)->add_invalidated_bounds(old_ranges, true);    

        // make a copy (before replacing)
        DisplayObject* oldCh = *it;

        // replace existing char (before calling unload!)
        *it = DisplayItem(ch);
    
        if (oldCh->unload()) {
            // reinsert removed DisplayObject if needed
            reinsertRemovedCharacter(oldCh);
        }
        else oldCh->destroy();
        
        // extend invalidated bounds
        ch->extend_invalidated_bounds(old_ranges);                
    }

    // Give life to this instance
    ch->stagePlacementCallback(initObj);

    testInvariant();
}
开发者ID:adamh,项目名称:gnash-fork,代码行数:42,代码来源:DisplayList.cpp

示例4: updateUniforms

void Renderer::updateUniforms( DisplayObject obj, Program* program )
{
    
    bool prSwitch = false;
    Program* backup;
    if(program != NULL)
    {
        prSwitch = true;
        backup = activeProgram;
        setActiveProgram( program );

    }

    //Uniforms
    glm::mat4 mv = camera * obj.getTransform();
    glm::mat4 mvp = projection * mv;
    glm::mat3 rot = (glm::mat3)mv;
    glm::mat3 normal = glm::inverseTranspose(rot);

    glUniformMatrix4fv(activeProgram->getUniform("mvp"), 1, GL_FALSE, glm::value_ptr(mvp) );
    glUniformMatrix4fv(activeProgram->getUniform("mv"), 1, GL_FALSE, glm::value_ptr(mv) );
    glUniformMatrix3fv(activeProgram->getUniform("normal_matrix"), 1, GL_FALSE, glm::value_ptr(normal) );
    
    //FOR TESTING PURPOSES ONLY, REMOVE THIS LINE
    //glUniform4fv(activeProgram->getUniform("LightPosition"), 1, glm::value_ptr( glm::column(-camera, 3) ) );
    glUniform4fv(activeProgram->getUniform("LightPosition"), 1, glm::value_ptr( glm::vec3(0,8,0) ) );

    //THIS NEEDS TO BE MOVED SOMEWHERE ELSE
    //THIS NEEDS TO BE DONE ON A PER-MESH BASIS
    glm::vec3 kD = obj.getModel().materials[0].diffuse;
    //Light constant
    glUniform3fv(activeProgram->getUniform("Kd"), 1, glm::value_ptr( kD ) );
    //Light intensity
    //THIS NEEDS TO BE CONTROLLED BY OUR LIGHTING ENGINE. THIS IS ONLY
    //A STUB AND NEEDS TO BE MOVED SOMEWHERE ELSE WHEN THE PROGRAM
    //SUPPORTS MORE THAN ONE LIGHT
    glUniform3fv(activeProgram->getUniform("Ld"), 1, glm::value_ptr( glm::vec3(0.9, 0.9, 0.9) ) );
    Program::checkGLErrors("Updating uniforms");

    if( prSwitch )
        setActiveProgram( backup );
}
开发者ID:Berulacks,项目名称:north-american-bugfixes,代码行数:42,代码来源:renderer.cpp

示例5: testInvariant

DisplayObject*
DisplayList::getDisplayObjectAtDepth(int depth)
{
    testInvariant();

    for (iterator it = _charsByDepth.begin(), itEnd = _charsByDepth.end();
        it != itEnd; ++it) {

        DisplayObject* ch = *it;

        // found
        if (ch->get_depth() == depth) return ch;

        // non-existent (chars are ordered by depth)
        if (ch->get_depth() > depth) return 0;
    }

    return 0;

}
开发者ID:adamh,项目名称:gnash-fork,代码行数:20,代码来源:DisplayList.cpp

示例6:

	// Removes and returns the child that is found at <arg name="index"/>,
	// or returns NULL if the index is greater than the number of children.
	DisplayObject * DisplayObject::removeChildAt(unsigned int index)
	{
		DisplayObject * removedChild = NULL;
		
		if (index < numChildren())
		{
			std::vector<DisplayObject*>::iterator it;
			
			it = _children.begin();
			it += index;
			
			removedChild = _children[index];
			removedChild->setParent( NULL );
			
			_children.erase(it);
			
			DisplayObject::release(removedChild);
		}
		
		return removedChild;
	}
开发者ID:masiw,项目名称:masicore,代码行数:23,代码来源:DisplayObject.cpp

示例7: log_debug

bool
Sound_as::getVolume(int& volume)
{
    // TODO: check what takes precedence in case we
    //       have both an attached DisplayObject *and*
    //       some other sound...
    //
    if ( _attachedCharacter ) {
        //log_debug("Sound has an attached DisplayObject");
        DisplayObject* ch = _attachedCharacter->get();
        if (! ch) {
            log_debug("Character attached to Sound was unloaded and "
                        "couldn't rebind");
            return false;
        }
        volume = ch->getVolume();
        return true;
    }

    // If we're not attached to a DisplayObject we'll need to query
    // sound_handler for volume. If we have no sound handler, we
    // can't do much, so we'll return false
    if (!_soundHandler) {
        log_debug("We have no sound handler here...");
        return false;
    }

    // Now, we may be controlling a specific sound or
    // the final output as a whole.
    // If soundId is -1 we're controlling as a whole
    //
    if (soundId == -1) {
        volume = _soundHandler->getFinalVolume();
    } else {
        volume = _soundHandler->get_volume(soundId);
    }

    return true;
}
开发者ID:ascendancy721,项目名称:gnash,代码行数:39,代码来源:Sound_as.cpp

示例8: assert

void
DisplayList::placeDisplayObject(DisplayObject* ch, int depth)
{
    assert(!ch->unloaded());
    ch->set_invalidated();
    ch->set_depth(depth);

    container_type::iterator it =
        std::find_if( _charsByDepth.begin(), _charsByDepth.end(),
                boost::bind(std::not2(DepthLessThan()), _1, depth));

    if (it == _charsByDepth.end() || (*it)->get_depth() != depth) {
        // add the new char
        _charsByDepth.insert(it, ch);
    }
    else {
        // remember bounds of old char
        InvalidatedRanges old_ranges; 
        (*it)->add_invalidated_bounds(old_ranges, true);    

        // make a copy (before replacing)
        DisplayObject* oldCh = *it;

        // replace existing char (before calling unload!)
        *it = ch;
    
        if (oldCh->unload()) {
            // reinsert removed DisplayObject if needed
            reinsertRemovedCharacter(oldCh);
        }
        else oldCh->destroy();
        
        // extend invalidated bounds
        ch->extend_invalidated_bounds(old_ranges);                
    }

    testInvariant();
}
开发者ID:BrandRegard,项目名称:gnash,代码行数:38,代码来源:DisplayList.cpp

示例9: updateChildren

	void Stage::updateChildren() {
		DisplayObject *obj;
		int i, total = numChildren();
		for(i = 0; i < total; ++i) {
			obj = children[i];
			if(obj->visible) {
				if(obj->right()  > size.x) width( obj->right() );
				if(obj->bottom() > size.y) height(obj->bottom());
				obj->update();
			}
		}
		obj = NULL;
		
		if(activeScene != NULL) activeScene->updateTime();
	}
开发者ID:tomorrowevening,项目名称:Apollo,代码行数:15,代码来源:ApolloStage.cpp

示例10: signalCheckChange

void ObjectSet::setSelection(std::set<std::pair<uint,uint>> *picks, bool clear)
{
    std::lock(m, DisplayObject::m);

    if (clear)
        for (auto i = DisplayObject::begin(); i != DisplayObject::end(); i++)
            if (i->second->hasSelection())
            {
                i->second->selectObject(_selectionMode, false);
                signalCheckChange(i->second->patch());
            }

    std::set<Patch *> changedPatches;

    for (auto p : *picks)
    {
        DisplayObject *obj = DisplayObject::getObject(p.first);
        if (!obj)
            continue;

        if (obj->patch())
            changedPatches.insert(obj->patch());

        switch (_selectionMode)
        {
        case SM_PATCH: obj->selectObject(SM_PATCH, true); break;
        case SM_FACE: obj->selectFaces(true, {p.second}); break;
        case SM_EDGE: obj->selectEdges(true, {p.second}); break;
        case SM_POINT: obj->selectPoints(true, {p.second}); break;
        }
    }

    for (auto p : changedPatches)
        signalCheckChange(p);

    m.unlock();
    DisplayObject::m.unlock();

    emit selectionChanged();
}
开发者ID:akva2,项目名称:BSGUI,代码行数:40,代码来源:ObjectSet.cpp

示例11: arg1

// private 
// runs in main thread
bool
MovieLoader::processCompletedRequest(const Request& r)
{
    //GNASH_REPORT_FUNCTION;

    boost::intrusive_ptr<movie_definition> md;
    if (!r.getCompleted(md)) return false; // not completed yet

    const std::string& target = r.getTarget();
    DisplayObject* targetDO = _movieRoot.findCharacterByTarget(target);
    as_object* handler = r.getHandler();

    if (!md) {

        if (targetDO && handler) {
            // Signal load error
            // Tested not to happen if target isn't found at time of loading
            //

            as_value arg1(getObject(targetDO));

            // FIXME: docs suggest the string can be either "URLNotFound" or
            // "LoadNeverCompleted". This is neither of them:
            as_value arg2("Failed to load movie or jpeg");

            // FIXME: The last argument is HTTP status, or 0 if no connection
            // was attempted (sandbox) or no status information is available
            // (supposedly the Adobe mozilla plugin).
            as_value arg3(0.0);

            callMethod(handler, NSV::PROP_BROADCAST_MESSAGE, "onLoadError",
                    arg1, arg2, arg3);
        }
        return true; // nothing to do, but completed
    }

    const URL& url = r.getURL();

	Movie* extern_movie = md->createMovie(*_movieRoot.getVM().getGlobal());
	if (!extern_movie) {
		log_error(_("Can't create Movie instance "
                    "for definition loaded from %s"), url);
		return true; // completed in any case...
	}

	// Parse query string
	MovieClip::MovieVariables vars;
	url.parse_querystring(url.querystring(), vars);
    extern_movie->setVariables(vars);

    if (targetDO) {
        targetDO->getLoadedMovie(extern_movie);
    }
    else {
        unsigned int levelno;
        const int version = _movieRoot.getVM().getSWFVersion();
        if (isLevelTarget(version, target, levelno)) {
            log_debug(_("processCompletedRequest: _level loading "
                    "(level %u)"), levelno);
	        extern_movie->set_depth(levelno + DisplayObject::staticDepthOffset);
            _movieRoot.setLevel(levelno, extern_movie);
        }
        else {
            log_debug("Target %s of a loadMovie request doesn't exist at "
                  "load complete time", target);
            return true;
        }
    }

    if (handler && targetDO) {
        // Dispatch onLoadStart
        // FIXME: should be signalled before starting to load
        //        (0/-1 bytes loaded/total) but still with *new*
        //        display object as target (ie: the target won't
        //        contain members set either before or after loadClip.
        callMethod(handler, NSV::PROP_BROADCAST_MESSAGE, "onLoadStart",
            getObject(targetDO));

        // Dispatch onLoadProgress
        // FIXME: should be signalled on every readNonBlocking()
        //        with a buffer size of 65535 bytes.
        //
        size_t bytesLoaded = md->get_bytes_loaded();
        size_t bytesTotal = md->get_bytes_total();
        callMethod(handler, NSV::PROP_BROADCAST_MESSAGE, "onLoadProgress",
            getObject(targetDO), bytesLoaded, bytesTotal);

        // Dispatch onLoadComplete
        // FIXME: find semantic of last arg
        callMethod(handler, NSV::PROP_BROADCAST_MESSAGE, "onLoadComplete",
            getObject(targetDO), as_value(0.0));


        // Dispatch onLoadInit
        
        // This event must be dispatched when actions
        // in first frame of loaded clip have been executed.
        //
//.........这里部分代码省略.........
开发者ID:jlopez,项目名称:gnash,代码行数:101,代码来源:MovieLoader.cpp

示例12: lua_gettop

void DisplayObjectContainer::renderChildren(lua_State *L)
{
    if (!visible)
    {
        return;
    }

    // containers can set a new view to render into, but we must restore the
    // current view after, so take a snapshot
    int viewRestore = GFX::Graphics::getView();

    // set the current view we will be rendering into.
    if (viewRestore != _view)
    {
        GFX::Graphics::setView(_view);
    }

    renderState.alpha          = parent ? parent->renderState.alpha * alpha : alpha;
    renderState.cachedClipRect = parent ? parent->renderState.cachedClipRect : (unsigned short)-1;

    int docidx = lua_gettop(L);

    lua_rawgeti(L, docidx, (int)childrenOrdinal);

    lua_rawgeti(L, -1, LSINDEXVECTOR);
    int childrenVectorIdx = lua_gettop(L);

    int numChildren = lsr_vector_get_length(L, -2);


    if (_depthSort && ((int)sSortBucket.size() < numChildren))
    {
        sSortBucket.resize(numChildren);
    }

    // Is there a cliprect? If so, set it.
    if ((clipX != 0) || (clipY != 0) || (clipWidth != 0) || (clipHeight != 0))
    {
        GFX::QuadRenderer::submit();

        Matrix        res;
        DisplayObject *stage = this;
        while (stage->parent)
        {
            stage = stage->parent;
        }

        getTargetTransformationMatrix(NULL, &res);

        int x1 = (int) ((float)clipX * res.a + res.tx) ;
        int y1 = (int) ((float)clipY * res.d + res.ty);
        int x2 = (int) ((float)clipWidth * res.a);
        int y2 = (int) ((float)clipHeight * res.d);

        renderState.cachedClipRect = GFX::Graphics::setClipRect(x1, y1, x2, y2);
    }
    else
    {
        GFX::Graphics::setClipRect(renderState.cachedClipRect);
    }

    for (int i = 0; i < numChildren; i++)
    {
        lua_rawgeti(L, childrenVectorIdx, i);

        DisplayObject *dobj = (DisplayObject *)lualoom_getnativepointer(L, -1);

        lua_rawgeti(L, -1, LSINDEXTYPE);
        dobj->type = (Type *)lua_topointer(L, -1);
        lua_pop(L, 1);

        dobj->validate(L, lua_gettop(L));

        if (!_depthSort)
        {
            renderType(L, dobj->type, dobj);
        }
        else
        {
            sSortBucket[i].index         = i;
            sSortBucket[i].displayObject = dobj;
        }

        // pop instance
        lua_pop(L, 1);
    }

    if (_depthSort)
    {
        qsort(sSortBucket.ptr(), numChildren, sizeof(DisplayObjectSort), DisplayObjectSortFunction);

        for (int i = 0; i < numChildren; i++)
        {
            DisplayObjectSort *ds = &sSortBucket[i];

            lua_rawgeti(L, childrenVectorIdx, ds->index);

            renderType(L, ds->displayObject->type, ds->displayObject);

            // pop instance
//.........这里部分代码省略.........
开发者ID:Bewolf2,项目名称:LoomSDK,代码行数:101,代码来源:l2dDisplayObjectContainer.cpp

示例13: BaseDisplayObject

 BaseDisplayObject(const DisplayObject<Derived, Deleter>& derived)
   : _handle(derived.Handle()) {
 }
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:3,代码来源:display.hpp

示例14: QString

bool ObjectSet::addPatchFromStream(std::ifstream &stream, File *file)
{
    Go::ObjectHeader head;

    QString error = QString("%2 in '%1'").arg(file->fn());
    QString logString;

    try { head.read(stream); }
    catch (...)
    {
        emit log(error.arg("Unrecognized object header"), LL_ERROR);
        return false;
    }

    DisplayObject *obj = NULL;

    DisplayObject::m.lock();

    switch (head.classType())
    {
    case Go::Class_SplineVolume:
    {
        Go::SplineVolume *v = new Go::SplineVolume();
        try { v->read(stream); }
        catch (...)
        {
            emit log(error.arg("Unable to parse SplineVolume"), LL_ERROR);
            delete v;
            return false;
        }
        obj = new Volume(v);
        break;
    }
    case Go::Class_SplineSurface:
    {
        Go::SplineSurface *s = new Go::SplineSurface();
        try { s->read(stream); }
        catch (...)
        {
            emit log(error.arg("Unable to parse SplineSurface"), LL_ERROR);
            delete s;
            return false;
        }
        obj = new Surface(s);
        break;
    }
    case Go::Class_SplineCurve:
    {
        Go::SplineCurve *c = new Go::SplineCurve();
        try { c->read(stream); }
        catch (...)
        {
            emit log(error.arg("Unable to parse SplineCurve"), LL_ERROR);
            delete c;
            return false;
        }
        obj = new Curve(c);
        break;
    }
    default:
        emit log(error.arg(QString("Unrecognized class type %1").arg(head.classType())), LL_ERROR);
    }

    if (!obj)
    {
        DisplayObject::m.unlock();
        return false;
    }

    m.lock();
    QModelIndex index = createIndex(file->indexInParent(), 0, file);
    beginInsertRows(index, file->nChildren(), file->nChildren());
    Patch *patch = new Patch(obj, file);
    endInsertRows();
    m.unlock();

    DisplayObject::m.unlock();

    while (!obj->initialized())
    {
        emit requestInitialization(obj);
        std::this_thread::sleep_for(std::chrono::milliseconds(10));
    }

    if (!obj->initialized())
    {
        emit log("Failed to initialize display object", LL_ERROR);
        delete obj;
        return true; // Can continue
    }

    emit update();

    return true;
}
开发者ID:akva2,项目名称:BSGUI,代码行数:95,代码来源:ObjectSet.cpp

示例15:

void
DynamicShape::display(Renderer& renderer, const DisplayObject& inst) const
{
    renderer.drawShape(_shape, inst.get_world_cxform(), inst.getWorldMatrix());
}
开发者ID:adamh,项目名称:gnash-fork,代码行数:5,代码来源:DynamicShape.cpp


注:本文中的DisplayObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。