2023-08-05 22:14:05 -04:00
|
|
|
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2021-12-06 21:15:31 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QImage>
|
|
|
|
#include <leptonica/allheaders.h>
|
2022-08-15 11:14:37 -04:00
|
|
|
#include <tesseract/baseapi.h>
|
2021-12-06 21:15:31 -05:00
|
|
|
|
2023-07-30 08:49:34 -04:00
|
|
|
enum class ScreenState { Splash, LobbyError, WorldFull, ConnectingToDataCenter, EnteredTitleScreen, InLoginQueue };
|
2021-12-06 21:15:31 -05:00
|
|
|
|
|
|
|
struct GameParseResult {
|
|
|
|
ScreenState state;
|
|
|
|
|
|
|
|
int playersInQueue = -1;
|
|
|
|
};
|
|
|
|
|
2023-07-30 08:49:34 -04:00
|
|
|
inline bool operator==(const GameParseResult a, const GameParseResult b)
|
|
|
|
{
|
2021-12-06 21:15:31 -05:00
|
|
|
return a.state == b.state && a.playersInQueue == b.playersInQueue;
|
|
|
|
}
|
|
|
|
|
2023-07-30 08:49:34 -04:00
|
|
|
inline bool operator!=(const GameParseResult a, const GameParseResult b)
|
|
|
|
{
|
2021-12-06 21:15:31 -05:00
|
|
|
return !(a == b);
|
|
|
|
}
|
|
|
|
|
2023-07-30 08:49:34 -04:00
|
|
|
class GameParser
|
|
|
|
{
|
2021-12-06 21:15:31 -05:00
|
|
|
public:
|
|
|
|
GameParser();
|
|
|
|
~GameParser();
|
|
|
|
|
|
|
|
GameParseResult parseImage(QImage image);
|
|
|
|
|
|
|
|
private:
|
2023-07-30 08:49:34 -04:00
|
|
|
tesseract::TessBaseAPI *api;
|
2021-12-06 21:15:31 -05:00
|
|
|
};
|