Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions arc-core/src/arc/scene/ui/Button.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,8 @@ public ButtonGroup getButtonGroup(){
return buttonGroup;
}

@Override
public void draw(){
validate();

/** Updates the background with the appropriate Drawable from the style before it is drawn. */
public void updateBackground(){
boolean isDisabled = isDisabled();
boolean isPressed = isPressed();
boolean isChecked = isChecked();
Expand All @@ -228,6 +226,14 @@ else if(isOver && style.over != null){
background = style.up;

setBackground(background);
}

@Override
public void draw(){
validate();

boolean isPressed = isPressed();
updateBackground();

float offsetX, offsetY;
if(isPressed && !isDisabled){
Expand Down
10 changes: 8 additions & 2 deletions arc-core/src/arc/scene/ui/TextButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ public void setStyle(ButtonStyle style){
}
}

@Override
public void draw(){

/** Updates the font color with the appropriate font color from the style before it is drawn. */
protected void updateFontColor(){
Color fontColor;
if(isDisabled() && style.disabledFontColor != null)
fontColor = style.disabledFontColor;
Expand All @@ -65,6 +66,11 @@ else if(isOver() && style.overFontColor != null)
else
fontColor = style.fontColor;
if(fontColor != null) label.getStyle().fontColor = fontColor;
}

@Override
public void draw(){
updateFontColor();
super.draw();
}

Expand Down