mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-27 12:15:19 +01:00
Move AnimeRun, LastDraw, CurrentFrame to FILM
This commit is contained in:
parent
22ba40a466
commit
1ec5726f01
@ -2569,7 +2569,7 @@ UINTN REFIT_MENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABSTRAC
|
||||
|
||||
while (!MenuExit) {
|
||||
GetAnime();
|
||||
DBG("AnimeRun=%d\n", AnimeRun?1:0);
|
||||
DBG("AnimeRun=%d\n", FilmC->AnimeRun?1:0);
|
||||
MenuExit = RunGenericMenu(MainStyle, &DefaultEntryIndex, &MainChosenEntry);
|
||||
TimeoutSeconds = 0;
|
||||
|
||||
|
@ -85,11 +85,11 @@ public:
|
||||
EG_RECT OldTextBufferRect;
|
||||
XImage OldTextBufferImage;
|
||||
BOOLEAN isBootScreen;
|
||||
BOOLEAN AnimeRun;
|
||||
//BOOLEAN Once;
|
||||
//same for xcinema
|
||||
UINT64 LastDraw;
|
||||
INTN CurrentFrame;
|
||||
// BOOLEAN AnimeRun;
|
||||
// UINT64 LastDraw;
|
||||
// INTN CurrentFrame;
|
||||
// INTN Frames; //there are FilmC properties
|
||||
// UINTN FrameTime; //ms
|
||||
// EG_RECT FilmPlace;
|
||||
@ -120,26 +120,26 @@ public:
|
||||
|
||||
|
||||
REFIT_MENU_SCREEN()
|
||||
: ID(0), Title(), TitleImage(),
|
||||
TimeoutSeconds(0), TimeoutText(), ThemeName(),
|
||||
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
||||
AnimeRun(0), LastDraw(0), CurrentFrame(0),
|
||||
: ID(0), Title(), TitleImage(),
|
||||
TimeoutSeconds(0), TimeoutText(), ThemeName(),
|
||||
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
||||
/*AnimeRun(0), LastDraw(0), CurrentFrame(0),*/
|
||||
FilmC(),
|
||||
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||
{};
|
||||
{};
|
||||
REFIT_MENU_SCREEN(UINTN ID, XStringW TTitle, XStringW TTimeoutText)
|
||||
: ID(ID), Title(TTitle), TitleImage(),
|
||||
TimeoutSeconds(0), TimeoutText(TTimeoutText), ThemeName(),
|
||||
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
||||
AnimeRun(0), LastDraw(0), CurrentFrame(0),
|
||||
/*AnimeRun(0), LastDraw(0), CurrentFrame(0),*/
|
||||
FilmC(),
|
||||
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||
{};
|
||||
//TODO exclude CHAR16
|
||||
REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* TitleC, CONST CHAR16* TimeoutTextC)
|
||||
: ID(ID), Title(), TitleImage(),
|
||||
TimeoutSeconds(0), TimeoutText(), ThemeName(), AnimeRun(0),
|
||||
LastDraw(0), CurrentFrame(0),
|
||||
TimeoutSeconds(0), TimeoutText(), ThemeName(),
|
||||
/*AnimeRun(0), LastDraw(0), CurrentFrame(0),*/
|
||||
FilmC(),
|
||||
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||
{
|
||||
@ -151,7 +151,7 @@ public:
|
||||
: ID(ID), Title(TTitle), TitleImage(),
|
||||
TimeoutSeconds(0), TimeoutText(TTimeoutText), ThemeName(),
|
||||
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
||||
AnimeRun(0), LastDraw(0), CurrentFrame(0),
|
||||
/*AnimeRun(0), LastDraw(0), CurrentFrame(0),*/
|
||||
FilmC(),
|
||||
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||
{
|
||||
|
@ -31,14 +31,14 @@
|
||||
|
||||
VOID REFIT_MENU_SCREEN::UpdateFilm()
|
||||
{
|
||||
if (FilmC == nullptr || !AnimeRun) {
|
||||
// DBG("no anime -> run=%d\n", AnimeRun?1:0);
|
||||
if (FilmC == nullptr || !FilmC->AnimeRun) {
|
||||
// DBG("no anime -> run=%d\n", FilmC->AnimeRun?1:0);
|
||||
return;
|
||||
}
|
||||
// here we propose each screen has own link to a Film
|
||||
INT64 Now = AsmReadTsc();
|
||||
|
||||
if (LastDraw == 0) {
|
||||
if (FilmC->LastDraw == 0) {
|
||||
DBG("=== Update Film ===\n");
|
||||
DBG("FilmX=%lld\n", FilmC->FilmX);
|
||||
DBG("ID=%lld\n", FilmC->GetIndex());
|
||||
@ -50,7 +50,7 @@ VOID REFIT_MENU_SCREEN::UpdateFilm()
|
||||
|
||||
}
|
||||
|
||||
if (TimeDiff(LastDraw, Now) < (UINTN)FilmC->FrameTime) return;
|
||||
if (TimeDiff(FilmC->LastDraw, Now) < (UINTN)FilmC->FrameTime) return;
|
||||
|
||||
XImage Frame = FilmC->GetImage(); //take current image
|
||||
if (!Frame.isEmpty()) {
|
||||
@ -58,9 +58,9 @@ VOID REFIT_MENU_SCREEN::UpdateFilm()
|
||||
}
|
||||
FilmC->Advance(); //next frame no matter if previous was not found
|
||||
if (FilmC->Finished()) { //first loop finished
|
||||
AnimeRun = !FilmC->RunOnce; //will stop anime if it set as RunOnce
|
||||
FilmC->AnimeRun = !FilmC->RunOnce; //will stop anime if it set as RunOnce
|
||||
}
|
||||
LastDraw = Now;
|
||||
FilmC->LastDraw = Now;
|
||||
}
|
||||
|
||||
FILM* XCinema::GetFilm(INTN Id)
|
||||
|
@ -27,7 +27,7 @@ protected:
|
||||
INTN Id; //ScreenID, enumeration value but keep it to be int for extensibility
|
||||
public:
|
||||
//I see no reason to make they protected
|
||||
bool RunOnce;
|
||||
BOOLEAN RunOnce;
|
||||
INTN NumFrames; //set by user in Theme.plist or in Theme.svg
|
||||
INTN FrameTime; //usually 50, 100, 200 ms
|
||||
INTN FilmX, FilmY; //relative
|
||||
@ -35,19 +35,22 @@ public:
|
||||
INTN ScreenEdgeVertical;
|
||||
INTN NudgeX, NudgeY;
|
||||
XStringW Path; //user defined name for folder and files Path/Path_002.png etc
|
||||
BOOLEAN AnimeRun;
|
||||
UINT64 LastDraw;
|
||||
|
||||
protected:
|
||||
XObjArray<IndexedImage> Frames; //Frames can be not sorted
|
||||
INTN LastIndex; // it is not Frames.size(), it is last index inclusive, so frames 0,1,2,5,8 be LastIndex = 8
|
||||
INTN CurrentFrame; // must be unique for each film
|
||||
INTN LastIndex; // it is not Frames.size(), it is last index inclusive, so frames 0,1,2,5,8 be LastIndex = 8
|
||||
INTN CurrentFrame; // must be unique for each film
|
||||
|
||||
public:
|
||||
EG_RECT FilmPlace; // Screen has several Films each in own place
|
||||
|
||||
public:
|
||||
FILM() {}
|
||||
FILM(INTN Id) : Id(Id), RunOnce(false), NumFrames(0)
|
||||
{}
|
||||
FILM() : AnimeRun(0), LastDraw(0), CurrentFrame(0)
|
||||
{}
|
||||
FILM(INTN Id) : Id(Id), RunOnce(FALSE), NumFrames(0), AnimeRun(0), LastDraw(0), CurrentFrame(0)
|
||||
{}
|
||||
~FILM() {}
|
||||
|
||||
INTN GetIndex() { return Id; }
|
||||
|
@ -414,7 +414,7 @@ void REFIT_MENU_SCREEN::GetAnime()
|
||||
FilmC = ThemeX.Cinema.GetFilm(ID);
|
||||
// DBG("ScreenID=%lld Film found=%d\n", ID, (FilmC != nullptr)?1:0);
|
||||
if (FilmC != nullptr) {
|
||||
AnimeRun = true;
|
||||
FilmC->AnimeRun = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -425,7 +425,7 @@ VOID REFIT_MENU_SCREEN::InitAnime()
|
||||
}
|
||||
if (FilmC == nullptr) {
|
||||
DBG("Screen %lld inited without anime\n", ID);
|
||||
AnimeRun = FALSE;
|
||||
FilmC->AnimeRun = FALSE;
|
||||
return;
|
||||
}
|
||||
// DBG("=== Debug Film ===\n");
|
||||
@ -467,9 +467,9 @@ VOID REFIT_MENU_SCREEN::InitAnime()
|
||||
}
|
||||
if (FilmC->NumFrames != 0) {
|
||||
DBG(" Anime seems OK, init it\n");
|
||||
AnimeRun = TRUE;
|
||||
FilmC->AnimeRun = TRUE;
|
||||
FilmC->Reset();
|
||||
LastDraw = 0;
|
||||
FilmC->LastDraw = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user