Compare commits

..

No commits in common. "f06f6e2ec01269710812b5f3331a5e49a6fb3fb9" and "dd487f7b2b7e067dbebf28095aade30dffead305" have entirely different histories.

2 changed files with 7 additions and 73 deletions

View File

@ -1,12 +1,7 @@
g3d = require "g3d" g3d = require "g3d"
require "suppfunc"
function love.load() function love.load()
-- Personal seed generation math.randomseed(os.time())
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")
@ -26,33 +21,20 @@ function love.load()
end end
function love.mousemoved(x,y, dx,dy) function love.mousemoved(x,y, dx,dy)
if not pause then g3d.camera.firstPersonLook(dx,dy)
g3d.camera.firstPersonLook(dx,dy)
end
end end
function love.update(dt) function love.update(dt)
if not pause then g3d.camera.firstPersonMovement(dt,5)
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 = {}
notsorandomseed = os.time() math.randomseed(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()
@ -60,26 +42,12 @@ function love.draw()
for _, obj in pairs(obj_list) do for _, obj in pairs(obj_list) do
obj:draw() obj:draw()
end end
-- print "Press [z] to generate a new museum" -- print coords
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)

View File

@ -1,34 +0,0 @@
-- Converts HEXRGB to RGB
function hexrgb(hashtag)
hashtag = string.lower(hashtag)
local r1 = hex_to_dec(hashtag:sub(2,2))
local r2 = hex_to_dec(hashtag:sub(3,3))
local g1 = hex_to_dec(hashtag:sub(4,4))
local g2 = hex_to_dec(hashtag:sub(5,5))
local b1 = hex_to_dec(hashtag:sub(6,6))
local b2 = hex_to_dec(hashtag:sub(7,7))
return (r1*16 + r2)/255, (g1*16 + g2)/255, (b1*16 + b2)/255
end
function hex_to_dec(hex)
if hex == "0" then return 0
elseif hex == "1" then return 1
elseif hex == "2" then return 2
elseif hex == "3" then return 3
elseif hex == "4" then return 4
elseif hex == "5" then return 5
elseif hex == "6" then return 6
elseif hex == "7" then return 7
elseif hex == "8" then return 8
elseif hex == "9" then return 9
elseif hex == "a" then return 10
elseif hex == "b" then return 11
elseif hex == "c" then return 12
elseif hex == "d" then return 13
elseif hex == "e" then return 14
elseif hex == "f" then return 15
end
end