mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-21 19:51:27 +00:00
- export FFont::GetChar()
to ZScript
This commit is contained in:
parent
de87493c41
commit
3524d06813
2 changed files with 21 additions and 0 deletions
|
@ -770,6 +770,26 @@ DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetDisplayTopOffset, GetDisplayTopOffset)
|
|||
ACTION_RETURN_FLOAT(GetDisplayTopOffset(self, code));
|
||||
}
|
||||
|
||||
static int GetChar(FFont* font, int c)
|
||||
{
|
||||
int texc = 0;
|
||||
auto getch = font->GetChar(c, CR_UNDEFINED, nullptr);
|
||||
if (getch)
|
||||
texc = getch->GetID().GetIndex();
|
||||
return texc;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetChar, ::GetChar)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FFont);
|
||||
PARAM_INT(mchar);
|
||||
|
||||
if (numret > 0) ret[0].SetInt(::GetChar(self, mchar));
|
||||
if (numret > 1) ret[1].SetInt(self->GetCharWidth(mchar));
|
||||
return min(2, numret);
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// file system
|
||||
|
|
|
@ -657,6 +657,7 @@ struct Font native
|
|||
native BrokenLines BreakLines(String text, int maxlen);
|
||||
native int GetGlyphHeight(int code);
|
||||
native int GetDefaultKerning();
|
||||
native TextureID, int GetChar(int c);
|
||||
}
|
||||
|
||||
struct Console native
|
||||
|
|
Loading…
Reference in a new issue