fix textinput color on string change
This commit is contained in:
		
							parent
							
								
									42804cfe3c
								
							
						
					
					
						commit
						726ffe065e
					
				| @ -46,6 +46,7 @@ public class TextInput implements DrawableElement, FocusableElement, KeyEventEle | ||||
|     FocusEventCallback onFocusCallback; | ||||
|     FocusEventCallback onLoseFocusCallback; | ||||
|     KeyboardEventCallback onKeyPressCallback; | ||||
|     Vector3f color; | ||||
| 
 | ||||
|     String text = ""; | ||||
|     int textPixelWidth = 0; | ||||
| @ -60,6 +61,7 @@ public class TextInput implements DrawableElement, FocusableElement, KeyEventEle | ||||
|         this.width = 0; | ||||
|         this.height = (int)(FontUtils.getFontHeight() * fontSize); | ||||
|         this.fontSize = fontSize; | ||||
|         this.color = new Vector3f(1,1,1); | ||||
|     } | ||||
|      | ||||
|     void generateLetters(){ | ||||
| @ -69,6 +71,7 @@ public class TextInput implements DrawableElement, FocusableElement, KeyEventEle | ||||
|             char toDraw = text.charAt(i); | ||||
|             Vector3f bitMapDimension = FontUtils.getDimensionOfCharacterDiscrete(toDraw); | ||||
|             BitmapCharacter newLetter = new BitmapCharacter((int)(rollingOffset * fontSize) + positionX, positionY, (int)(bitMapDimension.x * fontSize), this.height, toDraw); | ||||
|             newLetter.setColor(color); | ||||
|             rollingOffset += (int)bitMapDimension.x; | ||||
|             childrenElements.add(newLetter); | ||||
|         } | ||||
| @ -85,6 +88,7 @@ public class TextInput implements DrawableElement, FocusableElement, KeyEventEle | ||||
|     } | ||||
| 
 | ||||
|     public void setColor(Vector3f color){ | ||||
|         this.color.set(color); | ||||
|         for(BitmapCharacter character : childrenElements){ | ||||
|             character.setColor(color); | ||||
|         } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user