Edited gui.text to return a value, the x position where it would paint the next character. This should hopefully allow scripters to place a useful box around the text, perhaps for looks or clicking like it's a button.

This commit is contained in:
fatratknight 2010-06-06 22:50:46 +00:00
parent bb767b0d49
commit a8fa67db16
2 changed files with 5 additions and 2 deletions

View File

@ -1,3 +1,4 @@
06-june-2010 - FatRatKnight - Added a return value to gui.text: The X position where the function would paint the next character.
02-june-2010 - adelikat - Win32 - Movie Options Dialog - Fix so Full Savestate Load checkbox is updated on load 02-june-2010 - adelikat - Win32 - Movie Options Dialog - Fix so Full Savestate Load checkbox is updated on load
---r1984 - FCEUX 2.1.4a Release--- ---r1984 - FCEUX 2.1.4a Release---

View File

@ -3794,7 +3794,7 @@ static int JoedCharWidth(uint8 ch)
return FCEUFont[FixJoedChar(ch)*8]; return FCEUFont[FixJoedChar(ch)*8];
} }
void LuaDrawTextTransWH(const char *str, size_t l, int x, int y, uint32 color, uint32 backcolor) void LuaDrawTextTransWH(const char *str, size_t l, int &x, int y, uint32 color, uint32 backcolor)
{ {
int Opac = (color >> 24) & 0xFF; int Opac = (color >> 24) & 0xFF;
int backOpac = (backcolor >> 24) & 0xFF; int backOpac = (backcolor >> 24) & 0xFF;
@ -3893,8 +3893,10 @@ static int gui_text(lua_State *L) {
gui_prepare(); gui_prepare();
LuaDrawTextTransWH(msg, l, x, y, color, bgcolor); LuaDrawTextTransWH(msg, l, x, y, color, bgcolor);
lua_pushinteger(L, x);
#endif #endif
return 0; return 1;
} }