Skip to content

Commit

Permalink
Fixed font spacing and arrow showtime
Browse files Browse the repository at this point in the history
  • Loading branch information
rhbvkleef committed Apr 23, 2018
1 parent 66638de commit 207f454
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
16 changes: 8 additions & 8 deletions scripts/rendering/renderUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ R.drawMessage = function(message)
end

local iconOffset = function(index)
return 200 + (70 * index)
return 200 + (100 * index)
end
R.drawBuilding = function(state)
local x, y = scripts.helpers.calculations.getCoordinatesFromScreenPosition(love.mouse.getPosition())
Expand All @@ -83,20 +83,20 @@ R.drawStats = function(state)
love.graphics.draw(ICONS.happiness.image, iconOffset(4), .5, 0, 0.15)
love.graphics.draw(ICONS.money.image, iconOffset(5), .5, 0, 0.15)
love.graphics.setColor(0, 0, 0)
love.graphics.print(state.properties.population, iconOffset(0) + 35, 7)
love.graphics.print(gamerules.getExcessPower(state), iconOffset(1) + 35, 7)
love.graphics.print(gamerules.getTotalHousing(state), iconOffset(2) + 35, 7)
love.graphics.print(gamerules.getAvailableJobs(state), iconOffset(3) + 35, 7)
love.graphics.print(gamerules.getHappiness(state), iconOffset(4) + 35, 7)
love.graphics.print(state.properties.money, iconOffset(5) + 35, 7)
love.graphics.print(state.properties.population, iconOffset(0) + 35, 1)
love.graphics.print(gamerules.getExcessPower(state), iconOffset(1) + 35, 1)
love.graphics.print(gamerules.getTotalHousing(state), iconOffset(2) + 35, 1)
love.graphics.print(gamerules.getAvailableJobs(state), iconOffset(3) + 35, 1)
love.graphics.print(gamerules.getHappiness(state), iconOffset(4) + 35, 1)
love.graphics.print(state.properties.money, iconOffset(5) + 35, 1)
love.graphics.setColor(1, 1, 1)
love.graphics.setDefaultFilter("nearest", "nearest")

local offsets = { population = 0, energy = 1, housing = 2, work = 3, happiness = 4, money = 5 }
for _, update in ipairs(R.updates) do
local m = update:gmatch("[^_]+")
local type, direction, color = m(), m(), m()
local offsetX = iconOffset(offsets[type]) + 45
local offsetX = iconOffset(offsets[type]) + 60
local offsetY = 0.5
local angle = 0
if color == "red" and direction == "up" then
Expand Down
2 changes: 1 addition & 1 deletion scripts/states/endOfTurn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ end
function menu:update(dt)
scripts.rendering.renderUI.updateMove(dt)
if #menu.creepers > 0 then
Gamestate.push(scripts.states.showCreepers, menu.creepers)
Gamestate.push(scripts.states.showCreepers, menu.creepers, menu.changes)
menu.creepers = {}
else
menu.t = menu.t - dt
Expand Down
7 changes: 6 additions & 1 deletion scripts/states/showCreepers.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
local menu = {} -- previously: Gamestate.new()
menu.name = "showCreepers"
function menu:enter(prev, cards)
function menu:enter(prev, cards, changes)
menu.prev = prev
menu.cards = cards
menu.changes = changes
end

local offsets = {
Expand All @@ -26,6 +27,10 @@ function menu:draw()
end
end

function menu:update()
scripts.rendering.renderUI.drawUpdates(menu.changes)
end

function menu:mousepressed(x, y, click)
for i = 1, math.min(#offsets, #menu.cards) do
for k, card in pairs(scripts.gameobjects.cards) do
Expand Down

0 comments on commit 207f454

Please sign in to comment.