mirror of
				https://github.com/nicbarker/clay.git
				synced 2025-11-04 08:36:17 +00:00 
			
		
		
		
	Added a new field to simplify creating and rendering custom elements.
This commit is contained in:
		
							parent
							
								
									91c6d05774
								
							
						
					
					
						commit
						becd07cca9
					
				
							
								
								
									
										4
									
								
								clay.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								clay.h
									
									
									
									
									
								
							| 
						 | 
					@ -512,6 +512,7 @@ CLAY__WRAPPER_STRUCT(Clay_FloatingElementConfig);
 | 
				
			||||||
typedef struct Clay_CustomElementConfig {
 | 
					typedef struct Clay_CustomElementConfig {
 | 
				
			||||||
    // A transparent pointer through which you can pass custom data to the renderer.
 | 
					    // A transparent pointer through which you can pass custom data to the renderer.
 | 
				
			||||||
    // Generates CUSTOM render commands.
 | 
					    // Generates CUSTOM render commands.
 | 
				
			||||||
 | 
					    uint32_t customCommandId;
 | 
				
			||||||
    void* customData;
 | 
					    void* customData;
 | 
				
			||||||
} Clay_CustomElementConfig;
 | 
					} Clay_CustomElementConfig;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -598,6 +599,8 @@ typedef struct Clay_CustomRenderData {
 | 
				
			||||||
    // Controls the "radius", or corner rounding of this custom element.
 | 
					    // Controls the "radius", or corner rounding of this custom element.
 | 
				
			||||||
    // The rounding is determined by drawing a circle inset into the element corner by (radius, radius) pixels.
 | 
					    // The rounding is determined by drawing a circle inset into the element corner by (radius, radius) pixels.
 | 
				
			||||||
    Clay_CornerRadius cornerRadius;
 | 
					    Clay_CornerRadius cornerRadius;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    uint32_t customCommandId;
 | 
				
			||||||
    // A pointer transparently passed through from the original element definition.
 | 
					    // A pointer transparently passed through from the original element definition.
 | 
				
			||||||
    void* customData;
 | 
					    void* customData;
 | 
				
			||||||
} Clay_CustomRenderData;
 | 
					} Clay_CustomRenderData;
 | 
				
			||||||
| 
						 | 
					@ -2919,6 +2922,7 @@ void Clay__CalculateFinalLayout(void) {
 | 
				
			||||||
                                    .backgroundColor = sharedConfig->backgroundColor,
 | 
					                                    .backgroundColor = sharedConfig->backgroundColor,
 | 
				
			||||||
                                    .cornerRadius = sharedConfig->cornerRadius,
 | 
					                                    .cornerRadius = sharedConfig->cornerRadius,
 | 
				
			||||||
                                    .customData = elementConfig->config.customElementConfig->customData,
 | 
					                                    .customData = elementConfig->config.customElementConfig->customData,
 | 
				
			||||||
 | 
					                                    .customCommandId = elementConfig->config.customElementConfig->customCommandId
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                            };
 | 
					                            };
 | 
				
			||||||
                            emitRectangle = false;
 | 
					                            emitRectangle = false;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue