Fixed screen rotation
This commit is contained in:
@ -6,6 +6,9 @@
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
#include "screens.h"
|
||||
|
||||
void GameOfLifeDisplay::start()
|
||||
{
|
||||
Base::start();
|
||||
@ -18,6 +21,8 @@ void GameOfLifeDisplay::initScreen()
|
||||
{
|
||||
Base::initScreen();
|
||||
|
||||
disableScreenFlip(true);
|
||||
|
||||
espgui::tft.setRotation(3);
|
||||
espgui::tft.fillScreen(TFT_BLACK);
|
||||
}
|
||||
@ -45,7 +50,8 @@ void GameOfLifeDisplay::stop()
|
||||
{
|
||||
Base::stop();
|
||||
|
||||
espgui::tft.setRotation(0);
|
||||
disableScreenFlip(false);
|
||||
|
||||
m_grid = nullptr;
|
||||
m_newgrid = nullptr;
|
||||
}
|
||||
|
@ -6,6 +6,9 @@
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
#include <screens.h>
|
||||
|
||||
PingPongDisplay::PingPongDisplay() :
|
||||
lpaddle_y(cpputils::randomNumber<uint8_t>(0, h - paddle_h, espcpputils::esp_random_device{})),
|
||||
rpaddle_y(cpputils::randomNumber<uint8_t>(0, h - paddle_h, espcpputils::esp_random_device{})),
|
||||
@ -19,6 +22,8 @@ void PingPongDisplay::initScreen()
|
||||
{
|
||||
Base::initScreen();
|
||||
|
||||
disableScreenFlip(true);
|
||||
|
||||
espgui::tft.fillScreen(TFT_BLACK);
|
||||
espgui::tft.setRotation(1);
|
||||
|
||||
@ -41,7 +46,7 @@ void PingPongDisplay::stop()
|
||||
{
|
||||
Base::stop();
|
||||
|
||||
espgui::tft.setRotation(0);
|
||||
disableScreenFlip(false);
|
||||
}
|
||||
|
||||
void PingPongDisplay::buttonPressed(espgui::Button button)
|
||||
|
@ -7,6 +7,9 @@
|
||||
#include <screenmanager.h>
|
||||
#include <tftinstance.h>
|
||||
|
||||
// local includes
|
||||
#include "screens.h"
|
||||
|
||||
namespace {
|
||||
typedef unsigned char byte;
|
||||
} // namespace
|
||||
@ -15,6 +18,7 @@ void SpiroDisplay::initScreen()
|
||||
{
|
||||
Base::initScreen();
|
||||
|
||||
disableScreenFlip(true);
|
||||
espgui::tft.setRotation(3);
|
||||
}
|
||||
|
||||
@ -79,7 +83,7 @@ void SpiroDisplay::stop()
|
||||
{
|
||||
Base::stop();
|
||||
|
||||
espgui::tft.setRotation(0);
|
||||
disableScreenFlip(false);
|
||||
}
|
||||
|
||||
void SpiroDisplay::buttonPressed(espgui::Button button)
|
||||
|
@ -7,8 +7,9 @@
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "displays/menus/demosmenu.h"
|
||||
#include "globals.h"
|
||||
#include "screens.h"
|
||||
|
||||
StarfieldDisplay::StarfieldDisplay() :
|
||||
za(cpputils::randomNumber<uint8_t>(espcpputils::esp_random_device{})),
|
||||
@ -22,6 +23,8 @@ void StarfieldDisplay::initScreen()
|
||||
{
|
||||
Base::initScreen();
|
||||
|
||||
disableScreenFlip(true);
|
||||
|
||||
espgui::tft.fillScreen(TFT_BLACK);
|
||||
espgui::tft.setRotation(1);
|
||||
|
||||
@ -75,8 +78,7 @@ void StarfieldDisplay::redraw()
|
||||
void StarfieldDisplay::stop()
|
||||
{
|
||||
Base::stop();
|
||||
|
||||
espgui::tft.setRotation(0);
|
||||
disableScreenFlip(false);
|
||||
}
|
||||
|
||||
void StarfieldDisplay::buttonPressed(espgui::Button button)
|
||||
|
@ -13,6 +13,10 @@ using namespace espgui;
|
||||
|
||||
Label bootLabel{32, 250};
|
||||
|
||||
namespace {
|
||||
bool disable_screen_flip{false};
|
||||
}
|
||||
|
||||
void initScreen()
|
||||
{
|
||||
// vertical screen
|
||||
@ -54,7 +58,8 @@ void updateDisplay()
|
||||
changeScreenCallback = {};
|
||||
}
|
||||
|
||||
updateRotation();
|
||||
if (!disable_screen_flip)
|
||||
updateRotation();
|
||||
|
||||
if (const int8_t rawButton = rawButtonRequest.load(); rawButton != -1 && currentDisplay)
|
||||
{
|
||||
@ -85,3 +90,8 @@ void redrawDisplay()
|
||||
currentDisplay->redraw();
|
||||
}
|
||||
}
|
||||
|
||||
void disableScreenFlip(bool enable)
|
||||
{
|
||||
disable_screen_flip = enable;
|
||||
}
|
||||
|
@ -9,3 +9,4 @@ void initScreen();
|
||||
void updateDisplay();
|
||||
void updateRotation();
|
||||
void redrawDisplay();
|
||||
void disableScreenFlip(bool enable);
|
||||
|
Reference in New Issue
Block a user