--[[-- Mandulia -- Mandelbrot/Julia explorer Copyright (C) 2010 Claude Heiland-Allen This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . --]]-- require("defaults") do local delta = { x = 0, y = 0, z = 0 } local speed = 0.01 local phi = (math.sqrt(5) + 1) / 2 local phi1 = (math.sqrt(5) - 1) / 2 local keys = { Escape = function() mandulia.quit() end , F11 = function() mandulia.fullscreen = not mandulia.fullscreen end , Right = function() delta.x = delta.x + 1 end , Left = function() delta.x = delta.x - 1 end , Up = function() delta.y = delta.y + 1 end , Down = function() delta.y = delta.y - 1 end , PageUp = function() delta.z = delta.z + 1 end , PageDown = function() delta.z = delta.z - 1 end , End = function() delta = { x = 0, y = 0, z = 0 } end , Home = function() mandulia.view = { x = 0, y = 0, z = 0 } end , ["["] = function() speed = speed * 0.95 end , ["]"] = function() speed = speed / 0.95 end , ["#"] = function() speed = 0.01 end } function mandulia.render() mandulia.view.x = mandulia.view.x + speed * delta.x * phi1 ^ mandulia.view.z mandulia.view.y = mandulia.view.y + speed * delta.y * phi1 ^ mandulia.view.z mandulia.view.z = mandulia.view.z + speed * delta.z end function mandulia.keyboard(key) if type(keys[key]) == "function" then keys[key]() end end end