Skip to content

Commit

Permalink
Merge pull request #71 from togfoxy/WIP
Browse files Browse the repository at this point in the history
Wip
  • Loading branch information
togfoxy authored Dec 28, 2022
2 parents 89551cc + a5d95dc commit ad739bb
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 25 deletions.
Binary file removed Autarky2/Autarky2.love
Binary file not shown.
Binary file removed Autarky2/MarketPlace-Page-2.drawio.png
Binary file not shown.
Binary file added Autarky2/assets/images/button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Autarky2/assets/images/paperbg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 30 additions & 10 deletions Autarky2/buttons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,15 @@ local mybutton = {}
mybutton.width = 65
mybutton.height = 20
mybutton.bgcolour = {0,0,0,1}
mybutton.drawOutline = true
mybutton.drawOutline = false
mybutton.outlineColour = {1,1,1,1}
mybutton.label = "Close" -- alarm off
mybutton.image = nil
mybutton.image = GUI[enum.guiButton]
mybutton.imageoffsetx = 20
mybutton.imageoffsety = 0
mybutton.imagescalex = 0.9
mybutton.imagescaley = 0.3

-- -- mybutton.labelcolour = {1,1,1,1}
mybutton.labeloffcolour = {1,1,1,1}
mybutton.labeloncolour = {1,1,1,1}
Expand All @@ -79,16 +84,20 @@ local mybutton = {}
mybutton.width = 20
mybutton.height = 20
mybutton.bgcolour = {0,0,0,1}
mybutton.drawOutline = true
mybutton.drawOutline = false
mybutton.outlineColour = {1,1,1,1}
mybutton.label = " ^" -- alarm off
mybutton.image = nil
mybutton.label = "" -- alarm off
mybutton.image = GUI[enum.guiSpinnerUp]
mybutton.imageoffsetx = 10
mybutton.imageoffsety = 10
mybutton.imagescalex = 1
mybutton.imagescaley = 1

-- -- mybutton.labelcolour = {1,1,1,1}
mybutton.labeloffcolour = {1,1,1,1}
mybutton.labeloncolour = {1,1,1,1}
mybutton.labelcolour = {1,1,1,1}
mybutton.labelxoffset = 0

mybutton.state = "on"
mybutton.visible = true
mybutton.scene = enum.sceneOptions
Expand All @@ -103,10 +112,15 @@ local mybutton = {}
mybutton.width = 20
mybutton.height = 20
mybutton.bgcolour = {0,0,0,1}
mybutton.drawOutline = true
mybutton.drawOutline = false
mybutton.outlineColour = {1,1,1,1}
mybutton.label = " v" -- alarm off
mybutton.image = nil
mybutton.label = "" -- alarm off
mybutton.image = GUI[enum.guiSpinnerDown]
mybutton.imageoffsetx = 10
mybutton.imageoffsety = 10
mybutton.imagescalex = 1
mybutton.imagescaley = 1

-- -- mybutton.labelcolour = {1,1,1,1}
mybutton.labeloffcolour = {1,1,1,1}
mybutton.labeloncolour = {1,1,1,1}
Expand All @@ -127,9 +141,15 @@ local mybutton = {}
mybutton.width = 40
mybutton.height = 25
mybutton.bgcolour = {0,0,0,1}
mybutton.drawOutline = true
mybutton.drawOutline = false
mybutton.outlineColour = {1,1,1,1}
mybutton.label = tostring(SOCIAL_SECURITY_ACTIVE)
mybutton.image = GUI[enum.guiButton]
mybutton.imageoffsetx = 20
mybutton.imageoffsety = 0
mybutton.imagescalex = 0.9
mybutton.imagescaley = 0.3

-- -- mybutton.labelcolour = {1,1,1,1}
mybutton.labeloffcolour = {1,1,1,1}
mybutton.labeloncolour = {1,1,1,1}
Expand Down
5 changes: 5 additions & 0 deletions Autarky2/constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,12 @@ function constants.load()

enum.fontDefault = 1
enum.fontLarge = 2
enum.fontMedium = 3

enum.guiSpinnerUp = 1
enum.guiSpinnerDown = 2
enum.guiPaperBG = 3
enum.guiButton = 4

enum.sceneOptions = 1 --! this is inconsistently applied
enum.sceneWorld = 2
Expand All @@ -167,6 +170,8 @@ function constants.load()
enum.buttonOptionsDownSpinner = 3
enum.buttonOptionsSocialSecurity = 4

enum.miscPaperBG = 201 -- start at 200. Icons start at 100

end


Expand Down
14 changes: 8 additions & 6 deletions Autarky2/draw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function draw.topBar()

-- draw more counts on the far right margin
local str = "Villagers available: " .. #PERSONS .. " Villagers quit: " .. PERSONS_LEFT
love.graphics.print(str, SCREEN_WIDTH - 350, 10)
love.graphics.print(str, SCREEN_WIDTH - 400, 10)

end

Expand Down Expand Up @@ -267,24 +267,26 @@ function draw.optionScreen()
love.graphics.print("Sales tax on purchases", 25, 65)
love.graphics.print(SALES_TAX * 100 .. "%", 145, 115)

love.graphics.print("Social security", 25, 200)

love.graphics.print("Social security", 55, 200)

-- draw buttons
for k, button in pairs(GUI_BUTTONS) do
if button.scene == enum.sceneOptions and button.visible then
-- draw the button

-- draw the bg
love.graphics.setColor(button.bgcolour)
love.graphics.rectangle("fill", button.x, button.y, button.width, button.height) -- drawx/y is the top left corner of the square

-- draw the outline
love.graphics.setColor(button.outlineColour)
love.graphics.rectangle("line", button.x, button.y, button.width, button.height) -- drawx/y is the top left corner of the square
if button.drawOutline then
love.graphics.setColor(button.outlineColour)
love.graphics.rectangle("line", button.x, button.y, button.width, button.height) -- drawx/y is the top left corner of the square
end

if button.image ~= nil then
love.graphics.setColor(1,1,1,1)
love.graphics.draw(button.image, button.x, button.y)
love.graphics.draw(button.image, button.x, button.y, 0, button.imagescalex, button.imagescaley, button.imageoffsetx, button.imageoffsety)
end

-- draw the label
Expand Down
19 changes: 19 additions & 0 deletions Autarky2/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ function functions.loadImages()
-- GUI
GUI[enum.guiSpinnerUp] = love.graphics.newImage("assets/images/buttonspinnerup.png")
GUI[enum.guiSpinnerDown] = love.graphics.newImage("assets/images/buttonspinnerdown.png")
GUI[enum.guiButton] = love.graphics.newImage("assets/images/button.png")

-- MISC
IMAGES[enum.miscPaperBG] = love.graphics.newImage("assets/images/paperbg.png")


end
Expand Down Expand Up @@ -62,6 +66,7 @@ end

function functions.loadFonts()
FONT[enum.fontDefault] = love.graphics.newFont("assets/fonts/Vera.ttf", 12)
FONT[enum.fontMedium] = love.graphics.newFont("assets/fonts/Vera.ttf", 14)
FONT[enum.fontLarge] = love.graphics.newFont("assets/fonts/Vera.ttf", 18)
-- FONT[enum.fontHeavyMetalLarge] = love.graphics.newFont("assets/fonts/Heavy Metal Box.ttf")
-- FONT[enum.fontTech18] = love.graphics.newFont("assets/fonts/CorporateGothicNbpRegular-YJJ2.ttf", 24)
Expand Down Expand Up @@ -267,5 +272,19 @@ function functions.PlayAmbientMusic()
end
end

function functions.getCommodityLabel(commodityID)
-- receives an enum and returns a string
-- has no pre or post spacing

if commodityID == enum.stockFood then
return "apples" --! singular/plural
elseif commodityID == enum.stockLogs then
return "logs"
elseif commodityID == enum.stockHerbs then
return "herbs"
elseif commodityID == enum.stockHouse then
return "house"
end
end

return functions
21 changes: 16 additions & 5 deletions Autarky2/people.lua
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,25 @@ local function drawDebug(person)
end

local function drawVillagersLog(person)
local drawx = 300
local drawy = 300

local maxindex = math.min(100, #person.log)
-- draw background
-- love.graphics.draw(IMAGES[enum.miscPaperBG], x, y, r, sx, sy, ox, oy, kx, ky)
love.graphics.setColor(1,1,1,1)
love.graphics.draw(IMAGES[enum.miscPaperBG], SCREEN_WIDTH - 300, 100, 0, 0.5, 0.25, 5, 5)

-- draw text
love.graphics.setFont(FONT[enum.fontMedium])
love.graphics.setColor(0,0,0,1)
local drawx = SCREEN_WIDTH - 300 --! smaller font
local drawy = 100

local maxindex = math.min(6, #person.log)
for i = 1, maxindex do
love.graphics.print(person.log[i], drawx, drawy)
drawy = drawy + 50
drawy = drawy + 20
end


end

function people.draw()
Expand Down Expand Up @@ -517,7 +528,7 @@ local function resolveMarketplace()

-- record tax owed. It won't be paid until later
buyer.stock[enum.stockTaxOwed] = cf.round(buyer.stock[enum.stockTaxOwed] + (outcome.transactionTotalPrice * SALES_TAX),2)
local str = "I bought " .. outcome.transactionTotalQty .. " " .. outcome.commodityID .. " for $" .. outcome.agreedprice
local str = "I bought " .. outcome.transactionTotalQty .. " " .. fun.getCommodityLabel(outcome.commodityID) .. " for $" .. outcome.agreedprice .. " each"
table.insert(buyer.log, 1, str)
end
end
Expand Down
3 changes: 2 additions & 1 deletion Autarky2/savedata/HistoryPrice.dat
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
�*���������������
�*�������������G�z�?��G�z�?�333333�?����p=
ף@�������@��
Binary file modified Autarky2/savedata/HistoryStock.dat
Binary file not shown.
3 changes: 2 additions & 1 deletion Autarky2/savedata/HistoryTreasury.dat
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
�
��q=
ףp@
3 changes: 2 additions & 1 deletion Autarky2/savedata/globals.dat
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
�&�TREASURY�WORLD_DAYS�PERSONS_LEFT�WELLROW$�SALES_TAX��������?�TREASURY_OWED�WORLD_HOURS&�SOCIAL_SECURITY_ACTIVE��MARKETROW#�MARKETCOL&�WELLCOL7
�&�SALES_TAX��������?�WELLROW(�WELLCOL7�PERSONS_LEFT�MARKETROW*�MARKETCOL!�TREASURY_OWED�TREASURY�q=
ףp@�WORLD_DAYS�SOCIAL_SECURITY_ACTIVE��WORLD_HOURS
2 changes: 1 addition & 1 deletion Autarky2/savedata/map.dat

Large diffs are not rendered by default.

Binary file modified Autarky2/savedata/persons.dat
Binary file not shown.

0 comments on commit ad739bb

Please sign in to comment.