**2D Equation (***EGSL*) : move the mouse over the screen

`openwindow(200,200,32,"2D Equation")`

-- constantes

local sqrt, atan2 = math.sqrt, math.atan2

local width, height = screenwidth(), screenheight()

local w, h = 16, 16

local dx, dy = w / width, h / height

-- variables

local px, py = {}, {}

local p, n, x, y, c

local mx, key

-- tables

for i = 0, width do

for j = 0, height do

p = i + j * width

px[p] = i

py[p] = j

end

end

repeat

key = getkey()

mx = mousex()

n = (mx + 1) * 10 / width

x = -w / 2

for j = 0, width do

y = -h / 2

for i= 0, height do

c = (sin(n * cos(sqrt((x*x) + (y*y))) + 5 * atan2(x,y)) +1) * 128

p = i + j * width

-- tracer les points --

color(c,c,c)

dot(px[p], py[p])

-----------------------

y = y + dy

end

x = x + dx

end

redraw()

until key == 27

closewindow()

N.B.: Personaly, I prefer EGSL because of the Lua syntax, the optional declaration of variables and because it is 'interpreted', so developing code is simpler. The results as regards speed are better in FreeBasic (a compiled language), but graphic commands are easier and more complete in EGSL (e.g. there is no anti-aliasing in FB, among other things). However FB has some other features, which are missing in EGSL (e.g. creating dynamic libraries, *.dll* or *.so* files, etc.), but I have never used them and don't need them for my personal purposes.