summaryrefslogtreecommitdiff
path: root/imgui_ops.h
blob: 2bf633558891893b878d191b72a769b7e3745924 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96


ImVec2 operator+(ImVec2 A, ImVec2 B)
{
    ImVec2 Result;

    Result.x = A.x + B.x;
    Result.y = A.y + B.y;

    return Result;
}

ImVec2 operator+(ImVec2 A, int B)
{
    ImVec2 Result;

    Result.x = A.x + B;
    Result.y = A.y + B;

    return Result;
}

ImVec2 operator-(ImVec2 A, ImVec2 B)
{
    ImVec2 Result;

    Result.x = A.x - B.x;
    Result.y = A.y - B.y;

    return Result;
}

ImVec2 operator*(ImVec2 A, real32 B)
{
    ImVec2 Result;

    Result.x = A.x * B;
    Result.y = A.y * B;

    return Result;
}

ImVec2 operator*(ImVec2 A, ImVec2 B)
{
    ImVec2 Result;

    Result.x = A.x * B.x;
    Result.y = A.y * B.y;

    return Result;
}

ImVec2 operator/(ImVec2 A, ImVec2 B)
{
    ImVec2 Result;

    Result.x = A.x / B.x;
    Result.y = A.y / B.y;

    return Result;
}

ImVec2 operator/(ImVec2 A, real32 B)
{
    ImVec2 Result;

    Result.x = A.x / B;
    Result.y = A.y / B;

    return Result;
}

ImVec2 operator/(real32 A, ImVec2 B)
{
    ImVec2 Result;

    Result.x = A / B.x;
    Result.y = A / B.y;

    return Result;
}

inline bool32
IsRectTouching(ImVec2 Min1, ImVec2 Max1, ImVec2 Min2, ImVec2 Max2)
{
    bool32 Result = 0;
    if ((Max1.x > Min2.x && Min1.x < Min2.x) &&
        (Max1.y > Min2.y && Min1.y < Min2.y))
        Result = 1;
    // if (
    //     Result = 1;
    // if (Min1.x > Min2.x)

    return(Result);
}