summaryrefslogtreecommitdiff
path: root/src/nw4r/lyt/lyt_util.cpp
blob: ef86f45b10f313382964a73f7fc0d90d017486e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

#include "nw4r/lyt/lyt_pane.h"
#include "nw4r/lyt/lyt_utils.h"
#include "nw4r/math/math_geometry.h"
#include "nw4r/math/math_types.h"
#include "nw4r/ut/ut_Rect.h"

namespace nw4r {
namespace lyt {

namespace {
// Contains__Q34nw4r3lyt22@unnamed@lyt_util_cpp@FRCQ34nw4r2ut4RectRCQ34nw4r4math4VEC2
bool Contains(const ut::Rect &rect, const math::VEC2 &point) {
    return (rect.left <= point.x && point.x <= rect.right) && (rect.bottom <= point.y && point.y <= rect.top);
}

} // namespace

// BindAnimation__Q24nw4r3lytFPQ34nw4r3lyt5GroupPQ34nw4r3lyt13AnimTransformbb
void BindAnimation(Group *pGroup, AnimTransform *pAnimTrans, bool bRecursive, bool bDisable) {
    ut::LinkList<detail::PaneLink, 0> &paneList = *pGroup->GetPaneList();
    for (ut::LinkList<detail::PaneLink, 0>::Iterator it = paneList.GetBeginIter(); it != paneList.GetEndIter(); it++) {
        it->mTarget->BindAnimation(pAnimTrans, bRecursive, bDisable);
    }
}

// UnbindAnimation__Q24nw4r3lytFPQ34nw4r3lyt5GroupPQ34nw4r3lyt13AnimTransformb
void UnbindAnimation(Group *pGroup, AnimTransform *pAnimTrans, bool bRecursive) {
    ut::LinkList<detail::PaneLink, 0> &paneList = *pGroup->GetPaneList();
    for (ut::LinkList<detail::PaneLink, 0>::Iterator it = paneList.GetBeginIter(); it != paneList.GetEndIter(); it++) {
        it->mTarget->UnbindAnimation(pAnimTrans, bRecursive);
    }
}

// SetAnimationEnable__Q24nw4r3lytFPQ34nw4r3lyt5GroupPQ34nw4r3lyt13AnimTransformbb
void SetAnimationEnable(Group *pGroup, nw4r::lyt::AnimTransform *pAnimTrans, bool bEnable, bool bRecursive) {
    ut::LinkList<detail::PaneLink, 0> &paneList = *pGroup->GetPaneList();
    for (ut::LinkList<detail::PaneLink, 0>::Iterator it = paneList.GetBeginIter(); it != paneList.GetEndIter(); it++) {
        it->mTarget->SetAnimationEnable(pAnimTrans, bEnable, bRecursive);
    }
}

// IsContain__Q24nw4r3lytFPQ34nw4r3lyt4PaneRCQ34nw4r4math4VEC2
bool IsContain(Pane *pPane, const math::VEC2 &pos) {
    math::MTX34 invGlbMtx;
    MTXInverse(pPane->GetGlobalMtx(), invGlbMtx);
    math::VEC3 lclPos;
    MTXMultVec(invGlbMtx, math::VEC3(pos.x, pos.y, 0.0f), lclPos);
    return Contains(pPane->GetPaneRect(), math::VEC2(lclPos.x, lclPos.y));
}

// FindHitPane__Q24nw4r3lytFPQ34nw4r3lyt4PaneRCQ34nw4r4math4VEC2
Pane *FindHitPane(Pane *pPane, const math::VEC2 &pos) {
    // TODO
    return nullptr;
}

// FindHitPane__Q24nw4r3lytFPQ34nw4r3lyt6LayoutRCQ34nw4r4math4VEC2
Pane *FindHitPane(Layout *pLayout, const math::VEC2 &pos) {
    // TODO
    return nullptr;
}

// GetNextPane__Q24nw4r3lytFPQ34nw4r3lyt4Pane
Pane *GetNextPane(Pane *) {
    // TODO
    return nullptr;
}

} // namespace lyt

} // namespace nw4r