640x480 toolbar fixes, don't draw an invisible toolbar

svn-id: r12644
This commit is contained in:
Nicolas Bacca 2004-01-28 01:09:08 +00:00
parent 4793b48326
commit 2ff396d7e8
4 changed files with 22 additions and 6 deletions

View File

@ -43,7 +43,7 @@ namespace CEGUI {
bool Panel::draw(SDL_Surface *surface) {
ItemMap::ConstIterator iterator;
if (!_drawn) {
if (!_drawn && _visible) {
GUIElement::draw(surface);
for (iterator = _itemsMap.begin(); iterator != _itemsMap.end(); ++iterator) {
((GUIElement*)(iterator->_value))->draw(surface);

View File

@ -24,12 +24,12 @@
namespace CEGUI {
// FIXME (could be game dependant)
Toolbar::Toolbar() : GUIElement(0, 200, 320, 40)
// Not to be drawn on game screen !
Toolbar::Toolbar() : GUIElement(0, 0, 320, 40)
{
}
Toolbar::~Toolbar() {
}
}
}

View File

@ -58,8 +58,13 @@ namespace CEGUI {
}
bool ToolbarHandler::action(int x, int y, bool pushed) {
if (_active)
return _active->action(x, y, pushed);
if (_active) {
// FIXME !
if (_offset > 240)
return _active->action(x / 2, (y - _offset) / 2, pushed);
else
return _active->action(x, y - _offset, pushed);
}
else
return false;
}
@ -103,6 +108,14 @@ namespace CEGUI {
return false;
}
void ToolbarHandler::setOffset(int offset) {
_offset = offset;
}
int ToolbarHandler::getOffset() {
return _offset;
}
Toolbar* ToolbarHandler::active() {
return _active;
}

View File

@ -45,6 +45,8 @@ namespace CEGUI {
bool visible();
String activeName();
void forceRedraw();
void setOffset(int offset);
int getOffset();
bool draw(SDL_Surface *surface, SDL_Rect *rect);
bool drawn();
Toolbar *active();
@ -59,6 +61,7 @@ namespace CEGUI {
Map<String, Toolbar*, IgnoreCaseComparator> _toolbarMap;
String _current;
Toolbar *_active;
int _offset;
};
}