예제 #1
0
void ff::Dict::SetSavedData(StringRef name, ISavedData *value)
{
	ComPtr<ISavedData> valueClone;
	assertRet(value && value->Clone(&valueClone));

	ValuePtr newValue;
	assertRet(Value::CreateSavedData(valueClone, &newValue));

	SetValue(name, newValue);
}
예제 #2
0
void ff::Dict::SetPoint(ff::StringRef name, ff::PointInt value)
{
	ValuePtr newValue;
	assertRet(Value::CreatePoint(value, &newValue));

	SetValue(name, newValue);
}
예제 #3
0
파일: Module.cpp 프로젝트: am11/ffcore
void ff::Module::LoadTypeLibs()
{
    assertRet(_typeLibs.IsEmpty());

    // Index zero is for no type lib
    _typeLibs.Push(ComPtr<ITypeLib>());

#if !METRO_APP
    String path = GetPath();

    for (size_t i = 1; ; i++)
    {
        ComPtr<ITypeLib> typeLib;
        if (::FindResource(_instance, MAKEINTRESOURCE(i), L"TYPELIB"))
        {
            String pathIndex = String::format_new(L"%s\\%lu", path.c_str(), i);
            verify(SUCCEEDED(::LoadTypeLibEx(pathIndex.c_str(), REGKIND_NONE, &typeLib)));
        }
        else
        {
            break;
        }

        _typeLibs.Push(typeLib);
    }
#endif
}
예제 #4
0
파일: Module.cpp 프로젝트: am11/ffcore
void ff::Module::RegisterClass(
    StringRef name,
    REFGUID classId,
    ClassFactoryFunc factory,
    REFGUID mainInterfaceId,
    REFGUID categoryId)
{
    assertRet(name.size() && classId != GUID_NULL);

    ModuleClassInfo info;
    info._name = name;
    info._classId = classId;
    info._mainInterfaceId = mainInterfaceId;
    info._categoryId = categoryId;
    info._factory = factory;
    info._module = this;

    _classesByName.Insert(name, info);
    _classesById.Insert(classId, info);

    if (mainInterfaceId != GUID_NULL)
    {
        _classesByIid.Insert(mainInterfaceId, info);
    }

    if (categoryId != GUID_NULL)
    {
        _classesByCatId.Insert(categoryId, info);
    }
}
예제 #5
0
void ff::Dict::SetResource(ff::StringRef name, const ff::SharedResourceValue &value)
{
	ValuePtr newValue;
	assertRet(Value::CreateResource(value, &newValue));

	SetValue(name, newValue);
}
예제 #6
0
void ff::Dict::SetDict(StringRef name, const Dict &value)
{
	ValuePtr newValue;
	assertRet(Value::CreateDict(Dict(value), &newValue));

	SetValue(name, newValue);
}
예제 #7
0
void ff::Dict::SetGuid(ff::StringRef name, REFGUID value)
{
	ValuePtr newValue;
	assertRet(Value::CreateGuid(value, &newValue));

	SetValue(name, newValue);
}
예제 #8
0
void ff::Dict::SetData(ff::StringRef name, ff::IData *value)
{
	ValuePtr newValue;
	assertRet(Value::CreateData(value, &newValue));

	SetValue(name, newValue);
}
예제 #9
0
void ff::Dict::SetString(ff::StringRef name, ff::StringRef value)
{
	ValuePtr newValue;
	assertRet(Value::CreateString(value, &newValue));

	SetValue(name, newValue);
}
예제 #10
0
void ff::Dict::SetDouble(ff::StringRef name, double value)
{
	ValuePtr newValue;
	assertRet(Value::CreateDouble(value, &newValue));

	SetValue(name, newValue);
}
예제 #11
0
void ff::Dict::SetFloat(ff::StringRef name, float value)
{
	ValuePtr newValue;
	assertRet(Value::CreateFloat(value, &newValue));

	SetValue(name, newValue);
}
예제 #12
0
void ff::Dict::SetBool(ff::StringRef name, bool value)
{
	ValuePtr newValue;
	assertRet(Value::CreateBool(value, &newValue));

	SetValue(name, newValue);
}
void ff::EntityDomain::UnregisterEntityWithSystem(EntityEntry *entityEntry, SystemEntry *systemEntry)
{
	BucketIter iter = systemEntry->_entities.Get(entityEntry->ToEntity());
	assertRet(iter != INVALID_ITER && entityEntry->_valid && !entityEntry->_active);

	systemEntry->_system->DeleteEntry(systemEntry->_entities.ValueAt(iter));
	systemEntry->_entities.DeletePos(iter);
}
void ff::ResourceValue::Invalidate(SharedResourceValue newValue)
{
	assertRet(newValue != nullptr);

	LockMutex lock(GCS_RESOURCE_VALUE);
	_newValue = newValue;
	_owner = nullptr;
}
예제 #15
0
void ff::SmallDict::RemoveAt(size_t index)
{
	size_t size = Size();
	assertRet(index < size);

	_data->entries[index].value->Release();
	::memmove(_data->entries + index, _data->entries + index + 1, (size - index - 1) * sizeof(Entry));
	_data->size--;
}
예제 #16
0
파일: BufferCache.cpp 프로젝트: am11/ffcore
void ff::BufferCache::ReturnBuffer(ID3D11Buffer *pBuffer)
{
	assertRet(pBuffer);

	size_t nBytes  = GetBufferSize(pBuffer);
	size_t nBuffer = GetBufferIndex(nBytes);

	_buffers[nBuffer].Insert(pBuffer);
}
예제 #17
0
파일: ViewWindow.cpp 프로젝트: am11/ffcore
void ff::ViewWindow::Activate()
{
	assertRet(IsValid());

	if (!_active)
	{
		_active = true;
		OnActivated();
		Layout();
	}
}
// Adds a new or deactivated entity to the systems that need to know about it
void ff::EntityDomain::ActivateEntity(Entity entity)
{
	EntityEntry *entityEntry = EntityEntry::FromEntity(entity);
	assertRet(entityEntry->_valid);

	if (!entityEntry->_active)
	{
		entityEntry->_active = true;
		RegisterActivatedEntity(entityEntry);
	}
}
// Keeps the entity in memory, but it will be removed from any systems that know about it
void ff::EntityDomain::DeactivateEntity(Entity entity)
{
	EntityEntry *entityEntry = EntityEntry::FromEntity(entity);
	assertRet(entityEntry->_valid);

	if (entityEntry->_active)
	{
		entityEntry->_active = false;
		UnregisterDeactivatedEntity(entityEntry);
	}
}
예제 #20
0
파일: ViewWindow.cpp 프로젝트: am11/ffcore
void ff::ViewWindow::Close()
{
	assertRet(IsValid());

	OnClosing();

#if !METRO_APP
	::SendMessage(Handle(), WM_CLOSE, 0, 0);
#endif

	OnClosed();
}
// Deletes an entity from memory and all systems that know about it
void ff::EntityDomain::DeleteEntity(Entity entity)
{
	EntityEntry *entityEntry = EntityEntry::FromEntity(entity);
	assertRet(entityEntry->_valid);

	DeactivateEntity(entity);

	entityEntry->_valid = false;
	_deletedEntities.Push(entityEntry);

	// Wait until frame cleanup to reclaim the entity memory
}
예제 #22
0
void ff::AtProgramShutdown(std::function<void()> func)
{
    assertRet(s_processGlobals != nullptr);

    if (s_processGlobals->IsShuttingDown())
    {
        assertSz(false, L"Why register a program shutdown function during shutdown?");
        func();
    }
    else
    {
        s_processGlobals->AtShutdown(func);
    }
}
예제 #23
0
void ff::SmallDict::SetAt(size_t index, Value *value)
{
	assertRet(index < Size());
	if (value)
	{
		value->AddRef();
		_data->entries[index].value->Release();
		_data->entries[index].value = value;
	}
	else
	{
		RemoveAt(index);
	}
}
예제 #24
0
void ff::SmallDict::Add(ff::StringRef key, Value *value)
{
	assertRet(value);
	value->AddRef();

	size_t size = Size();
	Reserve(size + 1);

	hash_t hash = _data->atomizer->CacheString(key);

	_data->entries[size].hash = hash;
	_data->entries[size].value = value;
	_data->size++;
}
예제 #25
0
파일: Module.cpp 프로젝트: am11/ffcore
void ff::Module::RegisterCreator(
    StringRef name,
    REFGUID creatorId,
    REFGUID classId)
{
    assertRet(name.size() && creatorId != GUID_NULL && classId != GUID_NULL);

    ModuleCreatorInfo info;
    info._name = name;
    info._creatorClassId = creatorId;
    info._classId = classId;
    info._module = this;

    _creatorsByName.Insert(name, info);
    _creatorsById.Insert(creatorId, info);
}
예제 #26
0
파일: Module.cpp 프로젝트: am11/ffcore
void ff::Module::RegisterCategory(
    StringRef name,
    REFGUID categoryId,
    ClassFactoryFunc parentObjectFactory)
{
    assertRet(name.size() && categoryId != GUID_NULL);

    ModuleCategoryInfo info;
    info._name = name;
    info._categoryId = categoryId;
    info._parentObjectFactory = parentObjectFactory;
    info._module = this;

    _categoriesByName.Insert(name, info);
    _categoriesById.Insert(categoryId, info);
}
예제 #27
0
파일: Module.cpp 프로젝트: am11/ffcore
void ff::Module::RegisterInterface(
    REFGUID interfaceId,
    REFGUID categoryId)
{
    assertRet(interfaceId != GUID_NULL);

    ModuleInterfaceInfo info;
    info._interfaceId = interfaceId;
    info._categoryId = categoryId;

    _interfacesById.Insert(interfaceId, info);

    if (categoryId != GUID_NULL)
    {
        _interfacesByCatId.Insert(categoryId, info);
    }
}
예제 #28
0
파일: ViewWindow.cpp 프로젝트: am11/ffcore
void ff::ViewWindow::Layout()
{
#if !METRO_APP
	noAssertRet(_allowLayout);
	assertRet(IsValid());
	noAssertRet(IsActive());

	_allowLayout = false;

	HWND parent = ::GetParent(Handle());
	RectInt windowRect = ff::GetClientRect(parent);

	SetWindowPos(Handle(), HWND_TOP, windowRect, SWP_SHOWWINDOW);
	LayoutChildren();

	_allowLayout = true;
#endif
}