Skip to content

Commit

Permalink
Try disable tutorial on android TV to make google happy
Browse files Browse the repository at this point in the history
  • Loading branch information
deveee committed Nov 2, 2024
1 parent d37558f commit 721018c
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/modes/overworld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
#include "tracks/track.hpp"
#include "tracks/track_object_manager.hpp"

#ifdef ANDROID
#include <SDL_system.h>
#endif

//-----------------------------------------------------------------------------
OverWorld::OverWorld() : World()
{
Expand Down Expand Up @@ -242,6 +246,11 @@ void OverWorld::onFirePressed(Controller* who)
{
if (challenges[n].m_challenge_id == "tutorial")
{
#ifdef ANDROID
if (SDL_IsAndroidTV())
return;
#endif

scheduleTutorial();
return;
}
Expand Down
20 changes: 20 additions & 0 deletions src/states_screens/help/help_screen_1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include "guiengine/widgets/button_widget.hpp"
#include "modes/tutorial_utils.hpp"

#ifdef ANDROID
#include <SDL_system.h>
#endif

using namespace GUIEngine;

// -----------------------------------------------------------------------------
Expand All @@ -37,6 +41,22 @@ void HelpScreen1::loadedFromFile()

// -----------------------------------------------------------------------------

void HelpScreen1::beforeAddingWidget()
{
#ifdef ANDROID
if (SDL_IsAndroidTV())
{
Widget* tutorial = getWidget("startTutorial");
if (tutorial)
tutorial->setVisible(false);

Widget* tutorial_icon = getWidget("tutorialIcon");
if (tutorial_icon)
tutorial_icon->setVisible(false);
}
#endif
}

void HelpScreen1::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
if (name == "startTutorial")
Expand Down
3 changes: 3 additions & 0 deletions src/states_screens/help/help_screen_1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class HelpScreen1 : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<

/** \brief implement callback from parent class GUIEngine::Screen */
virtual void loadedFromFile() OVERRIDE;

/** \brief implement callback from parent class GUIEngine::Screen */
virtual void beforeAddingWidget() OVERRIDE;

/** \brief implement callback from parent class GUIEngine::Screen */
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
Expand Down
19 changes: 19 additions & 0 deletions src/states_screens/main_menu_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@

#include <IrrlichtDevice.h>

#ifdef ANDROID
#include <SDL_system.h>
#endif

using namespace GUIEngine;
using namespace Online;

Expand Down Expand Up @@ -119,6 +123,15 @@ void MainMenuScreen::beforeAddingWidget()
if (w)
w->setVisible(false);
#endif

#ifdef ANDROID
if (SDL_IsAndroidTV())
{
Widget* tutorial = getWidget("startTutorial");
if (tutorial)
tutorial->setVisible(false);
}
#endif
}

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -327,6 +340,12 @@ void MainMenuScreen::onUpdate(float delta)
if (player->getUseFrequency() != 0)
return;

#ifdef ANDROID
// Don't show tutorial dialog on Android TV
if (SDL_IsAndroidTV())
return;
#endif

player->incrementUseFrequency();
class PlayTutorial :
public MessageDialog::IConfirmDialogListener
Expand Down
10 changes: 10 additions & 0 deletions src/states_screens/race_gui_overworld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
#include <IrrlichtDevice.h>
#include <ISceneCollisionManager.h>
#include <ISceneManager.h>

#ifdef ANDROID
#include <SDL_system.h>
#endif

using namespace irr;

#include <algorithm>
Expand Down Expand Up @@ -526,6 +531,11 @@ void RaceGUIOverworld::drawGlobalMiniMap()

if (challenges[n].m_challenge_id == "tutorial")
{
#ifdef ANDROID
if (SDL_IsAndroidTV())
continue;
#endif

gui::ScalableFont* font = GUIEngine::getTitleFont();
font->draw(_("Tutorial"), pos, video::SColor(255,255,255,255),
false, true /* vcenter */, NULL);
Expand Down

0 comments on commit 721018c

Please sign in to comment.