GetClass
This command can be used to identify the class of an unknown Object. The class id returned will be that of the lowest-order derived class. However, classes that are a driver-specific extension will only return the last general class they are derived from. For example, the OpenGL2Buffer and OpenGLES2Buffer classes will both return Object::BufferClass.
Syntax
Returns
Returns the Object's class id.
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();
DirectionalLight::Create()->SetRotation(35,45,0);
//Create a model
model = Model::Box();
model->SetPosition(0,0,3);
while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;
Leadwerks::Time::Update();
world->Update();
world->Render();
//Display the object class
if (model->GetClass()==Object::ModelClass)
{
Draw::SetBlendMode(Blend::Alpha);
Draw::Text("Class: Model",2,2);
Draw::SetBlendMode(Blend::Solid);
}
context->Sync();
}
return 0;
}