您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

63 行
1.5 KiB

/* libsegl - Sebas Extended GL Library
* Collection of Opengl/3D-Math helpers
*
* Copyright (c) 2008 by Sebastian Lohff, seba@seba-geek.de
* http://www.seba-geek.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "rect.h"
namespace segl {
Rect::Rect() {
set(0.0f, 0.0f, 0.0f, 0.0f);
}
Rect::Rect(float _x, float _y, float _w, float _h) {
set(_x, _y, _w, _h);
}
Rect::Rect(const SDL_Rect &r) {
set(r.x, r.y, r.w, r.h);
}
void Rect::set(float _x, float _y, float _w, float _h) {
x = _x;
y = _y;
w = _w;
h = _h;
}
void Rect::setPoint(float _x, float _y) {
x = _x;
y = _y;
}
void Rect::setDim(float _w, float _h) {
w = _w;
h = _h;
}
SDL_Rect Rect::getSDLRect() {
SDL_Rect tmp = {(Uint8)x, (Uint8)y, (Uint8)w, (Uint8)h};
return tmp;
}
} // namespace segl