mirror of
https://github.com/love2d/love.git
synced 2026-08-20 20:49:54 +02:00
Code cleanup: remove unnecessary `print' routines
This commit is contained in:
@@ -65,11 +65,6 @@ namespace opengl
|
|||||||
return height / lineHeight;
|
return height / lineHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font::print(std::string text, float x, float y) const
|
|
||||||
{
|
|
||||||
print(text, x, y, 0.0f, 1.0f, 1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Font::print(std::string text, float x, float y, float angle, float sx, float sy) const
|
void Font::print(std::string text, float x, float y, float angle, float sx, float sy) const
|
||||||
{
|
{
|
||||||
float dx = 0.0f; // spacing counter for newline handling
|
float dx = 0.0f; // spacing counter for newline handling
|
||||||
|
|||||||
@@ -73,15 +73,6 @@ namespace opengl
|
|||||||
|
|
||||||
virtual ~Font();
|
virtual ~Font();
|
||||||
|
|
||||||
/**
|
|
||||||
* Prints the text at the designated position.
|
|
||||||
*
|
|
||||||
* @param text A string.
|
|
||||||
* @param x The x-coordinate.
|
|
||||||
* @param y The y-coordinate.
|
|
||||||
**/
|
|
||||||
void print(std::string text, float x, float y) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints the text at the designated position with rotation and scaling.
|
* Prints the text at the designated position with rotation and scaling.
|
||||||
*
|
*
|
||||||
@@ -90,7 +81,7 @@ namespace opengl
|
|||||||
* @param y The y-coordinate.
|
* @param y The y-coordinate.
|
||||||
* @param angle The amount of rotation.
|
* @param angle The amount of rotation.
|
||||||
**/
|
**/
|
||||||
void print(std::string text, float x, float y, float angle, float sx, float sy) const;
|
void print(std::string text, float x, float y, float angle = 0.0f, float sx = 1.0f, float sy = 1.0f) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints the character at the designated position.
|
* Prints the character at the designated position.
|
||||||
|
|||||||
@@ -708,25 +708,6 @@ namespace opengl
|
|||||||
return (int)max;
|
return (int)max;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::print( const char * str, float x, float y)
|
|
||||||
{
|
|
||||||
if(currentFont != 0)
|
|
||||||
{
|
|
||||||
std::string text(str);
|
|
||||||
currentFont->print(text, x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Graphics::print( const char * str, float x, float y, float angle)
|
|
||||||
{
|
|
||||||
print(str, x, y, angle, 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Graphics::print( const char * str, float x, float y, float angle, float s)
|
|
||||||
{
|
|
||||||
print(str, x, y, angle, s, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Graphics::print( const char * str, float x, float y , float angle, float sx, float sy)
|
void Graphics::print( const char * str, float x, float y , float angle, float sx, float sy)
|
||||||
{
|
{
|
||||||
if(currentFont != 0)
|
if(currentFont != 0)
|
||||||
|
|||||||
@@ -397,33 +397,6 @@ namespace opengl
|
|||||||
**/
|
**/
|
||||||
int getMaxPointSize();
|
int getMaxPointSize();
|
||||||
|
|
||||||
/**
|
|
||||||
* Draw text on screen at the specified coordiantes (automatically breaks \n characters).
|
|
||||||
*
|
|
||||||
* @param str A string of text.
|
|
||||||
* @param x The x-coordiante.
|
|
||||||
* @param y The y-coordiante.
|
|
||||||
**/
|
|
||||||
void print(const char * str, float x, float y);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws text at the specified coordinates, with rotation.
|
|
||||||
* @param x The x-coordinate.
|
|
||||||
* @param y The y-coordinate.
|
|
||||||
* @param angle The amount of rotation.
|
|
||||||
**/
|
|
||||||
void print(const char * str, float x, float y , float angle);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws text at the specified coordinates, with rotation and
|
|
||||||
* scaling.
|
|
||||||
* @param x The x-coordinate.
|
|
||||||
* @param y The y-coordinate.
|
|
||||||
* @param angle The amount of rotation.
|
|
||||||
* @param s The scale factor. (1 = normal).
|
|
||||||
**/
|
|
||||||
void print(const char * str, float x, float y , float angle, float s);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws text at the specified coordinates, with rotation and
|
* Draws text at the specified coordinates, with rotation and
|
||||||
* scaling along both axes.
|
* scaling along both axes.
|
||||||
@@ -433,7 +406,7 @@ namespace opengl
|
|||||||
* @param sx The scale factor along the x-axis. (1 = normal).
|
* @param sx The scale factor along the x-axis. (1 = normal).
|
||||||
* @param sy The scale factor along the y-axis. (1 = normal).
|
* @param sy The scale factor along the y-axis. (1 = normal).
|
||||||
**/
|
**/
|
||||||
void print(const char * str, float x, float y , float angle, float sx, float sy);
|
void print(const char * str, float x, float y , float angle = 0.0f, float sx = 1.0f, float sy = 1.0f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw formatted text on screen at the specified coordinates.
|
* Draw formatted text on screen at the specified coordinates.
|
||||||
|
|||||||
@@ -755,24 +755,7 @@ namespace opengl
|
|||||||
float angle = (float)luaL_optnumber(L, 4, 0.0f);
|
float angle = (float)luaL_optnumber(L, 4, 0.0f);
|
||||||
float sx = (float)luaL_optnumber(L, 5, 1.0f);
|
float sx = (float)luaL_optnumber(L, 5, 1.0f);
|
||||||
float sy = (float)luaL_optnumber(L, 6, sx);
|
float sy = (float)luaL_optnumber(L, 6, sx);
|
||||||
|
|
||||||
switch(lua_gettop(L))
|
|
||||||
{
|
|
||||||
case 3:
|
|
||||||
instance->print(str, x, y);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
instance->print(str, x, y, angle);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
instance->print(str, x, y, angle, sx);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
instance->print(str, x, y, angle, sx, sy);
|
instance->print(str, x, y, angle, sx, sy);
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return luaL_error(L, "Incorrect number of parameters");
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user