| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/ui/UIObject.cpp $ |
| 21 | * $Revision: 3 $ |
| 22 | * $Date: 4/14/99 1:53a $ |
| 23 | * $Author: Jeff $ |
| 24 | * |
| 25 | * Generic object code |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/ui/UIObject.cpp $ |
| 28 | * |
| 29 | * 3 4/14/99 1:53a Jeff |
| 30 | * fixed case mismatched #includes |
| 31 | * |
| 32 | * 2 5/08/98 3:58p Samir |
| 33 | * added ability to move a UI object. |
| 34 | * |
| 35 | * 1 12/30/97 4:36p Samir |
| 36 | * Initial revision |
| 37 | * |
| 38 | * $NoKeywords: $ |
| 39 | */ |
| 40 | |
| 41 | #include "UIlib.h" |
| 42 | |
| 43 | UIObject::UIObject() { |
| 44 | m_X = m_Y = 0; |
| 45 | m_W = m_H = 0; |
| 46 | m_Created = false; |
| 47 | } |
| 48 | |
| 49 | UIObject::~UIObject() {} |
| 50 | |
| 51 | // obj = NULL, then this object has no parent: it is an independent entity. |
| 52 | void UIObject::Create(int x, int y, int w, int h) { |
| 53 | ASSERT(!m_Created); |
| 54 | |
| 55 | m_X = x; |
| 56 | m_Y = y; |
| 57 | m_W = w; |
| 58 | m_H = h; |
| 59 | m_Created = true; |
| 60 | } |
| 61 | |
| 62 | // moves the object. |
| 63 | void UIObject::Move(int x, int y, int w, int h) { |
| 64 | m_X = x; |
| 65 | m_Y = y; |
| 66 | m_W = w; |
| 67 | m_H = h; |
| 68 | mprintf(0, "new [%d,%d]\n", m_X, m_Y); |
| 69 | } |
| 70 | |
| 71 | //@@ |
| 72 | //@@// enables ui draw commands. |
| 73 | //@@void UIObject::StartDraw() |
| 74 | //@@{ |
| 75 | //@@ m_OwnerVP->set_clipping_rect(m_X,m_Y,m_X+m_W-1,m_Y+m_H-1); |
| 76 | //@@ ui_StartDraw(m_OwnerVP); |
| 77 | //@@} |
| 78 | //@@ |
| 79 | //@@ |
| 80 | //@@// disables ui draw commands. |
| 81 | //@@void UIObject::EndDraw() |
| 82 | //@@{ |
| 83 | //@@ ui_EndDraw(); |
| 84 | //@@} |