| 18 | class PlayerCountLabel : public CCNode { |
| 19 | public: |
| 20 | bool init(bool compressed) { |
| 21 | if (!CCNode::init()) return false; |
| 22 | |
| 23 | this->compressed = compressed; |
| 24 | |
| 25 | if (compressed) { |
| 26 | this->setLayout(RowLayout::create()->setGap(3.f)); |
| 27 | this->setContentWidth(100.f); |
| 28 | |
| 29 | Build<CCLabelBMFont>::create("", "bigFont.fnt") |
| 30 | .parent(this) |
| 31 | .store(label); |
| 32 | |
| 33 | Build<CCSprite>::create("icon-person.png"_spr) |
| 34 | .parent(this) |
| 35 | .store(icon); |
| 36 | } else { |
| 37 | Build<CCLabelBMFont>::create("", "bigFont.fnt") |
| 38 | .parent(this) |
| 39 | .store(label); |
| 40 | } |
| 41 | |
| 42 | return true; |
| 43 | } |
| 44 | |
| 45 | void updateCount(size_t players) { |
| 46 | if (players == 0) { |