Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Commit

Permalink
Reduce amount of created fonts
Browse files Browse the repository at this point in the history
Accidentally created a new font for each new button.
  • Loading branch information
rm-code committed May 5, 2015
1 parent e948b6e commit cb0912e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ui/components/Button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ local TextLabel = require('src.ui.decorators.TextLabel');

local Button = {};

local LABEL_FONT = love.graphics.newFont('res/fonts/SourceCodePro-Medium.otf', 20);

function Button.new(command, text, x, y, w, h)
local self = BaseDecorator(x, y, w, h);

Expand All @@ -37,8 +39,6 @@ function Button.new(command, text, x, y, w, h)
local hlCol = { 255, 255, 255, 100 };
local textCol = { 200, 200, 200, 255 };

local LABEL_FONT = love.graphics.newFont('res/fonts/SourceCodePro-Medium.otf', 20);

local textX = w * 0.5 - LABEL_FONT:getWidth(text) * 0.5;
local textY = h * 0.5 - LABEL_FONT:getHeight() * 0.5;

Expand Down

0 comments on commit cb0912e

Please sign in to comment.