lua console and some changes

This commit is contained in:
Eduardo Bart
2011-08-20 17:30:41 -03:00
parent 033f14780d
commit 38529ea837
70 changed files with 672 additions and 305 deletions

View File

@@ -18,8 +18,11 @@ void Font::load(const OTMLNodePtr& fontNode)
if(!m_texture)
throw std::runtime_error("failed to load texture for font");
// auto calculate widths
calculateGlyphsWidthsAutomatically(glyphSize);
if(OTMLNodePtr node = fontNode->get("fixed glyph width")) {
for(int glyph = m_firstGlyph; glyph < 256; ++glyph)
m_glyphsSize[glyph] = Size(node->value<int>(), m_glyphHeight);
} else
calculateGlyphsWidthsAutomatically(glyphSize);
// read custom widths
if(OTMLNodePtr node = fontNode->get("glyph widths")) {

View File

@@ -34,7 +34,7 @@ bool FontManager::importFont(std::string fontFile)
return true;
} catch(std::exception& e) {
logError("ERROR: could not load font from '", fontFile, "': ", e.what());
logError("could not load font from '", fontFile, "': ", e.what());
return false;
}
}
@@ -64,6 +64,6 @@ FontPtr FontManager::getDefaultFont()
{
// default font should always exists, otherwise the app may crash
if(!m_defaultFont)
logFatal("FATAL ERROR: no default font to display, cannot continue to run");
logFatal("no default font to display, cannot continue to run");
return m_defaultFont;
}

View File

@@ -194,8 +194,7 @@ void Graphics::drawRepeatedTexturedRect(const Rect& screenCoords,
stopDrawing();
}
void Graphics::drawFilledRect(const Rect& screenCoords,
const Color& color)
void Graphics::drawFilledRect(const Rect& screenCoords)
{
assert(!m_drawing);
@@ -208,8 +207,6 @@ void Graphics::drawFilledRect(const Rect& screenCoords,
int top = screenCoords.top();
int left = screenCoords.left();
glPushAttrib(GL_CURRENT_BIT);
glColor4ubv(color.rgbaPtr());
glDisable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
@@ -220,12 +217,10 @@ void Graphics::drawFilledRect(const Rect& screenCoords,
glEnd();
glEnable(GL_TEXTURE_2D);
glPopAttrib();
}
void Graphics::drawBoundingRect(const Rect& screenCoords,
const Color& color,
int innerLineWidth)
{
assert(!m_drawing);
@@ -239,8 +234,6 @@ void Graphics::drawBoundingRect(const Rect& screenCoords,
int top = screenCoords.top();
int left = screenCoords.left();
glPushAttrib(GL_CURRENT_BIT);
glColor4ubv(color.rgbaPtr());
glDisable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
@@ -270,7 +263,6 @@ void Graphics::drawBoundingRect(const Rect& screenCoords,
glEnd();
glEnable(GL_TEXTURE_2D);
glPopAttrib();
}
void Graphics::bindColor(const Color& color)

View File

@@ -45,11 +45,9 @@ public:
const TexturePtr& texture,
const Rect& textureCoords);
void drawFilledRect(const Rect& screenCoords,
const Color& color);
void drawFilledRect(const Rect& screenCoords);
void drawBoundingRect(const Rect& screenCoords,
const Color& color = Color::green,
int innerLineWidth = 1);
const Size& getScreenSize() const { return m_screenSize; }

View File

@@ -35,7 +35,7 @@ uint Texture::internalLoadGLTexture(uchar *pixels, int channels, int width, int
// checks texture max size
if(width > maxTexSize || height > maxTexSize) {
logError("ERROR: loading texture with size ", width, "x", height, " failed, "
logError("loading texture with size ", width, "x", height, " failed, "
"the maximum size allowed by the graphics card is ", maxTexSize, "x", maxTexSize, ",",
"to prevent crashes the texture will be displayed as a blank texture");
return 0;

View File

@@ -31,7 +31,7 @@ TexturePtr TextureManager::getTexture(const std::string& textureFile)
g_resources.loadFile(textureFile, fin);
texture = loadPNG(fin);
} catch(std::exception& e) {
logError("ERROR: unable to load texture '",textureFile,"': ", e.what());
logError("unable to load texture '",textureFile,"': ", e.what());
}
}