Remove Graphics::vid, Graphics::textwidthx, Graphics::textsize
This commit is contained in:
parent
e1d230f814
commit
9b9b0b794a
@ -117,7 +117,7 @@ void BlueScreen(String detailMessage)
|
||||
while (SDL_PollEvent(&event))
|
||||
if(event.type == SDL_QUIT)
|
||||
exit(-1); // Don't use Platform::Exit, we're practically zombies at this point anyway.
|
||||
blit(engine.g->vid);
|
||||
blit(engine.g->Data());
|
||||
}
|
||||
}
|
||||
|
||||
@ -444,7 +444,7 @@ int main(int argc, char * argv[])
|
||||
String loadingText = "Loading save...";
|
||||
engine.g->BlendText(engine.g->Size() / 2 - Vec2(Graphics::textwidth(loadingText) / 2, 5), loadingText, style::Colour::InformationTitle);
|
||||
|
||||
blit(engine.g->vid);
|
||||
blit(engine.g->Data());
|
||||
try
|
||||
{
|
||||
ByteString saveIdPart;
|
||||
|
@ -375,7 +375,7 @@ void EngineProcess()
|
||||
engine.GetForceIntegerScaling());
|
||||
}
|
||||
|
||||
blit(engine.g->vid);
|
||||
blit(engine.g->Data());
|
||||
}
|
||||
auto fpsLimit = ui::Engine::Ref().FpsLimit;
|
||||
auto now = uint64_t(SDL_GetTicks()) * UINT64_C(1'000'000);
|
||||
|
@ -172,18 +172,6 @@ int Graphics::textwidth(const String &str)
|
||||
return TextSize(str).X;
|
||||
}
|
||||
|
||||
int Graphics::textwidthx(const String &str, int w)
|
||||
{
|
||||
return TextFit(str, w) - str.begin();
|
||||
}
|
||||
|
||||
void Graphics::textsize(const String &str, int & width, int & height)
|
||||
{
|
||||
auto size = TextSize(str);
|
||||
width = size.X;
|
||||
height = size.Y;
|
||||
}
|
||||
|
||||
void Graphics::draw_icon(int x, int y, Icon icon, unsigned char alpha, bool invert)
|
||||
{
|
||||
y--;
|
||||
|
@ -82,9 +82,6 @@ public:
|
||||
return video.data();
|
||||
}
|
||||
|
||||
[[deprecated("Use Data()")]]
|
||||
pixel *vid = video.data();
|
||||
|
||||
struct GradientStop
|
||||
{
|
||||
pixel color;
|
||||
@ -95,12 +92,8 @@ public:
|
||||
static std::vector<pixel> Gradient(std::vector<GradientStop> stops, int resolution);
|
||||
|
||||
//Font/text metrics
|
||||
[[deprecated("Use TextFit()")]]
|
||||
static int textwidthx(const String &s, int w);
|
||||
[[deprecated("Use TextSize().X")]]
|
||||
static int textwidth(const String &s);
|
||||
[[deprecated("Use TextSize()")]]
|
||||
static void textsize(const String &s, int & width, int & height);
|
||||
|
||||
VideoBuffer DumpFrame();
|
||||
|
||||
|
@ -2171,8 +2171,7 @@ void GameView::OnDraw()
|
||||
|
||||
ren->RenderEnd();
|
||||
|
||||
std::copy_n(ren->Data(), WINDOWW * YRES, g->vid);
|
||||
|
||||
std::copy_n(ren->Data(), ren->Size().X * ren->Size().Y, g->Data());
|
||||
|
||||
if (doScreenshot)
|
||||
{
|
||||
@ -2454,10 +2453,6 @@ void GameView::OnDraw()
|
||||
g->fillrect(0, 0, WINDOWW, WINDOWH, 0, 0, 0, introText>51?102:introText*2);
|
||||
g->drawtext(16, 16, introTextMessage, 255, 255, 255, introText>51?255:introText*5);
|
||||
}
|
||||
|
||||
// Clear menu areas, to ensure particle graphics don't overlap
|
||||
memset(g->vid+((XRES+BARSIZE)*YRES), 0, (PIXELSIZE*(XRES+BARSIZE))*MENUSIZE);
|
||||
g->clearrect(XRES, 1, BARSIZE, YRES-1);
|
||||
}
|
||||
|
||||
ui::Point GameView::lineSnapCoords(ui::Point point1, ui::Point point2)
|
||||
|
@ -25,10 +25,10 @@ void Button::TextPosition(String ButtonText)
|
||||
buttonDisplayText = ButtonText;
|
||||
if(buttonDisplayText.length())
|
||||
{
|
||||
if(Graphics::textwidth(buttonDisplayText) > Size.X - (Appearance.icon? 22 : 0))
|
||||
if (Graphics::TextSize(buttonDisplayText).X > Size.X - (Appearance.icon ? 22 : 0))
|
||||
{
|
||||
int position = Graphics::textwidthx(buttonDisplayText, Size.X - (Appearance.icon? 38 : 22));
|
||||
buttonDisplayText = buttonDisplayText.erase(position, buttonDisplayText.length()-position);
|
||||
auto it = Graphics::TextFit(buttonDisplayText, Size.X - (Appearance.icon ? 38 : 22));
|
||||
buttonDisplayText.erase(it, buttonDisplayText.end());
|
||||
buttonDisplayText += "...";
|
||||
}
|
||||
}
|
||||
|
@ -69,9 +69,8 @@ void Component::TextPosition(String displayText)
|
||||
|
||||
textPosition = ui::Point(0, 0);
|
||||
|
||||
int textWidth, textHeight = 10;
|
||||
Graphics::textsize(displayText, textWidth, textHeight);
|
||||
textSize.X = textWidth; textSize.Y = textHeight;
|
||||
textSize = Graphics::TextSize(displayText);
|
||||
int textWidth = textSize.X, textHeight = textSize.Y;
|
||||
textHeight-=3;
|
||||
textWidth-=1;
|
||||
if(Appearance.icon)
|
||||
|
@ -39,10 +39,10 @@ SaveButton::SaveButton(Point position, Point size, SaveInfo * save_) : SaveButto
|
||||
if(save)
|
||||
{
|
||||
name = save->name;
|
||||
if(Graphics::textwidth(name) > Size.X)
|
||||
if (Graphics::TextSize(name).X > Size.X)
|
||||
{
|
||||
int position = Graphics::textwidthx(name, Size.X - 22);
|
||||
name = name.erase(position, name.length()-position);
|
||||
auto it = Graphics::TextFit(name, Size.X - (Appearance.icon ? 38 : 22));
|
||||
name.erase(it, name.end());
|
||||
name += "...";
|
||||
}
|
||||
|
||||
@ -100,10 +100,10 @@ SaveButton::SaveButton(Point position, Point size, SaveFile * file_) : SaveButto
|
||||
if(file)
|
||||
{
|
||||
name = file->GetDisplayName();
|
||||
if(Graphics::textwidth(name) > Size.X)
|
||||
if (Graphics::TextSize(name).X > Size.X)
|
||||
{
|
||||
int position = Graphics::textwidthx(name, Size.X - 22);
|
||||
name = name.erase(position, name.length()-position);
|
||||
auto it = Graphics::TextFit(name, Size.X - (Appearance.icon ? 38 : 22));
|
||||
name.erase(it, name.end());
|
||||
name += "...";
|
||||
}
|
||||
}
|
||||
|
@ -3715,10 +3715,10 @@ int LuaScriptInterface::graphics_textSize(lua_State * l)
|
||||
{
|
||||
int width, height;
|
||||
auto text = tpt_lua_optString(l, 1, "");
|
||||
Graphics::textsize(text, width, height);
|
||||
auto size = Graphics::TextSize(text);
|
||||
|
||||
lua_pushinteger(l, width);
|
||||
lua_pushinteger(l, height);
|
||||
lua_pushinteger(l, size.X);
|
||||
lua_pushinteger(l, size.Y);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user