mirror of
				https://github.com/nicbarker/clay.git
				synced 2025-11-04 00:26:17 +00:00 
			
		
		
		
	c++ compiler fixes
This commit is contained in:
		
							parent
							
								
									df90a51a0f
								
							
						
					
					
						commit
						e9dc187f1a
					
				
							
								
								
									
										8
									
								
								clay.h
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								clay.h
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -1555,7 +1555,7 @@ Clay__MeasureTextCacheItem *Clay__MeasureTextCached(Clay_String *text, Clay_Text
 | 
			
		|||
        char current = text->chars[end];
 | 
			
		||||
        if (current == ' ' || current == '\n') {
 | 
			
		||||
            uint32_t length = end - start;
 | 
			
		||||
            Clay_String word = CLAY__INIT(Clay_String) { .length = length, .chars = &text->chars[start] };
 | 
			
		||||
            Clay_String word = CLAY__INIT(Clay_String) { .length = (int)length, .chars = &text->chars[start] };
 | 
			
		||||
            Clay_Dimensions dimensions = Clay__MeasureText(&word, config);
 | 
			
		||||
            if (current == ' ') {
 | 
			
		||||
                dimensions.width += spaceWidth;
 | 
			
		||||
| 
						 | 
				
			
			@ -1573,7 +1573,7 @@ Clay__MeasureTextCacheItem *Clay__MeasureTextCached(Clay_String *text, Clay_Text
 | 
			
		|||
        }
 | 
			
		||||
        end++;
 | 
			
		||||
    }
 | 
			
		||||
    Clay_String lastWord = CLAY__INIT(Clay_String) { .length = end - start, .chars = &text->chars[start] };
 | 
			
		||||
    Clay_String lastWord = CLAY__INIT(Clay_String) { .length = (int)(end - start), .chars = &text->chars[start] };
 | 
			
		||||
    Clay_Dimensions dimensions = Clay__MeasureText(&lastWord, config);
 | 
			
		||||
    Clay__MeasuredWordArray_Add(&Clay__measuredWords, CLAY__INIT(Clay__MeasuredWord) { .word = lastWord, .startOffset = start, .length = end - start, .width = dimensions.width });
 | 
			
		||||
    measuredWidth += dimensions.width;
 | 
			
		||||
| 
						 | 
				
			
			@ -2145,7 +2145,7 @@ void Clay__CalculateFinalLayout() {
 | 
			
		|||
            Clay__MeasuredWord *measuredWord = Clay__MeasuredWordArraySlice_Get(&measureTextCacheItem->measuredWords, wordIndex);
 | 
			
		||||
            // measuredWord->length == 0 means a newline character
 | 
			
		||||
            if (measuredWord->length == 0 || lineWidth + measuredWord->width > containerElement->dimensions.width) {
 | 
			
		||||
                Clay__StringArray_Add(&Clay__wrappedTextLines, CLAY__INIT(Clay_String) {.length = lineLengthChars, .chars = &textElementData->text.chars[lineStartOffset] });
 | 
			
		||||
                Clay__StringArray_Add(&Clay__wrappedTextLines, CLAY__INIT(Clay_String) {.length = (int)lineLengthChars, .chars = &textElementData->text.chars[lineStartOffset] });
 | 
			
		||||
                textElementData->wrappedLines.length++;
 | 
			
		||||
                if (lineLengthChars > 0 && measuredWord->length > 0) {
 | 
			
		||||
                    wordIndex--;
 | 
			
		||||
| 
						 | 
				
			
			@ -2159,7 +2159,7 @@ void Clay__CalculateFinalLayout() {
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (lineLengthChars > 0) {
 | 
			
		||||
            Clay__StringArray_Add(&Clay__wrappedTextLines, CLAY__INIT(Clay_String) {.length = lineLengthChars, .chars = &textElementData->text.chars[lineStartOffset] });
 | 
			
		||||
            Clay__StringArray_Add(&Clay__wrappedTextLines, CLAY__INIT(Clay_String) {.length = (int)lineLengthChars, .chars = &textElementData->text.chars[lineStartOffset] });
 | 
			
		||||
            textElementData->wrappedLines.length++;
 | 
			
		||||
        }
 | 
			
		||||
        containerElement->dimensions.height = lineHeight * textElementData->wrappedLines.length;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue