mirror of
				https://github.com/nicbarker/clay.git
				synced 2025-11-04 08:36:17 +00:00 
			
		
		
		
	[Bindings/Odin] Update README to better match official website example. (#422)
This commit is contained in:
		
							parent
							
								
									5eceb52abc
								
							
						
					
					
						commit
						a3003cfa12
					
				| 
						 | 
					@ -41,10 +41,10 @@ error_handler :: proc "c" (errorData: clay.ErrorData) {
 | 
				
			||||||
    // Do something with the error data.
 | 
					    // Do something with the error data.
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
min_memory_size: u32 = clay.MinMemorySize()
 | 
					min_memory_size := clay.MinMemorySize()
 | 
				
			||||||
memory := make([^]u8, min_memory_size)
 | 
					memory := make([^]u8, min_memory_size)
 | 
				
			||||||
arena: clay.Arena = clay.CreateArenaWithCapacityAndMemory(min_memory_size, memory)
 | 
					arena: clay.Arena = clay.CreateArenaWithCapacityAndMemory(uint(min_memory_size), memory)
 | 
				
			||||||
clay.Initialize(arena, { width = 1080, height = 720 }, { handler = error_handler })
 | 
					clay.Initialize(arena, {1080, 720}, { handler = error_handler })
 | 
				
			||||||
``` 
 | 
					``` 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
3. Provide a `measure_text(text, config)` proc "c" with [clay.SetMeasureTextFunction(function)](https://github.com/nicbarker/clay/blob/main/README.md#clay_setmeasuretextfunction) so that Clay can measure and wrap text.
 | 
					3. Provide a `measure_text(text, config)` proc "c" with [clay.SetMeasureTextFunction(function)](https://github.com/nicbarker/clay/blob/main/README.md#clay_setmeasuretextfunction) so that Clay can measure and wrap text.
 | 
				
			||||||
| 
						 | 
					@ -74,7 +74,7 @@ clay.SetMeasureTextFunction(measure_text, nil)
 | 
				
			||||||
```Odin
 | 
					```Odin
 | 
				
			||||||
// Update internal pointer position for handling mouseover / click / touch events
 | 
					// Update internal pointer position for handling mouseover / click / touch events
 | 
				
			||||||
clay.SetPointerState(
 | 
					clay.SetPointerState(
 | 
				
			||||||
    clay.Vector2 { mouse_pos_x, mouse_pos_y },
 | 
					    { mouse_pos_x, mouse_pos_y },
 | 
				
			||||||
    is_mouse_down,
 | 
					    is_mouse_down,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
| 
						 | 
					@ -148,6 +148,7 @@ create_layout :: proc() -> clay.ClayArray(clay.RenderCommand) {
 | 
				
			||||||
                        sizing = { width = clay.SizingFixed(60), height = clay.SizingFixed(60) },
 | 
					                        sizing = { width = clay.SizingFixed(60), height = clay.SizingFixed(60) },
 | 
				
			||||||
                    },
 | 
					                    },
 | 
				
			||||||
                    image = {
 | 
					                    image = {
 | 
				
			||||||
 | 
					                        // How you define `profile_picture` depends on your renderer.
 | 
				
			||||||
                        imageData = &profile_picture,
 | 
					                        imageData = &profile_picture,
 | 
				
			||||||
                        sourceDimensions = {
 | 
					                        sourceDimensions = {
 | 
				
			||||||
                            width = 60,
 | 
					                            width = 60,
 | 
				
			||||||
| 
						 | 
					@ -179,8 +180,7 @@ create_layout :: proc() -> clay.ClayArray(clay.RenderCommand) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Returns a list of render commands
 | 
					    // Returns a list of render commands
 | 
				
			||||||
    render_commands: clay.ClayArray(clay.RenderCommand) = clay.EndLayout()
 | 
					    return clay.EndLayout()
 | 
				
			||||||
    return render_commands
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue