Some sample LE3 code
Here's some LE3 code for a simple program. The Graphics / Window stuff is not worked out 100%, and it's a little tricky because of the different operating systems and different kinds of windows.
I think we'll see a little more consistency across various languages with the LE3 syntax. It was suggested that the C syntax use the following scheme:
verb-class-noun
SetEntityPosition() GetMaterialTexture()
I agree with this suggestion.
SetGraphicsDriver( OpenGLGraphicsDriver() );
CreateGraphics(1024,768,4);
World* world = CreateWorld();
//Load a shader
Shader* shader = LoadShader("Shaders/minimal.shader");
//Create a material;
Material* mat = CreateMaterial();
mat->SetShader(shader);
mat->SetColor(1,0,0,1);
//Create a box;
Mesh* box = CreateMeshBox(1,1,1);
box->SetMaterial(mat);
Camera* camera = CreateCamera();
camera->SetClearColor( Vec4(0,1,0,1) );
box->SetPosition(0,0,-2,false);
float yaw = 0.0;
while (!window->Closed())
{
yaw++;
box->SetRotation(yaw,0,0,false);
camera->Render();
window->Flip();
}
76 Comments
Recommended Comments