Fixed a long-standing invalid OpenGL disable in drawRect.

Fixed a really strange bug in ComponentList vertical centering
that was causing TextEditComponent to render the top GuiBox border
incorrectly with odd sizes.
This commit is contained in:
Aloshi 2013-08-21 12:40:39 -05:00
parent 7c2e7f9069
commit 7cb3cc09ee
3 changed files with 6 additions and 7 deletions

View file

@ -103,9 +103,9 @@ namespace Renderer {
glDrawArrays(GL_TRIANGLES, 0, 6); glDrawArrays(GL_TRIANGLES, 0, 6);
glDisableClientState(GL_BLEND); glDisable(GL_BLEND);
glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);
glDisable(GL_COLOR_ARRAY); glDisableClientState(GL_COLOR_ARRAY);
} }
void setMatrix(float* matrix) void setMatrix(float* matrix)

View file

@ -118,7 +118,7 @@ Eigen::Vector3f ComponentListComponent::getCellOffset(Eigen::Vector2i pos)
offset[0] += gridSize.x() - entry->component->getSize().x(); offset[0] += gridSize.x() - entry->component->getSize().x();
//always center on the Y axis //always center on the Y axis
offset[1] += gridSize.y() / 2 - entry->component->getSize().y() / 2; offset[1] += gridSize.y() / 2.0f - entry->component->getSize().y() / 2.0f;
return offset; return offset;
} }

View file

@ -5,14 +5,13 @@
#include "../Renderer.h" #include "../Renderer.h"
TextEditComponent::TextEditComponent(Window* window) : GuiComponent(window), TextEditComponent::TextEditComponent(Window* window) : GuiComponent(window),
mBox(window, 0, 0, 0, 0) mBox(window, 0, 0, 0, 0), mFocused(false)
{ {
addChild(&mBox); addChild(&mBox);
onFocusLost(); onFocusLost();
LOG(LogInfo) << getFont()->getHeight(); setSize(256, (float)getFont()->getHeight());
setSize(256, /*(float)getFont()->getHeight()*/ 41);
} }
void TextEditComponent::onFocusGained() void TextEditComponent::onFocusGained()
@ -72,7 +71,7 @@ void TextEditComponent::render(const Eigen::Affine3f& parentTrans)
Renderer::setMatrix(trans); Renderer::setMatrix(trans);
std::shared_ptr<Font> f = getFont(); std::shared_ptr<Font> f = getFont();
f->drawText(mText, Eigen::Vector2f::Zero(), 0x00000000 | getOpacity()); //f->drawText(mText, Eigen::Vector2f::Zero(), 0x00000000 | getOpacity());
} }
std::shared_ptr<Font> TextEditComponent::getFont() std::shared_ptr<Font> TextEditComponent::getFont()