More readme fixes

This commit is contained in:
Nic Barker 2024-08-30 21:28:09 +12:00
parent 04239a2c6e
commit 71bd99191e
2 changed files with 26 additions and 14 deletions

View File

@ -121,17 +121,16 @@ CreateLayout :: proc() -> clay.ClayArray(clay.RenderCommand) {
6. Call [clay.EndLayout(screenWidth, screenHeight)](https://github.com/nicbarker/clay/blob/main/README.md#clay_endlayout) and process the resulting [clay.RenderCommandArray](https://github.com/nicbarker/clay/blob/main/README.md#clay_rendercommandarray) in your choice of renderer.
```C
renderCommands: clay.RenderCommandArray = clay.EndLayout(windowWidth, windowHeight);
```Odin
renderCommands: clay.ClayArray(clay.RenderCommand) = clay.EndLayout(windowWidth, windowHeight)
for i := 0; i < renderCommands.length; i += 1 {
renderCommand := clay.RenderCommandArray_Get(renderCommands, cast(i32)i)
for i: u32 = 0; i < renderCommands.length; i += 1 {
renderCommand := clay.RenderCommandArray_Get(&renderCommands, cast(i32)i)
switch (renderCommand->commandType) {
case CLAY_RENDER_COMMAND_TYPE_RECTANGLE: {
DrawRectangle(
renderCommand.boundingBox,
renderCommand.config.rectangleElementConfig.color);
switch renderCommand.commandType {
case .Rectangle:
{
DrawRectangle(renderCommand.boundingBox, renderCommand.config.rectangleElementConfig.color)
}
// ... Implement handling of other command types
}

View File

@ -58,5 +58,18 @@ CreateLayout :: proc() -> clay.ClayArray(clay.RenderCommand) {
clay.RectangleConfig({color = COLOR_LIGHT}),
) {}
}
// ...
renderCommands: clay.ClayArray(clay.RenderCommand) = clay.EndLayout(windowWidth, windowHeight)
for i: u32 = 0; i < renderCommands.length; i += 1 {
renderCommand := clay.RenderCommandArray_Get(&renderCommands, cast(i32)i)
switch renderCommand.commandType {
case .Rectangle:
{
DrawRectangle(renderCommand.boundingBox, renderCommand.config.rectangleElementConfig.color)
}
// ... Implement handling of other command types
}
}
}