Clear
This function releases all entities in the specified world.
Syntax
- void Clear(bool force=false)
Parameters
- force: if set to false, all top-level entities will have their reference count decremented by one, and deleted if their reference count reaches zero. If set to true, all entities in the world will have their reference count decremented until it reaches zero, and then they will be deleted. Unless you have manually incremented the reference count of any entity, the two modes will behave the same.
Example
#include "Leadwerks.h"
using namespace Leadwerks;
Model* model = NULL;
int main(int argc, const char *argv[])
{
Leadwerks::Window* window = Leadwerks::Window::Create();
Context* context = Context::Create(window);
World* world = World::Create();
Camera* camera = Camera::Create();
camera->Move(0,0,-3);
Light* light = DirectionalLight::Create();
light->SetRotation(35,35,0);
model = Model::Box();
model->SetColor(0.0,0.0,1.0);
while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;
model->Turn(0,Leadwerks::Time::GetSpeed(),0);
Leadwerks::Time::Update();
world->Update();
world->Render();
context->Sync(false);
}
return 0;
}