libsegl/glgui/window.cpp

41 lines
797 B
C++

#include "window.h"
GLGuiWindow::GLGuiWindow(SDL_Rect _pos, GLColor _bgcolor) {
pos = _pos;
bgcolor = _bgcolor;
}
void GLGuiWindow::addItem(GLGuiObject *gobj) {
// Objekt wird in delete gelöscht
items.push_back(gobj);
if(gobj->isHighlightable())
highlightable.push_back(gobj);
if(gobj->isClickable())
clickable.push_back(gobj);
if(gobj->isKeyboardable())
keyboardable.push_back(gobj);
}
void GLGuiWindow::render() {
if(renderbackground) {
glColorGLC(bgcolor);
GLDrawSDLRect(&pos);
}
for(unsigned int i=0; i<items.size(); i++) {
items[i]->render();
}
}
SDL_Rect GLGuiWindow::getPos() {
return pos;
}
GLGuiWindow::~GLGuiWindow() {
// der der allokiert soll sich gefälligst drum kümmern
// for(unsigned int i=0; i<items.size(); i++) {
// delete(items[i]);
// }
}