mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
No more Font:set(), instead love.graphics.setNewFont
This commit is contained in:
@@ -19,7 +19,6 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
// LOVE
|
// LOVE
|
||||||
#include "Graphics.h"
|
|
||||||
#include "wrap_Font.h"
|
#include "wrap_Font.h"
|
||||||
|
|
||||||
namespace love
|
namespace love
|
||||||
@@ -28,8 +27,6 @@ namespace graphics
|
|||||||
{
|
{
|
||||||
namespace opengl
|
namespace opengl
|
||||||
{
|
{
|
||||||
extern Graphics * instance;
|
|
||||||
|
|
||||||
Font * luax_checkfont(lua_State * L, int idx)
|
Font * luax_checkfont(lua_State * L, int idx)
|
||||||
{
|
{
|
||||||
return luax_checktype<Font>(L, idx, "Font", GRAPHICS_FONT_T);
|
return luax_checktype<Font>(L, idx, "Font", GRAPHICS_FONT_T);
|
||||||
@@ -92,20 +89,12 @@ namespace opengl
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_Font_set(lua_State * L)
|
|
||||||
{
|
|
||||||
Font * t = luax_checkfont(L, 1);
|
|
||||||
instance->setFont(t);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const luaL_Reg functions[] = {
|
static const luaL_Reg functions[] = {
|
||||||
{ "getHeight", w_Font_getHeight },
|
{ "getHeight", w_Font_getHeight },
|
||||||
{ "getWidth", w_Font_getWidth },
|
{ "getWidth", w_Font_getWidth },
|
||||||
{ "getWrap", w_Font_getWrap },
|
{ "getWrap", w_Font_getWrap },
|
||||||
{ "setLineHeight", w_Font_setLineHeight },
|
{ "setLineHeight", w_Font_setLineHeight },
|
||||||
{ "getLineHeight", w_Font_getLineHeight },
|
{ "getLineHeight", w_Font_getLineHeight },
|
||||||
{ "set", w_Font_set },
|
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ namespace opengl
|
|||||||
int w_Font_getWrap(lua_State * L);
|
int w_Font_getWrap(lua_State * L);
|
||||||
int w_Font_setLineHeight(lua_State * L);
|
int w_Font_setLineHeight(lua_State * L);
|
||||||
int w_Font_getLineHeight(lua_State * L);
|
int w_Font_getLineHeight(lua_State * L);
|
||||||
int w_Font_set(lua_State * L);
|
|
||||||
int luaopen_font(lua_State * L);
|
int luaopen_font(lua_State * L);
|
||||||
|
|
||||||
} // opengl
|
} // opengl
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace graphics
|
|||||||
{
|
{
|
||||||
namespace opengl
|
namespace opengl
|
||||||
{
|
{
|
||||||
Graphics * instance = 0;
|
static Graphics * instance = 0;
|
||||||
|
|
||||||
int w_checkMode(lua_State * L)
|
int w_checkMode(lua_State * L)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1252,9 +1252,15 @@ do
|
|||||||
return love.graphics.newFont1(font, size or 12)
|
return love.graphics.newFont1(font, size or 12)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
love.graphics.setNewFont = function(...)
|
||||||
|
local font = love.graphics.newFont(...)
|
||||||
|
love.graphics.setFont(font)
|
||||||
|
return font
|
||||||
|
end
|
||||||
|
|
||||||
love.graphics.print = function (...)
|
love.graphics.print = function (...)
|
||||||
if not love.graphics.getFont() then
|
if not love.graphics.getFont() then
|
||||||
love.graphics.newFont(12):set()
|
love.graphics.setNewFont(12)
|
||||||
end
|
end
|
||||||
love.graphics.print1(...)
|
love.graphics.print1(...)
|
||||||
love.graphics.print = love.graphics.print1
|
love.graphics.print = love.graphics.print1
|
||||||
@@ -1262,7 +1268,7 @@ do
|
|||||||
|
|
||||||
love.graphics.printf = function (...)
|
love.graphics.printf = function (...)
|
||||||
if not love.graphics.getFont() then
|
if not love.graphics.getFont() then
|
||||||
love.graphics.newFont(12):set()
|
love.graphics.setNewFont(12)
|
||||||
end
|
end
|
||||||
love.graphics.printf1(...)
|
love.graphics.printf1(...)
|
||||||
love.graphics.printf = love.graphics.printf1
|
love.graphics.printf = love.graphics.printf1
|
||||||
|
|||||||
@@ -6203,14 +6203,24 @@ const unsigned char graphics_lua[] =
|
|||||||
0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e, 0x65, 0x77, 0x46, 0x6f, 0x6e, 0x74, 0x31, 0x28, 0x66, 0x6f, 0x6e, 0x74,
|
0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e, 0x65, 0x77, 0x46, 0x6f, 0x6e, 0x74, 0x31, 0x28, 0x66, 0x6f, 0x6e, 0x74,
|
||||||
0x2c, 0x20, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x31, 0x32, 0x29, 0x0a,
|
0x2c, 0x20, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x31, 0x32, 0x29, 0x0a,
|
||||||
0x09, 0x65, 0x6e, 0x64, 0x0a,0x0a,
|
0x09, 0x65, 0x6e, 0x64, 0x0a,0x0a,
|
||||||
|
0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x74,
|
||||||
|
0x4e, 0x65, 0x77, 0x46, 0x6f, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||||
|
0x28, 0x2e, 0x2e, 0x2e, 0x29, 0x0a,
|
||||||
|
0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x6c, 0x6f, 0x76,
|
||||||
|
0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e, 0x65, 0x77, 0x46, 0x6f, 0x6e, 0x74,
|
||||||
|
0x28, 0x2e, 0x2e, 0x2e, 0x29, 0x0a,
|
||||||
|
0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65,
|
||||||
|
0x74, 0x46, 0x6f, 0x6e, 0x74, 0x28, 0x66, 0x6f, 0x6e, 0x74, 0x29, 0x0a,
|
||||||
|
0x09, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x0a,
|
||||||
|
0x09, 0x65, 0x6e, 0x64, 0x0a,0x0a,
|
||||||
0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x70, 0x72, 0x69,
|
0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x70, 0x72, 0x69,
|
||||||
0x6e, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x2e, 0x2e, 0x2e,
|
0x6e, 0x74, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x2e, 0x2e, 0x2e,
|
||||||
0x29, 0x0a,
|
0x29, 0x0a,
|
||||||
0x09, 0x09, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70,
|
0x09, 0x09, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70,
|
||||||
0x68, 0x69, 0x63, 0x73, 0x2e, 0x67, 0x65, 0x74, 0x46, 0x6f, 0x6e, 0x74, 0x28, 0x29, 0x20, 0x74, 0x68, 0x65,
|
0x68, 0x69, 0x63, 0x73, 0x2e, 0x67, 0x65, 0x74, 0x46, 0x6f, 0x6e, 0x74, 0x28, 0x29, 0x20, 0x74, 0x68, 0x65,
|
||||||
0x6e, 0x0a,
|
0x6e, 0x0a,
|
||||||
0x09, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e,
|
0x09, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73,
|
||||||
0x65, 0x77, 0x46, 0x6f, 0x6e, 0x74, 0x28, 0x31, 0x32, 0x29, 0x3a, 0x73, 0x65, 0x74, 0x28, 0x29, 0x0a,
|
0x65, 0x74, 0x4e, 0x65, 0x77, 0x46, 0x6f, 0x6e, 0x74, 0x28, 0x31, 0x32, 0x29, 0x0a,
|
||||||
0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a,
|
0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||||
0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x70, 0x72,
|
0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x70, 0x72,
|
||||||
0x69, 0x6e, 0x74, 0x31, 0x28, 0x2e, 0x2e, 0x2e, 0x29, 0x0a,
|
0x69, 0x6e, 0x74, 0x31, 0x28, 0x2e, 0x2e, 0x2e, 0x29, 0x0a,
|
||||||
@@ -6224,8 +6234,8 @@ const unsigned char graphics_lua[] =
|
|||||||
0x09, 0x09, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70,
|
0x09, 0x09, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70,
|
||||||
0x68, 0x69, 0x63, 0x73, 0x2e, 0x67, 0x65, 0x74, 0x46, 0x6f, 0x6e, 0x74, 0x28, 0x29, 0x20, 0x74, 0x68, 0x65,
|
0x68, 0x69, 0x63, 0x73, 0x2e, 0x67, 0x65, 0x74, 0x46, 0x6f, 0x6e, 0x74, 0x28, 0x29, 0x20, 0x74, 0x68, 0x65,
|
||||||
0x6e, 0x0a,
|
0x6e, 0x0a,
|
||||||
0x09, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e,
|
0x09, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73,
|
||||||
0x65, 0x77, 0x46, 0x6f, 0x6e, 0x74, 0x28, 0x31, 0x32, 0x29, 0x3a, 0x73, 0x65, 0x74, 0x28, 0x29, 0x0a,
|
0x65, 0x74, 0x4e, 0x65, 0x77, 0x46, 0x6f, 0x6e, 0x74, 0x28, 0x31, 0x32, 0x29, 0x0a,
|
||||||
0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a,
|
0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||||
0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x70, 0x72,
|
0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x70, 0x72,
|
||||||
0x69, 0x6e, 0x74, 0x66, 0x31, 0x28, 0x2e, 0x2e, 0x2e, 0x29, 0x0a,
|
0x69, 0x6e, 0x74, 0x66, 0x31, 0x28, 0x2e, 0x2e, 0x2e, 0x29, 0x0a,
|
||||||
|
|||||||
Reference in New Issue
Block a user