Exemplo n.º 1
0
void DeviceAudioDX11::shutdownAudio (void)
{
#if DT2_MULTITHREADED_AUDIO
    AutoSpinLockRecursive lock(&_lock);
#endif
    
    // Save source for after reinitialize
    _save_channels.resize(_channels.size());
    
    for (DTuint c = 0; c < _channels.size(); ++c) {
        _save_channels[c]._source = RETAIN(_channels[c]._source);
        _save_channels[c]._sound_loader = RETAIN(_channels[c]._sound_loader);

        for (DTuint i = 0; i < ARRAY_SIZE(_save_channels[c]._packets); ++i) {
            _save_channels[c]._packets[i] = _channels[c]._packets[i];
        }
    }
    
    // Don't stop sound channels so that we can begin playing them again
	destroyChannels();   

    _x_master_voice->DestroyVoice();
    _x_master_voice = NULL;

    SAFE_RELEASE(_x_audio_2);
}
Exemplo n.º 2
0
void ComponentGUIScroller::hitTest (GUITouchEvent *event, GUIObject* &hit_object, const Color &parent_color)
{   
    GUIObject *gui = checkedCast<GUIObject*>(getOwner());
    if (!gui)
        return;
        
    Color c = parent_color * gui->getColor();

    if (c.getA() == 0)
        return;

    Vector2 object_pos = gui->positionToObjectCoord (event->getPosition());
    if (gui->getRectangle().isTouching(object_pos)) {
        
        hit_object = gui;

        std::list<PlaceableObject*> children = gui->getChildren();
        
        for (auto i : children) {
            GUIObject *gui = checkedCast<GUIObject*>(i);
            if (!gui)
                continue;
                
            gui->hitTest(event, _focused, c);
            if (_focused) {
                RETAIN(_focused);
                break;
            }
        }   

    }
}
Exemplo n.º 3
0
void decl_replace_with(decl *to, decl *from)
{
	/* XXX: memleak of .ref */
	memcpy_safe(&to->where, &from->where);
	to->ref      = from->ref;
	to->attr = RETAIN(from->attr);
	to->spel_asm = from->spel_asm;
	/* no point copying bitfield stuff */
	memcpy_safe(&to->bits, &from->bits);
}
Exemplo n.º 4
0
void decl_replace_with(decl *to, decl *from)
{
	attribute **i;

	/* XXX: memleak of .ref */
	memcpy_safe(&to->where, &from->where);
	to->ref      = from->ref;
	to->spel_asm = from->spel_asm, from->spel_asm = NULL;
	/* no point copying bitfield stuff */
	memcpy_safe(&to->bits, &from->bits);

	for(i = from->attr; i && *i; i++)
		dynarray_add(&to->attr, RETAIN(*i));
}
void TilesWidget::setTileSet(TileSet *tileSet)
{
    TileSet *oldTileSet = _tileSet;
    _tileSet = RETAIN(tileSet);
    RELEASE(oldTileSet);

    if (tileSet)
    {
        if (_tileEntries) free(_tileEntries);
        _tileEntries = (TileEntry *) malloc(tileSet->tileCount() * sizeof(TileEntry));

        // add new buttons
        int tileX = kBorder;
        int tileY = kBorder;
        int tileWidth = _tileSet->tileWidth();
        int tileHeight = _tileSet->tileHeight();
        for (int tileIndex = 0; tileIndex < tileSet->tileCount(); ++tileIndex)
        {
            TileEntry &entry = _tileEntries[tileIndex];
            entry.tileIndex = tileIndex;
            entry.x = tileX;
            entry.y = tileY;
            entry.w = tileWidth;
            entry.h = tileHeight;

            tileX += tileWidth + kBorder;
            if (tileX >= width())
            {
                tileX = kBorder;
                tileY += tileHeight + kBorder;
            }
        }
    }

    repaint();
}
Exemplo n.º 6
0
static void init_attr(type *ty, void *ctx)
{
	ty->bits.attr = RETAIN((attribute *)ctx);
}