did pause menu, personal seed, and seed info in screen

This commit is contained in:
bizcochito 2021-03-15 19:54:32 +01:00
parent dd487f7b2b
commit ef648d556d
No known key found for this signature in database
GPG Key ID: 4A514B3A7A673EB6
1 changed files with 39 additions and 7 deletions

View File

@ -1,7 +1,12 @@
g3d = require "g3d" g3d = require "g3d"
require "suppfunc"
function love.load() function love.load()
math.randomseed(os.time()) -- Personal seed generation
personalseed = love.data.encode("string", "hex", love.data.hash("sha256", os.getenv("PATH")))
notsorandomseed = tonumber(personalseed, 16)
math.randomseed(notsorandomseed)
-- GRAPHICS -- GRAPHICS
-- GOOD PIXEL -- GOOD PIXEL
love.graphics.setDefaultFilter("nearest") love.graphics.setDefaultFilter("nearest")
@ -21,20 +26,33 @@ function love.load()
end end
function love.mousemoved(x,y, dx,dy) function love.mousemoved(x,y, dx,dy)
g3d.camera.firstPersonLook(dx,dy) if not pause then
g3d.camera.firstPersonLook(dx,dy)
end
end end
function love.update(dt) function love.update(dt)
g3d.camera.firstPersonMovement(dt,5) if not pause then
g3d.camera.firstPersonMovement(dt,5)
end
end end
function love.keypressed(key) function love.keypressed(key)
if key == "z" then if key == "z" then
obj_list = {} obj_list = {}
math.randomseed(os.time()) notsorandomseed = os.time()
math.randomseed(notsorandomseed )
generate_museum(0,0,0) generate_museum(0,0,0)
end end
if key == "escape" then
if pause then
pause = false
love.mouse.setRelativeMode(true)
else
pause = true
love.mouse.setRelativeMode(false)
end
end
end end
function love.draw() function love.draw()
@ -42,12 +60,26 @@ function love.draw()
for _, obj in pairs(obj_list) do for _, obj in pairs(obj_list) do
obj:draw() obj:draw()
end end
-- print coords -- print "Press [z] to generate a new museum"
love.graphics.print("Press [z] to generate a new museum", 20, 20) love.graphics.print("Press [z] to generate a new museum", 20, 20)
-- print coords -- print coords
love.graphics.print("x: "..math.floor(g3d.camera.position[1])..", y: "..math.floor(g3d.camera.position[2])..", z: "..math.floor(g3d.camera.position[3]), 20, 40) love.graphics.print("x: "..math.floor(g3d.camera.position[1])..", y: "..math.floor(g3d.camera.position[2])..", z: "..math.floor(g3d.camera.position[3]), 20, 40)
-- print seed
if notsorandomseed == tonumber(personalseed, 16) then
love.graphics.setColor(hexrgb("#FFD700"))
love.graphics.print("Seed: "..personalseed, 20, 60)
love.graphics.setColor(hexrgb("#ffffff"))
else
love.graphics.print("Seed: "..notsorandomseed, 20, 60)
end
if pause then
love.graphics.rectangle("fill", 20, 20, love.graphics.getWidth()-40, love.graphics.getHeight()-40)
end
end end
function generate_museum(x,y,z) function generate_museum(x,y,z)