mirror of
https://github.com/nicbarker/clay.git
synced 2025-04-20 05:08:04 +00:00
More readme fixes
This commit is contained in:
parent
04239a2c6e
commit
71bd99191e
@ -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.
|
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
|
```Odin
|
||||||
renderCommands: clay.RenderCommandArray = clay.EndLayout(windowWidth, windowHeight);
|
renderCommands: clay.ClayArray(clay.RenderCommand) = clay.EndLayout(windowWidth, windowHeight)
|
||||||
|
|
||||||
for i := 0; i < renderCommands.length; i += 1 {
|
for i: u32 = 0; i < renderCommands.length; i += 1 {
|
||||||
renderCommand := clay.RenderCommandArray_Get(renderCommands, cast(i32)i)
|
renderCommand := clay.RenderCommandArray_Get(&renderCommands, cast(i32)i)
|
||||||
|
|
||||||
switch (renderCommand->commandType) {
|
switch renderCommand.commandType {
|
||||||
case CLAY_RENDER_COMMAND_TYPE_RECTANGLE: {
|
case .Rectangle:
|
||||||
DrawRectangle(
|
{
|
||||||
renderCommand.boundingBox,
|
DrawRectangle(renderCommand.boundingBox, renderCommand.config.rectangleElementConfig.color)
|
||||||
renderCommand.config.rectangleElementConfig.color);
|
|
||||||
}
|
}
|
||||||
// ... Implement handling of other command types
|
// ... Implement handling of other command types
|
||||||
}
|
}
|
||||||
|
@ -58,5 +58,18 @@ CreateLayout :: proc() -> clay.ClayArray(clay.RenderCommand) {
|
|||||||
clay.RectangleConfig({color = COLOR_LIGHT}),
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user