I've been searching online for hours and I'm new to LibGDX game development. This link was useful, but I still have not been able make my CheckBox work. How to properly implement CheckBox in LibGDX
I'm using LibGDX and I have to implement two Radio buttons in my menu.
I created two CheckBox and assigned them a style.
check_style = new CheckBox.CheckBoxStyle();
check_style.font = font;
check_style.fontColor = new Color(Color.WHITE);
check_style.checkboxOff = check_skin.getDrawable("checkbox");
check_style.checkboxOn = check_skin.getDrawable("checkbox2");
check_style.checked = check_skin.getDrawable("checkbox2");
I also added a listener to notice mouse clicks
controls1Check.addListener(new InputListener() {
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
controls1Check.toggle();
System.out.println("toggle");
}
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
System.out.println("Controls1: " + controls1Check.isChecked());
return true;
};
});
When I run my program it does not respond to any mouse click. How can I resolve this?
Thank you!
Aucun commentaire:
Enregistrer un commentaire