Files
botw/lib/EventFlow/include/evfl/TimelineObj.h
T
Léo Lam 18c60323a9 Switch to subrepos
git subrepo clone https://github.com/open-ead/sead lib/sead

subrepo:
  subdir:   "lib/sead"
  merged:   "1b66e825d"
upstream:
  origin:   "https://github.com/open-ead/sead"
  branch:   "master"
  commit:   "1b66e825d"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

git subrepo clone (merge) https://github.com/open-ead/nnheaders lib/NintendoSDK

subrepo:
  subdir:   "lib/NintendoSDK"
  merged:   "9ee21399f"
upstream:
  origin:   "https://github.com/open-ead/nnheaders"
  branch:   "master"
  commit:   "9ee21399f"
git-subrepo:
  version:  "0.4.3"
  origin:   "ssh://git@github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

git subrepo clone https://github.com/open-ead/agl lib/agl

subrepo:
  subdir:   "lib/agl"
  merged:   "7c063271b"
upstream:
  origin:   "https://github.com/open-ead/agl"
  branch:   "master"
  commit:   "7c063271b"
git-subrepo:
  version:  "0.4.3"
  origin:   "ssh://git@github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

git subrepo clone https://github.com/open-ead/EventFlow lib/EventFlow

subrepo:
  subdir:   "lib/EventFlow"
  merged:   "c35d21b34"
upstream:
  origin:   "https://github.com/open-ead/EventFlow"
  branch:   "master"
  commit:   "c35d21b34"
git-subrepo:
  version:  "0.4.3"
  origin:   "ssh://git@github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"
2022-03-21 21:31:42 +01:00

79 lines
2.2 KiB
C++

#pragma once
#include <evfl/EvflAllocator.h>
#include <evfl/ResActor.h>
#include <ore/Array.h>
#include <ore/EnumUtil.h>
#include <ore/Types.h>
namespace evfl {
struct ResTimeline;
ORE_ENUM(TimelineState, kNotStarted, kPlaying, kStop, kPause)
class TimelineObj {
public:
class Builder {
public:
explicit Builder(const ResTimeline* timeline) : m_timeline(timeline) {}
bool Build(TimelineObj* obj, AllocateArg allocate_arg);
private:
const ResTimeline* m_timeline = nullptr;
ActBinder::Builder m_act_binder_builder;
};
TimelineObj();
void Calc();
void Reset();
void SetState(TimelineState::Type state);
void Start(float start_time);
void JumpTimeTo(float time);
void AdvanceTimeTo(float time);
bool RegisterSubtimeline(TimelineObj* obj);
ActBinder& GetActBinder() { return m_act_binder; }
const ActBinder& GetActBinder() const { return m_act_binder; }
const ore::Array<TimelineObj*>& GetSubTimelines() const { return m_sub_timelines; }
const ResTimeline* GetTimeline() const { return m_timeline; }
float GetTime() const { return m_time; }
float GetNewTime() const { return m_new_time; }
int GetLastTriggerIdx() const { return m_last_trigger_idx; }
int GetLastOneshotIdx() const { return m_last_oneshot_idx; }
int GetPlayCounter() const { return m_play_counter; }
bool IsStarted() const { return m_started; }
bool IsJumpedTime() const { return m_jumped_time; }
TimelineState::Type GetState() const { return m_state; }
private:
void CalcImpl();
void JumpTimeToImpl(float time);
void AdvanceTimeToImpl(float time);
static int s_GlobalPlayCounter;
void Finalize() {
m_timeline = nullptr;
m_act_binder.Reset();
m_sub_timelines.Clear(&m_allocator);
}
EvflAllocator m_allocator;
ore::Array<TimelineObj*> m_sub_timelines;
const ResTimeline* m_timeline{};
ActBinder m_act_binder{};
float m_time{};
float m_new_time{};
int m_last_trigger_idx = -1;
int m_last_oneshot_idx = -1;
int m_play_counter = 0;
bool m_started = false;
bool m_jumped_time = false;
ore::SizedEnum<TimelineState::Type, u8> m_state = TimelineState::kNotStarted;
};
} // namespace evfl