为什么此代码不起作用? 按钮应为绿色,但仍为白色。 如果我使用纹理而不是Sprites,则代码可以完美运行。
game.interface_batch.begin();
...
game.interface_batch.setColor(0.596f, 0.984f, 0.596f, 1.0f);
exit_button_sprite.draw(game.interface_batch);
play_button_sprite.draw(game.interface_batch);
settings_button_sprite.draw(game.interface_batch);
game.interface_batch.setColor(1.0f, 1.0f, 1.0f, 1.0f);
...
game.interface_batch.end();
如何更改多个Sprite的颜色? 这样的代码对于3个以上的精灵来说确实很繁重:
exit_button_sprite.setColor(0.596f, 0.984f, 0.596f, 1.0f);
play_button_sprite.setColor(0.596f, 0.984f, 0.596f, 1.0f);
settings_button_sprite.setColor(0.596f, 0.984f, 0.596f, 1.0f);
exit_button_sprite.draw(game.interface_batch);
play_button_sprite.draw(game.interface_batch);
settings_button_sprite.draw(game.interface_batch);