mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-06-08 17:42:05 +00:00
Add Lua functions (+ related text class changes):
- text_getHeight() - getUserInputString()
This commit is contained in:
parent
5336c8d350
commit
201b3a76bc
5 changed files with 21 additions and 1 deletions
|
@ -8507,6 +8507,11 @@ luaFunc(castLine)
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luaFunc(getUserInputString)
|
||||||
|
{
|
||||||
|
luaReturnStr(dsq->getUserInputString(getString(L, 1), getString(L, 2), true).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
luaFunc(inv_isFull)
|
luaFunc(inv_isFull)
|
||||||
{
|
{
|
||||||
|
@ -8658,6 +8663,12 @@ luaFunc(text_setAlign)
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luaFunc(text_getHeight)
|
||||||
|
{
|
||||||
|
BaseText *txt = getText(L);
|
||||||
|
luaReturnNum(txt ? txt->getHeight() : 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
luaFunc(loadShader)
|
luaFunc(loadShader)
|
||||||
{
|
{
|
||||||
int handle = 0;
|
int handle = 0;
|
||||||
|
@ -9314,6 +9325,7 @@ static const struct {
|
||||||
luaRegister(getObstruction),
|
luaRegister(getObstruction),
|
||||||
luaRegister(findPath),
|
luaRegister(findPath),
|
||||||
luaRegister(castLine),
|
luaRegister(castLine),
|
||||||
|
luaRegister(getUserInputString),
|
||||||
|
|
||||||
luaRegister(isFlag),
|
luaRegister(isFlag),
|
||||||
|
|
||||||
|
@ -9706,6 +9718,7 @@ static const struct {
|
||||||
luaRegister(text_setFontSize),
|
luaRegister(text_setFontSize),
|
||||||
luaRegister(text_setWidth),
|
luaRegister(text_setWidth),
|
||||||
luaRegister(text_setAlign),
|
luaRegister(text_setAlign),
|
||||||
|
luaRegister(text_getHeight),
|
||||||
|
|
||||||
luaRegister(loadShader),
|
luaRegister(loadShader),
|
||||||
luaRegister(createShader),
|
luaRegister(createShader),
|
||||||
|
|
|
@ -13,6 +13,7 @@ public:
|
||||||
virtual void setWidth(int width) = 0;
|
virtual void setWidth(int width) = 0;
|
||||||
virtual void setFontSize(int sz) = 0;
|
virtual void setFontSize(int sz) = 0;
|
||||||
virtual void setAlign(Align a) = 0;
|
virtual void setAlign(Align a) = 0;
|
||||||
|
virtual float getHeight() = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ public:
|
||||||
void autoKern();
|
void autoKern();
|
||||||
void setBitmapFontEffect(BitmapFontEffect bfe);
|
void setBitmapFontEffect(BitmapFontEffect bfe);
|
||||||
void render();
|
void render();
|
||||||
float getHeight();
|
virtual float getHeight();
|
||||||
void unloadDevice();
|
void unloadDevice();
|
||||||
void reloadDevice();
|
void reloadDevice();
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,11 @@ void DebugFont::setFontSize(int sz)
|
||||||
fontDrawSize = sz;
|
fontDrawSize = sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float DebugFont::getHeight()
|
||||||
|
{
|
||||||
|
return fontDrawSize * lines.size() * 1.5f; // vspc in render()
|
||||||
|
}
|
||||||
|
|
||||||
void DebugFont::formatText()
|
void DebugFont::formatText()
|
||||||
{
|
{
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
|
@ -33,6 +33,7 @@ public:
|
||||||
void setFontSize(int sz);
|
void setFontSize(int sz);
|
||||||
int getNumLines() { return lines.size(); }
|
int getNumLines() { return lines.size(); }
|
||||||
virtual void setAlign(Align align);
|
virtual void setAlign(Align align);
|
||||||
|
virtual float getHeight();
|
||||||
protected:
|
protected:
|
||||||
int fontDrawSize, textWidth;
|
int fontDrawSize, textWidth;
|
||||||
void formatText();
|
void formatText();
|
||||||
|
|
Loading…
Add table
Reference in a new issue