| 1 | #include "Library/Play/Layout/SimpleLayoutTextHolder.h" |
| 2 | |
| 3 | #include "Library/Play/Layout/SimpleLayoutText.h" |
| 4 | |
| 5 | namespace al { |
| 6 | |
| 7 | SimpleLayoutTextWrapper::SimpleLayoutTextWrapper(SimpleLayoutText* simpleLayoutText) |
| 8 | : mSimpleLayoutText(simpleLayoutText) {} |
| 9 | |
| 10 | SimpleLayoutTextWrapper* SimpleLayoutTextWrapper::start(const sead::Vector2f& pos, const char* str, |
| 11 | s32 lifetime) { |
| 12 | mSimpleLayoutText->start(pos, str, lifetime); |
| 13 | return this; |
| 14 | } |
| 15 | |
| 16 | SimpleLayoutTextWrapper* SimpleLayoutTextWrapper::start(const sead::Vector2f& pos, |
| 17 | const char16* str, s32 lifetime) { |
| 18 | mSimpleLayoutText->start(pos, str, lifetime); |
| 19 | return this; |
| 20 | } |
| 21 | |
| 22 | SimpleLayoutTextWrapper* SimpleLayoutTextWrapper::setScale(f32 scale) { |
| 23 | mSimpleLayoutText->setScale(scale); |
| 24 | return this; |
| 25 | } |
| 26 | |
| 27 | SimpleLayoutTextWrapper* SimpleLayoutTextWrapper::setColor(const sead::Color4u8& color) { |
| 28 | mSimpleLayoutText->setColor(color); |
| 29 | return this; |
| 30 | } |
| 31 | |
| 32 | SimpleLayoutTextWrapper* SimpleLayoutTextWrapper::setPos(const sead::Vector2f& pos) { |
| 33 | mSimpleLayoutText->setPos(pos); |
| 34 | return this; |
| 35 | } |
| 36 | |
| 37 | SimpleLayoutTextHolder::SimpleLayoutTextHolder(s32 amount, const LayoutInitInfo& info, |
| 38 | const char* name, const char* paneName, |
| 39 | const char* archiveName) |
| 40 | : mNumEntries(amount) { |
| 41 | mLayouts = new SimpleLayoutText*[amount]; |
| 42 | mEntries = new SimpleLayoutTextHolderEntry*[amount]; |
| 43 | |
| 44 | for (s32 i = 0; i < mNumEntries; i++) { |
| 45 | mLayouts[i] = new SimpleLayoutText(info, name, paneName, archiveName); |
| 46 | mEntries[i] = new SimpleLayoutTextHolderEntry(mLayouts[i]); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | void SimpleLayoutTextHolder::reset() { |
| 51 | mCurrentIndex = 0; |
| 52 | } |
| 53 | |
| 54 | SimpleLayoutTextHolderEntry* SimpleLayoutTextHolder::start(const sead::Vector2f& pos, |
| 55 | const char* str) { |
| 56 | SimpleLayoutTextHolderEntry* entry = mEntries[mCurrentIndex++]; |
| 57 | entry->text->start(pos, str, lifetime: 1); |
| 58 | return entry; |
| 59 | } |
| 60 | |
| 61 | SimpleLayoutTextHolderEntry* SimpleLayoutTextHolder::start(const sead::Vector2f& pos, |
| 62 | const char16* str) { |
| 63 | SimpleLayoutTextHolderEntry* entry = mEntries[mCurrentIndex++]; |
| 64 | entry->text->start(pos, str, lifetime: 1); |
| 65 | return entry; |
| 66 | } |
| 67 | |
| 68 | } // namespace al |
| 69 | |