Just breaking stuff
This commit is contained in:
25
archive/dawntictactoe/components/TicTacToeScoreboard.cpp
Normal file
25
archive/dawntictactoe/components/TicTacToeScoreboard.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "TicTacToeScoreboard.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
TicTacToeScoreboard::TicTacToeScoreboard(SceneItem *item) :
|
||||
SceneItemComponent(item)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TicTacToeScoreboard::onStart() {
|
||||
auto game = getScene()->findComponent<TicTacToeGame>();
|
||||
assertNotNull(game);
|
||||
|
||||
useEffect([&]{
|
||||
auto label = item->getComponent<UILabel>();
|
||||
assertNotNull(label);
|
||||
label->text = std::to_string(game->scoreNought) + " - " + std::to_string(game->scoreCross);
|
||||
}, { &game->scoreCross, &game->scoreNought })();
|
||||
}
|
Reference in New Issue
Block a user