| 89 | } |
| 90 | |
| 91 | void CUIFrameRect::UpdateSize() |
| 92 | { |
| 93 | VERIFY(g_bRendering); |
| 94 | // texture size |
| 95 | Fvector2 ts; |
| 96 | float rem_x, rem_y; |
| 97 | int tile_x, tile_y; |
| 98 | |
| 99 | Fvector2 _bk, _lt, _lb, _rb, _rt, _l, _r, _t, _b; |
| 100 | |
| 101 | _bk.set(frame[fmBK].GetOriginalRect().width(), frame[fmBK].GetOriginalRect().height()); |
| 102 | _lt.set(frame[fmLT].GetOriginalRect().width(), frame[fmLT].GetOriginalRect().height()); |
| 103 | _lb.set(frame[fmLB].GetOriginalRect().width(), frame[fmLB].GetOriginalRect().height()); |
| 104 | _rb.set(frame[fmRB].GetOriginalRect().width(), frame[fmRB].GetOriginalRect().height()); |
| 105 | _rt.set(frame[fmRT].GetOriginalRect().width(), frame[fmRT].GetOriginalRect().height()); |
| 106 | _l.set(frame[fmL].GetOriginalRect().width(), frame[fmL].GetOriginalRect().height()); |
| 107 | _r.set(frame[fmR].GetOriginalRect().width(), frame[fmR].GetOriginalRect().height()); |
| 108 | _t.set(frame[fmT].GetOriginalRect().width(), frame[fmT].GetOriginalRect().height()); |
| 109 | _b.set(frame[fmB].GetOriginalRect().width(), frame[fmB].GetOriginalRect().height()); |
| 110 | |
| 111 | Fvector2 wnd_pos = GetWndPos(); |
| 112 | frame[fmLT].SetPos(wnd_pos.x, wnd_pos.y); |
| 113 | frame[fmRT].SetPos(wnd_pos.x + m_wndSize.x - _rt.x, wnd_pos.y); |
| 114 | frame[fmLB].SetPos(wnd_pos.x, wnd_pos.y + m_wndSize.y - _lb.y); |
| 115 | frame[fmRB].SetPos(wnd_pos.x + m_wndSize.x - _rb.x, wnd_pos.y + m_wndSize.y - _rb.y); |
| 116 | |
| 117 | float size_top = m_wndSize.x - _lt.x - _rt.x; |
| 118 | float size_bottom = m_wndSize.x - _lb.x - _rb.x; |
| 119 | float size_left = m_wndSize.y - _lt.y - _lb.y; |
| 120 | float size_right = m_wndSize.y - _rt.y - _rb.y; |
| 121 | |
| 122 | //Фон |
| 123 | ts.set(_bk.x, _bk.y); |
| 124 | rem_x = fmod(size_top, ts.x); |
| 125 | rem_y = fmod(size_left, ts.y); |
| 126 | tile_x = iFloor(size_top / ts.x); |
| 127 | tile_x = _max(tile_x, 0); |
| 128 | tile_y = iFloor(size_left / ts.y); |
| 129 | tile_y = _max(tile_y, 0); |
| 130 | |
| 131 | frame[fmBK].SetPos(wnd_pos.x + _lt.x, wnd_pos.y + _lt.y); |
| 132 | frame[fmBK].SetTile(tile_x, tile_y, rem_x, rem_y); |
| 133 | |
| 134 | //Обрамление |
| 135 | ts.set(_t.x, _t.y); |
| 136 | rem_x = fmod(size_top, ts.x); |
| 137 | tile_x = iFloor(size_top / ts.x); |
| 138 | tile_x = _max(tile_x, 0); |
| 139 | frame[fmT].SetPos(wnd_pos.x + _lt.x, wnd_pos.y); |
| 140 | frame[fmT].SetTile(tile_x, 1, rem_x, 0); |
| 141 | |
| 142 | ts.set(_b.x, _b.y); |
| 143 | rem_x = fmod(size_bottom, ts.x); |
| 144 | tile_x = iFloor(size_bottom / ts.x); |
| 145 | tile_x = _max(tile_x, 0); |
| 146 | frame[fmB].SetPos(wnd_pos.x + _lb.x, wnd_pos.y + m_wndSize.y - ts.y); |
| 147 | frame[fmB].SetTile(tile_x, 1, rem_x, 0); |
| 148 | |