Skip to content

Commit

Permalink
Added some very simple onhover images for the stats.
Browse files Browse the repository at this point in the history
  • Loading branch information
nanderv committed Apr 23, 2018
1 parent bc9ad4c commit f9413a8
Showing 1 changed file with 29 additions and 9 deletions.
38 changes: 29 additions & 9 deletions scripts/rendering/renderUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ R.drawCards = function(state, lowest)
end
end
love.graphics.setColor(1, 1, 1)
scripts.rendering.renderCard.cardBack({ name = "Draw pile\n".. #state.drawPile .." cards" }, 10, 568, 0.5)
scripts.rendering.renderCard.cardBack({ name = "Discard pile\n".. #state.discardPile .." cards" }, 1210, 568, 0.5)
scripts.rendering.renderCard.cardBack({ name = "Draw pile\n" .. #state.drawPile .. " cards" }, 10, 568, 0.5)
scripts.rendering.renderCard.cardBack({ name = "Discard pile\n" .. #state.discardPile .. " cards" }, 1210, 568, 0.5)
end

R.drawCard = function(state, card, running, fromTheAir)
Expand Down Expand Up @@ -63,7 +63,7 @@ R.drawBuilding = function(state)
local b = scripts.helpers.calculations.hasBuilding(state, x, y)
if CAMERA.buildingFocus then

b = {building=CAMERA.buildingFocus}
b = { building = CAMERA.buildingFocus }
end

if b then
Expand All @@ -72,7 +72,6 @@ R.drawBuilding = function(state)
local building = scripts.gameobjects.buildings[b.building]

scripts.rendering.renderCard.renderCard(building, 10, 40, 0.5, true)

end
end
R.drawStats = function(state)
Expand Down Expand Up @@ -118,10 +117,31 @@ R.drawStats = function(state)
love.graphics.draw(icon.image, offsetX, offsetY, angle, 0.15)
end
local x, y = love.mouse.getPosition()
local yg = y / GLOBSCALE()
local xg, yg = x/GLOBSCALE(), y / GLOBSCALE()
if yg < 30 then
love.graphics.draw(ICONS.backdrop_top.image, 0, 30,0,1,2)

love.graphics.draw(ICONS.backdrop_top.image, 0, 30, 0, 1, 2)
local str = ""
if xg >200 and xg < 300 then
str = "Population increases if there's enough happiness and enough work"
end
if xg >300 and xg < 400 then
str = "Power is produced by power-generators and consumed by other buildings."
end
if xg >400 and xg < 500 then
str = "Housing is created by residential buildings and apartments."
end
if xg > 500 and xg < 600 then
str = "Work is the number of work not done by people. Negative means unemployment."
end
if xg > 600 and xg < 700 then
str = "Happiness is relaxation minus nuisance minus population."
end
if xg > 700 and xg < 800 then
str = "Money is created by population with work, and is used by buildings (money_per_turn)."
end
love.graphics.setColor(0,0,0)
love.graphics.print(str, 40, 45)
love.graphics.setColor(1,1,1)
end
R.updates = {}
end
Expand Down Expand Up @@ -158,7 +178,7 @@ R.updateMove = function(dt)
if car.lifetime < 0 then
carsToRemove[#carsToRemove + 1] = i
end
car.timer = car.timer + 20*dt
car.timer = car.timer + 20 * dt
if car.timer > 4 then
car.timer = 0
end
Expand Down Expand Up @@ -242,7 +262,7 @@ function R.mouseReleased(x, y, mouse_btn)
end

function R.wheelmoved(x, y)
CAMERA.r = CAMERA.r + (y / 10)
CAMERA.r = CAMERA.r + (y / 10)
end

return R

0 comments on commit f9413a8

Please sign in to comment.