ZhouWeikuan/cocos2d — Issue #46: CCMenuItemSprite images not visible
Author: mochibits
Created: 2011-11-02 22:50:15+00:00
State: open

Selected and disabled image not being displayed. Visible flags not being set. See code below for my fix. Maybe there's a better way though.

@Override
public void draw(GL10 gl) {
if (isEnabled_) {
if (isSelected_) {
normalImage_.setVisible(false);
selectedImage_.setVisible(true);
selectedImage_.draw(gl);
} else {
normalImage_.setVisible(true);
selectedImage_.setVisible(false);
normalImage_.draw(gl);
}
} else {
if (disabledImage_ != null) {
normalImage_.setVisible(false);
disabledImage_.setVisible(true);
disabledImage_.draw(gl);

// disabled image was not provided
} else {
normalImage_.setVisible(true);
disabledImage_.setVisible(false);
normalImage_.draw(gl);
}
}
}