Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Moving touchListener Comment up; snake_case fix
  • Loading branch information
Grant-Postma committed Jun 5, 2020
commit 3ce4079c77ad5ce127753e6012d0e2d38bc7ecdb
10 changes: 5 additions & 5 deletions demos/TicTacToe/Classes/TicTacToeScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ bool TicTacToe::init() {
board_sprite->setPosition(0, 0);
board_sprite->setAnchorPoint(Vec2(0.0, 0.0));

auto touchListener = EventListenerTouchOneByOne::create();
// Adding a function to determine which tile was selected to the onTouchBegan
// listener.
touchListener->onTouchBegan = [board_sprite, current_player_index](
Touch* touch,
Event* event) mutable -> bool {
auto touch_listener = EventListenerTouchOneByOne::create();
touch_listener->onTouchBegan = [board_sprite, current_player_index](
Touch* touch,
Event* event) mutable -> bool {
auto bounds = event->getCurrentTarget()->getBoundingBox();

if (bounds.containsPoint(touch->getLocation())) {
Expand All @@ -88,7 +88,7 @@ bool TicTacToe::init() {

Director::getInstance()
->getEventDispatcher()
->addEventListenerWithSceneGraphPriority(touchListener, board_sprite);
->addEventListenerWithSceneGraphPriority(touch_listener, board_sprite);

this->addChild(board_sprite);

Expand Down