2008-02-09 13:43:23 +01:00
|
|
|
|
#include "window.h"
|
|
|
|
|
|
2008-08-10 17:14:54 +02:00
|
|
|
|
namespace segl {
|
|
|
|
|
|
|
|
|
|
GLGuiWindow::GLGuiWindow(SDL_Rect _pos, Color _bgcolor) {
|
2008-02-09 13:43:23 +01:00
|
|
|
|
pos = _pos;
|
|
|
|
|
bgcolor = _bgcolor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GLGuiWindow::addItem(GLGuiObject *gobj) {
|
2008-08-10 17:14:54 +02:00
|
|
|
|
// Objekt wird in delete gel<65>scht
|
2008-02-09 13:43:23 +01:00
|
|
|
|
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() {
|
2008-08-10 17:14:54 +02:00
|
|
|
|
// der der allokiert soll sich gef<65>lligst drum k<>mmern
|
2008-03-08 23:03:26 +01:00
|
|
|
|
// for(unsigned int i=0; i<items.size(); i++) {
|
|
|
|
|
// delete(items[i]);
|
|
|
|
|
// }
|
2008-02-09 13:43:23 +01:00
|
|
|
|
}
|
2008-08-10 17:14:54 +02:00
|
|
|
|
|
|
|
|
|
} // namespace segl
|