From c713f18292140435f9da38310534ad173197cc48 Mon Sep 17 00:00:00 2001 From: vlev Date: Mon, 26 Aug 2024 20:07:31 -0400 Subject: [PATCH] docs build --- docs/index.html | 2 +- docs/latest/camera/index.html | 16 +++++ docs/latest/classes/index.html | 42 +++++------ docs/latest/image/index.html | 16 ++--- docs/latest/index.html | 2 +- docs/latest/io/index.html | 14 ++-- docs/latest/keyboard/index.html | 36 +++++----- docs/latest/math/index.html | 16 ++--- docs/latest/models/index.html | 1 + docs/latest/mouse/index.html | 116 +++++++++++++++++------------- docs/latest/setting/index.html | 6 +- docs/latest/shapes/index.html | 14 ++-- docs/latest/shapes3D/index.html | 1 + docs/latest/transform/index.html | 1 + docs/latest/typography/index.html | 22 +++--- docs/latest/vector/index.html | 103 ++++++++++++++++++++------ docs/latest/window/index.html | 104 +++++++++++++-------------- docs/v0.1.6/camera/index.html | 16 +++++ docs/v0.1.6/classes/index.html | 27 +++++++ docs/v0.1.6/image/index.html | 10 +++ docs/v0.1.6/index.html | 1 + docs/v0.1.6/io/index.html | 9 +++ docs/v0.1.6/keyboard/index.html | 19 +++++ docs/v0.1.6/math/index.html | 13 ++++ docs/v0.1.6/models/index.html | 1 + docs/v0.1.6/mouse/index.html | 66 +++++++++++++++++ docs/v0.1.6/setting/index.html | 3 + docs/v0.1.6/shapes/index.html | 7 ++ docs/v0.1.6/shapes3D/index.html | 1 + docs/v0.1.6/transform/index.html | 1 + docs/v0.1.6/typography/index.html | 13 ++++ docs/v0.1.6/vector/index.html | 80 +++++++++++++++++++++ docs/v0.1.6/window/index.html | 52 ++++++++++++++ 33 files changed, 621 insertions(+), 210 deletions(-) create mode 100644 docs/latest/camera/index.html create mode 100644 docs/latest/models/index.html create mode 100644 docs/latest/shapes3D/index.html create mode 100644 docs/latest/transform/index.html create mode 100644 docs/v0.1.6/camera/index.html create mode 100644 docs/v0.1.6/classes/index.html create mode 100644 docs/v0.1.6/image/index.html create mode 100644 docs/v0.1.6/index.html create mode 100644 docs/v0.1.6/io/index.html create mode 100644 docs/v0.1.6/keyboard/index.html create mode 100644 docs/v0.1.6/math/index.html create mode 100644 docs/v0.1.6/models/index.html create mode 100644 docs/v0.1.6/mouse/index.html create mode 100644 docs/v0.1.6/setting/index.html create mode 100644 docs/v0.1.6/shapes/index.html create mode 100644 docs/v0.1.6/shapes3D/index.html create mode 100644 docs/v0.1.6/transform/index.html create mode 100644 docs/v0.1.6/typography/index.html create mode 100644 docs/v0.1.6/vector/index.html create mode 100644 docs/v0.1.6/window/index.html diff --git a/docs/index.html b/docs/index.html index 230c256a..d5e7ee5f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -lu5 | Interpreter for Creative Coding

Interpreter for Creative Coding

\ No newline at end of file +lu5 | Interpreter for Creative Coding

Interpreter for Creative Coding

\ No newline at end of file diff --git a/docs/latest/camera/index.html b/docs/latest/camera/index.html new file mode 100644 index 00000000..ac772b46 --- /dev/null +++ b/docs/latest/camera/index.html @@ -0,0 +1,16 @@ +lu5 | camera

camera

v0.1.6
orbitControl();

Helpful utility for controlling the camera around the origin.
Enables quick camera controls without much of an implementation.

function setup()
+    createWindow(800, 800, GL3D);
+end
+
+function draw() 
+    background(51);
+
+    -- Allows us to control the camera
+    orbitControl();
+
+    noFill();
+    stroke(80, 255, 50);
+    strokeWeight(4);
+
+    box(60);
+end

\ No newline at end of file diff --git a/docs/latest/classes/index.html b/docs/latest/classes/index.html index 42ca47ac..d92b1ca8 100644 --- a/docs/latest/classes/index.html +++ b/docs/latest/classes/index.html @@ -1,27 +1,27 @@ -lu5 | classes

classes

v0.0.6
class(name);

Create a class.
if a class implements a print method, it can be used in the print function

Arguments

nameThe class name

 local Player = class('Player');
+lu5 | classes

classes

v0.1.6
class(name);

Create a class.
if a class implements a print method, it can be used in the print function

Arguments

nameThe class name

local Player = class('Player');
 
- function Player:init(x, y)
-   self.x = x;
-   self.y = y;
-   return self;
- end
+function Player:init(x, y)
+  self.x = x;
+  self.y = y;
+  return self;
+end
 
- function Player:draw()
-   circle(self.x, self.y, 16);
- end
+function Player:draw()
+  circle(self.x, self.y, 16);
+end
 
 
- -- Create 2 players and draw them
- local p1 = Player:new(100, 200);
- local p2 = Player:new(300, 200);
+-- Create 2 players and draw them
+local p1 = Player:new(100, 200);
+local p2 = Player:new(300, 200);
 
- function setup()
-   createWindow(400, 400);
- end
- 
- function draw()
-   background(51);
+function setup()
+  createWindow(400, 400);
+end
 
-   p1:draw();
-   p2:draw();
- end

\ No newline at end of file +function draw() + background(51); + + p1:draw(); + p2:draw(); +end

\ No newline at end of file diff --git a/docs/latest/image/index.html b/docs/latest/image/index.html index c25e043b..7cdcea37 100644 --- a/docs/latest/image/index.html +++ b/docs/latest/image/index.html @@ -1,10 +1,10 @@ -lu5 | image

image

v0.0.6
loadImage(path);

Load a png or jpeg image

Arguments

pathThe local image path

Returns

imgThe image reference

 function setup()
-   createWindow(600, 600);
-   img = loadImage('/path/to/mypic.png');
- end
+lu5 | image

image

v0.1.6
loadImage(path);

Load a png or jpeg image

Arguments

pathThe local image path

Returns

ImageThe image instance

function setup()
+  createWindow(600, 600);
+  img = loadImage('/path/to/mypic.png');
+end
 
- function draw()
-   background(51);
+function draw()
+  background(51);
 
-   image(img, 0, 0);
- end   

image(image, x, y, [w], [h]);

Draw an image to the screen

Arguments

imageThe image reference
xThe x position of the image
yThe y position of the image
[w]The width of the image, if not specified, using source width
[h]The height of the image, if not specified, using source height


\ No newline at end of file + image(img, 0, 0); +end

image(img, x, y, [w], [h]);

Draw an image to the screen

Arguments

imgThe Image instance
xThe x position of the image
yThe y position of the image
[w]The width of the image, if not specified, using source width
[h]The height of the image, if not specified, using source height


Image.crop(x, y, w, h);

Crop an Image into an other Image

Arguments

xThe x position of the image
yThe y position of the image
wThe width of the new cropped image
hThe height of the new cropped image

Returns

Imagethe cropped image


\ No newline at end of file diff --git a/docs/latest/index.html b/docs/latest/index.html index 4fab914f..3af33325 100644 --- a/docs/latest/index.html +++ b/docs/latest/index.html @@ -1 +1 @@ -lu5 | Reference

Reference

v0.0.6
\ No newline at end of file +lu5 | Reference

Reference

v0.1.6
\ No newline at end of file diff --git a/docs/latest/io/index.html b/docs/latest/io/index.html index 7df0fc8a..788dc60f 100644 --- a/docs/latest/io/index.html +++ b/docs/latest/io/index.html @@ -1,9 +1,9 @@ -lu5 | io

io

v0.0.6
print(value);

Printing utility, can take any lua type.

Arguments

valueThe value to print to stdout

 print(42);
+lu5 | io

io

v0.1.6
print(value);

Printing utility, can take any lua type.

Arguments

valueThe value to print to stdout

print(42);
 
- print(1, 2, 3);
- 
- print('Hello world');
+print(1, 2, 3);
 
- print({ 3, 8, 1 });

loadText(file_path);

Read a file as a string

Arguments

file_pathThe path of the file

 file = loadText("./your-file.txt");
- print(file)

loadStrings(file_path);

Read a file as an array of strings split by line

Arguments

file_pathThe path of the file

 file = loadStrings("./your-file.txt");
- print(file)

\ No newline at end of file +print('Hello world'); + +print({ 3, 8, 1 });

loadText(file_path);

Read a file as a string

Arguments

file_pathThe path of the file

file = loadText("./your-file.txt");
+print(file)

loadStrings(file_path);

Read a file as an array of strings split by line

Arguments

file_pathThe path of the file

file = loadStrings("./your-file.txt");
+print(file)

\ No newline at end of file diff --git a/docs/latest/keyboard/index.html b/docs/latest/keyboard/index.html index e434bdba..5a2271c0 100644 --- a/docs/latest/keyboard/index.html +++ b/docs/latest/keyboard/index.html @@ -1,19 +1,19 @@ -lu5 | keyboard

keyboard

v0.0.6
keyIsDown(k);

Check if a keyboard key is pressed, returns true if key is down and returns false if it's not

Arguments

kThe keyboard key to check as a key global, or a string

Returns

booleanWhether or not the key is down

 -- Use a string 
- if (keyIsDown('a')) then
-   -- key 'a' is down
- end
+lu5 | keyboard

keyboard

v0.1.6
keyIsDown(k);

Check if a keyboard key is pressed, returns true if key is down and returns false if it's not

Arguments

kThe keyboard key to check as a key global, or a string

Returns

booleanWhether or not the key is down

-- Use a string 
+if (keyIsDown('a')) then
+  -- key 'a' is down
+end
 
- -- use a global
- if (keyIsDown(LEFT_ARROW)) then
-   -- left arrow is down
- end

keyPressed(key, keyCode);Event

Called whenever a key is pressed.

Arguments

keyThe pressed key as a string, is nil if glfw cannot find a name for the key
keyCodeThe pressed key as a key code

 function setup()
-    createWindow(600, 600);
- end
- 
- function draw()
-    background(51);
- end
- 
- function keyPressed(key, keyCode)
-    print(key, keyCode)
- end

keyReleased(key, keyCode);Event

Called whenever a key is released.

Arguments

keyThe released key as a string, is nil if glfw cannot find a name for the key
keyCodeThe released key as a key code


keyHeld(key, keyCode);Event

Called whenever a key is held down.

Arguments

keyThe held key as a string, is nil if glfw cannot find a name for the key
keyCodeThe held key as a key code


UP_ARROWGlobal

No description


DOWN_ARROWGlobal

No description


LEFT_ARROWGlobal

No description


RIGHT_ARROWGlobal

No description


KEY_ENTERGlobal

No description


KEY_BACKSPACEGlobal

No description


KEY_AGlobal

No description


KEY_BGlobal

No description


KEY_CGlobal

No description


KEY_DGlobal

No description


KEY_EGlobal

No description


KEY_FGlobal

No description


KEY_GGlobal

No description


KEY_HGlobal

No description


KEY_IGlobal

No description


KEY_JGlobal

No description


KEY_KGlobal

No description


KEY_LGlobal

No description


KEY_MGlobal

No description


KEY_NGlobal

No description


KEY_OGlobal

No description


KEY_PGlobal

No description


KEY_QGlobal

No description


KEY_RGlobal

No description


KEY_SGlobal

No description


KEY_TGlobal

No description


KEY_UGlobal

No description


KEY_VGlobal

No description


KEY_WGlobal

No description


KEY_XGlobal

No description


KEY_YGlobal

No description


KEY_ZGlobal

No description


\ No newline at end of file +-- use a global +if (keyIsDown(LEFT_ARROW)) then + -- left arrow is down +end

keyPressed(key, keyCode);Event

Called whenever a key is pressed.

Arguments

keyThe pressed key as a string, is nil if glfw cannot find a name for the key
keyCodeThe pressed key as a key code

function setup()
+   createWindow(600, 600);
+end
+
+function draw()
+   background(51);
+end
+
+function keyPressed(key, keyCode)
+   print(key, keyCode)
+end

keyReleased(key, keyCode);Event

Called whenever a key is released.

Arguments

keyThe released key as a string, is nil if glfw cannot find a name for the key
keyCodeThe released key as a key code


keyHeld(key, keyCode);Event

Called whenever a key is held down.

Arguments

keyThe held key as a string, is nil if glfw cannot find a name for the key
keyCodeThe held key as a key code


UP_ARROWConstant

No description


DOWN_ARROWConstant

No description


LEFT_ARROWConstant

No description


RIGHT_ARROWConstant

No description


KEY_ENTERConstant

No description


KEY_BACKSPACEConstant

No description


KEY_AConstant

No description


KEY_BConstant

No description


KEY_CConstant

No description


KEY_DConstant

No description


KEY_EConstant

No description


KEY_FConstant

No description


KEY_GConstant

No description


KEY_HConstant

No description


KEY_IConstant

No description


KEY_JConstant

No description


KEY_KConstant

No description


KEY_LConstant

No description


KEY_MConstant

No description


KEY_NConstant

No description


KEY_OConstant

No description


KEY_PConstant

No description


KEY_QConstant

No description


KEY_RConstant

No description


KEY_SConstant

No description


KEY_TConstant

No description


KEY_UConstant

No description


KEY_VConstant

No description


KEY_WConstant

No description


KEY_XConstant

No description


KEY_YConstant

No description


KEY_ZConstant

No description


\ No newline at end of file diff --git a/docs/latest/math/index.html b/docs/latest/math/index.html index f55d85a8..a1b98b1d 100644 --- a/docs/latest/math/index.html +++ b/docs/latest/math/index.html @@ -1,13 +1,13 @@ -lu5 | math

math

v0.0.6
randomSeed(seed);

Set a random seed

Arguments

seedThe seed value

Returns

numberThe random value


random(min, max);

Get a random number

Arguments

minThe minimum of the range
maxThe maximum of the range

Returns

numberThe random value

 random()      -- random number between 0 and 1
- random(3)     -- random number between 0 and 3
- random(3, 12) -- random number between 3 and 12
+lu5 | math

math

v0.1.6
randomSeed(seed);

Set a random seed

Arguments

seedThe seed value

Returns

numberThe random value


random(min, max);

Get a random number

Arguments

minThe minimum of the range
maxThe maximum of the range

Returns

numberThe random value

random()      -- random number between 0 and 1
+random(3)     -- random number between 0 and 3
+random(3, 12) -- random number between 3 and 12
 
- random({ 'A', 'B', 'C' }) -- random element in table

round(x);

Round a number to the nearest integer

Arguments

xThe value to round

Returns

intThe rounded value


floor(x);

floor is a function that takes in a number, and returns the greatest integer less or equal to x
see here

Arguments

xThe value to floor

Returns

intgreatest integer less than or equals to x


ceil(x);

ceil is a function that takes in a number, and returns the smallest integer greater or equal to x
see here

Arguments

xThe value to floor

Returns

intThe floored value


min(a, b);

Return the smallest value.
Can also take any number of arguments, or a table.

Arguments

aThe first value
bThe second value

Returns

numberThe smallest value

 min(6, 7); -- returns 6
+random({ 'A', 'B', 'C' }) -- random element in table

round(x);

Round a number to the nearest integer

Arguments

xThe value to round

Returns

intThe rounded value


floor(x);

floor is a function that takes in a number, and returns the greatest integer less or equal to x
see here

Arguments

xThe value to floor

Returns

intgreatest integer less than or equals to x


ceil(x);

ceil is a function that takes in a number, and returns the smallest integer greater or equal to x
see here

Arguments

xThe value to floor

Returns

intThe floored value


min(a, b);

Return the smallest value.
Can also take any number of arguments, or a table.

Arguments

aThe first value
bThe second value

Returns

numberThe smallest value

min(6, 7); -- returns 6
 
- min(6, 7, 4); -- returns 4
+min(6, 7, 4); -- returns 4
 
- min({ 6, 7, 4 }); -- returns 4

max(a, b);

Return the largest value.
Can also take any number of arguments, or a table.

Arguments

aThe first value
bThe second value

Returns

numberThe largest value

 max(2, 5); -- returns 5
+min({ 6, 7, 4 }); -- returns 4

max(a, b);

Return the largest value.
Can also take any number of arguments, or a table.

Arguments

aThe first value
bThe second value

Returns

numberThe largest value

max(2, 5); -- returns 5
 
- max(2, 5, 7); -- returns 7
+max(2, 5, 7); -- returns 7
 
- max({ 2, 5, 7 }); -- returns 7

abs(x);

Returns the absolute value of x which is its distance from 0
see here

Arguments

xThe input value

Returns

numberThe absolote value of the input


map(x, s1, e1, s2, e2);

Maps x from an original range to a target range

Arguments

xThe value to map
s1The start of the initial range
e1The end of the initial range
s2The start of the target range
e2The end of the target range

Returns

numberThe mapped value


dist(x1, y1, x2, y1);

Calculates the distance between 2 points in 2D space

Arguments

x1The x coordinate of the first point
y1The y coordinate of the first point
x2The x coordinate of the second point
y1The y coordinate of the second point

Returns

numberThe distance between the points


constrain(x, min, max);

Limits x to a minimum and maximum value

Arguments

xThe input value
minThe minimum value
maxThe maximum value

Returns

numberThe constrained value


sin(x);

Sine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


cos(x);

Cosine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


tan(x);

Tangent function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


PIGlobal

No description


TWO_PIGlobal

No description


HALF_PIGlobal

No description


QUARTER_PIGlobal

No description


\ No newline at end of file +max({ 2, 5, 7 }); -- returns 7

abs(x);

Returns the absolute value of x
see here

Arguments

xThe input value

Returns

numberThe absolote value of the input


map(x, s1, e1, s2, e2);

Maps x from an original range to a target range

Arguments

xThe value to map
s1The start of the initial range
e1The end of the initial range
s2The start of the target range
e2The end of the target range

Returns

numberThe mapped value


dist(x1, y1, x2, y1);

Calculates the distance between 2 points in 2D space

Arguments

x1The x coordinate of the first point
y1The y coordinate of the first point
x2The x coordinate of the second point
y1The y coordinate of the second point

Returns

numberThe distance between the points


constrain(x, min, max);

Limits x to a minimum and maximum value

Arguments

xThe input value
minThe minimum value
maxThe maximum value

Returns

numberThe constrained value


sin(x);

Sine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


cos(x);

Cosine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


tan(x);

Tangent function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


PIConstant

No description


TWO_PIConstant

No description


HALF_PIConstant

No description


QUARTER_PIConstant

No description


\ No newline at end of file diff --git a/docs/latest/models/index.html b/docs/latest/models/index.html new file mode 100644 index 00000000..8f3658e5 --- /dev/null +++ b/docs/latest/models/index.html @@ -0,0 +1 @@ +lu5 | models

models

v0.1.6
model(model);

Draw a 3D model

Arguments

modelThe 3D model


loadModel(model);

Load a 3D model

Arguments

modelThe 3D model


\ No newline at end of file diff --git a/docs/latest/mouse/index.html b/docs/latest/mouse/index.html index 708825fd..a6645364 100644 --- a/docs/latest/mouse/index.html +++ b/docs/latest/mouse/index.html @@ -1,50 +1,66 @@ -lu5 | mouse

mouse

v0.0.6
mouseXGlobal

The x mouse coordinate

 createWindow(400, 400);
-
- function draw()
-   background(51);
-   
-   line(mouseX, 0, mouseX, height);
- end

mouseYGlobal

The y mouse coordinate

 createWindow(400, 400);
-
- function draw()
-   background(51);
-   
-   line(0, mouseY, width, mouseY);
- end

mouseIsPressedGlobal

Is true when the mouse is pressed, is false when it's not


mousePressed(button);Event

Called when a mouse button is pressed.

Arguments

buttonThe pressed mouse button


-In the following example, the circle's size increases when the user clicks the mouse.

 size = 0;
-
- function setup()
-   createWindow(400, 400);
- end
-
- function draw()
-   background(51);
-
-   circle(mouseX, mouseY, size);
- end
-
- -- Increase circle size when mouse pressed
- function mousePressed()
-   size = size + 1;
- end

mouseReleased(button);Event

Called when a mouse button is released.

Arguments

buttonThe released mouse button


-In the following example, the circle's size increases when the user clicks the mouse.

 size = 32;
-
- function setup()
-   createWindow(400, 400);
- end
-
- function draw()
-   background(51);
-
-   circle(mouseX, mouseY, size);
- end
-
- -- Set larger circle size
- function mousePressed()
-   size = 64;
- end
-
- -- Reset size
- function mouseReleased()
-   size = 32;
- end

\ No newline at end of file +lu5 | mouse

mouse

v0.1.6
mouseYGlobal

The y mouse coordinate

createWindow(400, 400);
+
+function draw()
+  background(51);
+  
+  line(0, mouseY, width, mouseY);
+end

mouseXGlobal

The x mouse coordinate

createWindow(400, 400);
+
+function draw()
+  background(51);
+  
+  line(mouseX, 0, mouseX, height);
+end

pmouseYGlobal

No description


pmouseXGlobal

No description


mouseIsPressedGlobal

Is true when the mouse is pressed, is false when it's not


mousePressed(button);Event

Called when a mouse button is pressed.

Arguments

buttonThe pressed mouse button


+In the following example, the circle's size increases when the user clicks the mouse.

size = 0;
+
+function setup()
+  createWindow(400, 400);
+end
+
+function draw()
+  background(51);
+
+  circle(mouseX, mouseY, size);
+end
+
+-- Increase circle size when mouse pressed
+function mousePressed()
+  size = size + 1;
+end

mouseReleased(button);Event

Called when a mouse button is released.

Arguments

buttonThe released mouse button


+In the following example, the circle's size increases when the user clicks the mouse.

size = 32;
+
+function setup()
+  createWindow(400, 400);
+end
+
+function draw()
+  background(51);
+
+  circle(mouseX, mouseY, size);
+end
+
+-- Set larger circle size
+function mousePressed()
+  size = 64;
+end
+
+-- Reset size
+function mouseReleased()
+  size = size + 6;
+end

mouseWheel(button);Event

Called when a mouse wheel is used

Arguments

buttonThe pressed mouse button


+In the following example, the circle's size changes when the user scrolls

size = 0;
+
+function setup()
+  createWindow(400, 400);
+end
+
+function draw()
+  background(51);
+
+  circle(mouseX, mouseY, size);
+end
+
+-- Change circle size when mouse is scrolled
+function mouseWheel(delta)
+  size = size + delta;
+end

\ No newline at end of file diff --git a/docs/latest/setting/index.html b/docs/latest/setting/index.html index 22baaee3..6ebe4b61 100644 --- a/docs/latest/setting/index.html +++ b/docs/latest/setting/index.html @@ -1,3 +1,3 @@ -lu5 | setting

setting

v0.0.6
background(r, g, b, a);

Clear a background with a color

Arguments

rThe red byte
gThe green byte
bThe blue byte
aThe alpha byte


fill(r, g, b, [a]);

Set the fill color for shapes

Arguments

rThe red byte
gThe green byte
bThe blue byte
[a]The alpha byte

Can also accept a hexadecimal or color name as string

 fill(255, 150, 40);
- square(200, 200, 64);

strokeWeight(weight);

No description

Arguments

weightThe line width in pixels

 strokeWeight(8);
- line(200, 200, mouseX, mouseY);

noFill();

Disable fill


stroke(r, g, b, a);

Set the stroke color for shapes

Arguments

rThe red byte
gThe green byte
bThe blue byte
aThe alpha byte

Only implemented for line and circle


noStroke();

Disable stroke
Only implemented for line and circle


push();

Save the style settings


pop();

Restore the style settings


\ No newline at end of file +lu5 | setting

setting

v0.1.6
background(r, g, b, a);

Clear a background with a color

Arguments

rThe red byte
gThe green byte
bThe blue byte
aThe alpha byte


fill(r, g, b, [a]);

Set the fill color for shapes

Arguments

rThe red byte
gThe green byte
bThe blue byte
[a]The alpha byte

Can also accept a hexadecimal or color name as string

fill(255, 150, 40);
+square(200, 200, 64);

strokeWeight(weight);

No description

Arguments

weightThe line width in pixels

trokeWeight(8);
+ine(200, 200, mouseX, mouseY);

noFill();

Disable fill


stroke(r, g, b, a);

Set the stroke color for shapes

Arguments

rThe red byte
gThe green byte
bThe blue byte
aThe alpha byte

Only implemented for line and circle


noStroke();

Disable stroke
Only implemented for line and circle


push();

Save the style settings


pop();

Restore the style settings


\ No newline at end of file diff --git a/docs/latest/shapes/index.html b/docs/latest/shapes/index.html index 9f725dfa..2a5a0bb1 100644 --- a/docs/latest/shapes/index.html +++ b/docs/latest/shapes/index.html @@ -1,7 +1,7 @@ -lu5 | shapes

shapes

v0.0.6
circle(x, y, d);

Draw a circle to the opengl context

Arguments

xThe x position of the circle
yThe y position of the circle
dThe diameter of the circle


rect(x, y, w, h);

Draw a rectangle to the opengl context

Arguments

xThe x position of the reactangle
yThe y position of the reactangle
wThe width
hThe height


square(x, y, s);

Draw a square to the opengl context

Arguments

xThe x position of the square
yThe y position of the square
sThe size of the square


line(x1, y1, x2, y2);

Draw a line to the opengl context

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point


quad(x1, y1, x2, y2, x3, y3, x4, y4);

Draw a quad on the screen

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point
x3The x position of the third point
y3The y position of the third point
x4The x position of the fourth point
y4The y position of the fourth point


point();

Draw a point on the screen


arc();

Draw an arc on the screen


ellipse();

Draw an ellipse on the screen


triangle();

Draw a triangle on the screen


beginShape(mode);

Begin adding vertices to a custom shape

Arguments

modeThe opengl shape mode LINES, POINTS, QUADS, TRIANGLES, TRIANGLE_FAN

The following would draw a 100 by 100 square at position 100, 100 -The following would draw a 100 by 100 square at position 100, 100

 beginShape(QUADS);
-   vertex(100, 100);
-   vertex(100, 200);
-   vertex(200, 200);
-   vertex(200, 100);
- endShape();

vertex(x, y);

beginShape must be called prior
Adding a vertex to a custom shape

Arguments

xThe x position
yThe y position


endShape();

beginShape must be called prior
Close the custom shape


\ No newline at end of file +lu5 | 2D Shapes

2D Shapes

v0.1.6
circle(x, y, d);

Draw a circle to the opengl context

Arguments

xThe x position of the circle
yThe y position of the circle
dThe diameter of the circle


rect(x, y, w, h);

Draw a rectangle to the opengl context

Arguments

xThe x position of the reactangle
yThe y position of the reactangle
wThe width
hThe height


square(x, y, s);

Draw a square to the opengl context

Arguments

xThe x position of the square
yThe y position of the square
sThe size of the square


line(x1, y1, x2, y2);

Draw a line to the opengl context

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point


quad(x1, y1, x2, y2, x3, y3, x4, y4);

Draw a quad on the screen

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point
x3The x position of the third point
y3The y position of the third point
x4The x position of the fourth point
y4The y position of the fourth point


point();

Draw a point on the screen


arc();

Draw an arc on the screen


ellipse();

Draw an ellipse on the screen


triangle();

Draw a triangle on the screen


beginShape(mode);

Begin adding vertices to a custom shape

Arguments

modeThe opengl shape mode LINES, POINTS, QUADS, TRIANGLES, TRIANGLE_FAN

The following would draw a 100 by 100 square at position 100, 100 +The following would draw a 100 by 100 square at position 100, 100

beginShape(QUADS);
+  vertex(100, 100);
+  vertex(100, 200);
+  vertex(200, 200);
+  vertex(200, 100);
+endShape();

vertex(x, y);

beginShape must be called prior
Adding a vertex to a custom shape

Arguments

xThe x position
yThe y position


endShape();

beginShape must be called prior
Close the custom shape


\ No newline at end of file diff --git a/docs/latest/shapes3D/index.html b/docs/latest/shapes3D/index.html new file mode 100644 index 00000000..dafa7c00 --- /dev/null +++ b/docs/latest/shapes3D/index.html @@ -0,0 +1 @@ +lu5 | 3D Shapes

3D Shapes

v0.1.6
plane(w, h);

Draw a plane

Arguments

wThe width dimension
hThe height dimension


box(w, [h], [d]);

Draw a 3D box

Arguments

wThe width dimension
[h]The height dimension
[d]The depth dimension


sphere(w, [detailX], [detailY]);

Draw a 3D Sphere

Arguments

wThe width dimension
[detailX]The detail in the X axis
[detailY]the detailt in the Y axis


debugMode();

Helpful 3D Graphics


\ No newline at end of file diff --git a/docs/latest/transform/index.html b/docs/latest/transform/index.html new file mode 100644 index 00000000..13f6e231 --- /dev/null +++ b/docs/latest/transform/index.html @@ -0,0 +1 @@ +lu5 | transform

transform

v0.1.6
rotateX(angle);

Rotate geometry around the X axis

Arguments

angleThe angle of rotation


rotateY(angle);

Rotate geometry around the Y axis

Arguments

angleThe angle of rotation


rotateZ(angle);

Rotate geometry around the Z axis

Arguments

angleThe angle of rotation


rotate(angle);

Rotate geometry in 2D

Arguments

angleThe angle of rotation


scale(x, y, [z]);

scale geometry
currently only used for 3D

Arguments

xThe x scaling
yThe y scaling
[z]The z scaling


translate(x, y, [z]);

translate geometry
currently only used for 3D

Arguments

xThe x translation
yThe y translation
[z]The z translation


\ No newline at end of file diff --git a/docs/latest/typography/index.html b/docs/latest/typography/index.html index 33db2537..0c71ecad 100644 --- a/docs/latest/typography/index.html +++ b/docs/latest/typography/index.html @@ -1,13 +1,13 @@ -lu5 | typography

typography

v0.0.6
loadFont(path);

Load a font

Arguments

pathThe font path on the local system

Returns

fontThe image reference

 function setup()
-   createWindow(600, 600);
-   font = loadFont('/path/to/myfont.ttf');
- end
+lu5 | typography

typography

v0.1.6
loadFont(path);

Load a font

Arguments

pathThe font path on the local system

Returns

fontThe image reference

function setup()
+  createWindow(600, 600);
+  font = loadFont('/path/to/myfont.ttf');
+end
 
- function draw()
-   background(51);
+function draw()
+  background(51);
 
-   textFont(font);
-   text('Hello from lu5!', 30, 50);
- end   

textSize(size);

Set the font size

Arguments

sizeThe size of the font in pixels

If this is called using fonts, make sure to call textSize after calling textFont

 textSize(56);
- text('Big Text', 50, 50);

textFont(font);

Set the font family

Arguments

fontThe font value returned when using loadFont

 textFont(myfont);
- text('Hello world!', 100, 200);

text(str, x, y);

Draw text on the screen

Arguments

strString to render
xThe x position of the start of the text
yThe y position of the top of the text

Fonts are not yet implemented

 text('Hello lu5!', 40, 60);

\ No newline at end of file + textFont(font); + text('Hello from lu5!', 30, 50); +end

textSize(size);

Set the font size

Arguments

sizeThe size of the font in pixels

If this is called using fonts, make sure to call textSize after calling textFont

textSize(56);
+text('Big Text', 50, 50);

textFont(font);

Set the font family

Arguments

fontThe font value returned when using loadFont

textFont(myfont);
+text('Hello world!', 100, 200);

text(str, x, y);

Draw text on the screen

Arguments

strString to render
xThe x position of the start of the text
yThe y position of the top of the text

Fonts are not yet implemented

text('Hello lu5!', 40, 60);

\ No newline at end of file diff --git a/docs/latest/vector/index.html b/docs/latest/vector/index.html index 71f1afe9..f3e36be8 100644 --- a/docs/latest/vector/index.html +++ b/docs/latest/vector/index.html @@ -1,23 +1,80 @@ -lu5 | vector

vector

v0.0.6
createVector(x, y);

Create a vector instance

Arguments

xThe first component of the vector
yThe second component of the vector

Returns

VectorThe created vector

 local a = createVector(3, 5);
- local b = createVector(1, 3);
- 
- local c = a:add(b);
- 
- print(c);

Vector.print();

Since a Vector implements a print method, it can be used in the print function

 local a = createVector(3, 5);
- 
- -- With print
- print(a);
-
- -- With class method
- Vector.print(a);
-
- -- with instance
- a:print();

Vector.mult(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe added vector

 local a = createVector(3, 5);
- local b = createVector(1, 3);
- 
- print(a:mult(b));
- print(Vector.mult(a, b));

Vector.add(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe multiplied vector

 local a = createVector(1, 4);
- local b = createVector(8, 2);
- 
- print(a:add(b));
- print(Vector.add(a, b));

\ No newline at end of file +lu5 | vector

vector

v0.1.6
createVector(x, y);

Create a vector instance

Arguments

xThe first component of the vector
yThe second component of the vector

Returns

VectorThe created vector

local point = createVector(80, 125);
+
+print(point);

Vector.print();

Since a Vector implements a print method, it can be used in the print function

local a = createVector(3, 5);
+
+-- With print
+print(a);
+
+-- With class method
+Vector.print(a);
+
+-- with instance
+a:print();

Vector.dist(a, b);

No description

Arguments

aThe first point
bThe second point

Returns

numberThe distance between the two points

local a = createVector(300, 500);
+local b = createVector(200, 250);
+
+local distance = a:dist(b);
+print(distance);

Vector.dot(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

numberThe dot product

local a = createVector(3, 5);
+local b = createVector(1, 3);
+
+-- From prototype
+print(a:dot(b)); -- 18.0
+
+-- With static method
+print(Vector.dot(a, b)); -- 18.0
+
+-- With concat syntax
+print(a .. b); -- 18.0

Vector.add(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe added vector

local a = createVector(4, 2);
+local b = createVector(2, 1);
+
+-- Non-mutable
+print(Vector.add(a, b)); -- { 6.0, 3.0 }
+print(a + b);            -- { 6.0, 3.0 }
+print(a);                -- { 4.0, 2.0 }
+
+-- Mutable
+print(a:add(b));	-- { 6.0, 3.0 }
+print(a) 		-- { 6.0, 3.0 }

Vector.sub(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe subtracted vector

local a = createVector(3, 5);
+local b = createVector(2, 3);
+
+-- Non-mutable
+print(Vector.sub(a, b)); -- { 1.0, 2.0 }
+print(a - b);            -- { 1.0, 2.0 }
+print(a);                -- { 3.0, 5.0 }
+
+-- Mutable
+print(a:sub(b)); -- { 1.0, 2.0 }
+print(a);        -- { 1.0, 2.0 }

Vector.mult(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe multiplied vector

local a = createVector(3, 5);
+local b = createVector(2, 3);
+
+-- Non-mutable
+print(Vector.mult(a, b)); -- { 6.0, 15.0 }
+print(a * b);             -- { 6.0, 15.0 }
+print(a);                 -- { 3.0, 5.0 }
+
+-- Mutable
+print(a:mult(b)); -- { 3.0, 15.0 }
+print(a);         -- { 3.0, 15.0 }

Vector.div(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe divided vector

local a = createVector(4, 2);
+local b = createVector(2, 1);
+
+-- Non-mutable
+print(Vector.div(a, b)); -- { 2.0, 2.0 }
+print(a / b);            -- { 2.0, 2.0 }
+print(a);                -- { 4.0, 2.0 }
+
+-- Mutable
+print(a:div(b));	-- { 2.0, 2.0 }
+print(a) 		-- { 2.0, 2.0 }

Vector.idiv(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe divided vector

local a = createVector(7, 8);
+local b = createVector(2, 3);
+
+-- Non-mutable
+print(Vector.idiv(a, b)) -- { 3.0, 2.0 }
+print(a // b);           -- { 3.0, 2.0 }
+print(a);                -- { 7.0, 8.0 }
+
+-- Mutable
+print(a:idiv(b)); -- { 3.0, 2.0 }
+print(a)          -- { 3.0, 2.0 }

Vector.copy();

No description

Returns

VectorThe divided vector

local a = createVector(300, 450, 400);
+
+local copy_1 = a:copy();
+
+local copy_2 = Vector.copy(a);

\ No newline at end of file diff --git a/docs/latest/window/index.html b/docs/latest/window/index.html index 2a9febeb..558f7168 100644 --- a/docs/latest/window/index.html +++ b/docs/latest/window/index.html @@ -1,52 +1,52 @@ -lu5 | window

window

v0.0.6
createWindow(w, h);

Create a GLFW window.

Arguments

wWindow width
hWindow height

It is also possible to create a window in the global scope without defining a setup function.

 function setup()
-   -- Create the window here
-   createWindow(600, 600);
- end
-
- function draw()
-   -- draw things
- end

frameRate(fps);

Set the frame rate

Arguments

fpsThe frame rate to set

If frame rate is called without an argument, it will return frame per seconds

 x = 0;
-
- function setup()
-   createWindow(400, 400);
-   frameRate(24);
- end
-
- function draw()
-   background(51);
-   text('fps: ' .. frameRate(), 20, 10);
-
-   circle(x, 200, 32);
-   x = x + 1;
- end

deltaTimeGlobal

Elapsed time since the last draw call in seconds

 x = 0;
- vx = 128;
-
- function setup()
-   createWindow(400, 400);
-   frameRate(24); -- try with 60
- end
-
- function draw()
-   background(51);
-
-   circle(x, height/2, 32);
-
-   -- Get the same velocity with different framerates
-   x = x + vx deltaTime;
- end

widthGlobal

The window's width in pixels. If no window was created, this value is nil

 createWindow(800, 600);
-
- print(width);
- -- 800

heightGlobal

The window's height in pixels. If no window was created, this value is nil

 createWindow(800, 600);
-
- print(height);
- -- 600

windowResized();Event

Called when the window is resized

 function setup()
-     createWindow(500, 500);
- end
- 
- function draw()
-     background(51)
- end
- 
- function windowResized()
-     print('Resized!')
- end

\ No newline at end of file +lu5 | window

window

v0.1.6
createWindow(w, h);

Create a GLFW window.

Arguments

wWindow width
hWindow height

It is also possible to create a window in the global scope without defining a setup function.

function setup()
+  -- Create the window here
+  createWindow(600, 600);
+end
+
+function draw()
+  -- draw things
+end

frameRate(fps);

Set the frame rate

Arguments

fpsThe frame rate to set

If frame rate is called without an argument, it will return frame per seconds

x = 0;
+
+function setup()
+  createWindow(400, 400);
+  frameRate(24);
+end
+
+function draw()
+  background(51);
+  text('fps: ' .. frameRate(), 20, 10);
+
+  circle(x, 200, 32);
+  x = x + 1;
+end

deltaTimeGlobal

Elapsed time since the last draw call in seconds

x = 0;
+vx = 128;
+
+function setup()
+  createWindow(400, 400);
+  frameRate(24); -- try with 60
+end
+
+function draw()
+  background(51);
+
+  circle(x, height/2, 32);
+
+  -- Get the same velocity with different framerates
+  x = x + vx * deltaTime;
+end

widthGlobal

The window's width in pixels. If no window was created, this value is nil

createWindow(800, 600);
+
+print(width);
+-- 800

heightGlobal

The window's height in pixels. If no window was created, this value is nil

createWindow(800, 600);
+
+print(height);
+-- 600

windowResized();Event

Called when the window is resized

function setup()
+    createWindow(500, 500);
+end
+
+function draw()
+    background(51)
+end
+
+function windowResized()
+    print('Resized!')
+end

\ No newline at end of file diff --git a/docs/v0.1.6/camera/index.html b/docs/v0.1.6/camera/index.html new file mode 100644 index 00000000..ac772b46 --- /dev/null +++ b/docs/v0.1.6/camera/index.html @@ -0,0 +1,16 @@ +lu5 | camera

camera

v0.1.6
orbitControl();

Helpful utility for controlling the camera around the origin.
Enables quick camera controls without much of an implementation.

function setup()
+    createWindow(800, 800, GL3D);
+end
+
+function draw() 
+    background(51);
+
+    -- Allows us to control the camera
+    orbitControl();
+
+    noFill();
+    stroke(80, 255, 50);
+    strokeWeight(4);
+
+    box(60);
+end

\ No newline at end of file diff --git a/docs/v0.1.6/classes/index.html b/docs/v0.1.6/classes/index.html new file mode 100644 index 00000000..d92b1ca8 --- /dev/null +++ b/docs/v0.1.6/classes/index.html @@ -0,0 +1,27 @@ +lu5 | classes

classes

v0.1.6
class(name);

Create a class.
if a class implements a print method, it can be used in the print function

Arguments

nameThe class name

local Player = class('Player');
+
+function Player:init(x, y)
+  self.x = x;
+  self.y = y;
+  return self;
+end
+
+function Player:draw()
+  circle(self.x, self.y, 16);
+end
+
+
+-- Create 2 players and draw them
+local p1 = Player:new(100, 200);
+local p2 = Player:new(300, 200);
+
+function setup()
+  createWindow(400, 400);
+end
+
+function draw()
+  background(51);
+
+  p1:draw();
+  p2:draw();
+end

\ No newline at end of file diff --git a/docs/v0.1.6/image/index.html b/docs/v0.1.6/image/index.html new file mode 100644 index 00000000..7cdcea37 --- /dev/null +++ b/docs/v0.1.6/image/index.html @@ -0,0 +1,10 @@ +lu5 | image

image

v0.1.6
loadImage(path);

Load a png or jpeg image

Arguments

pathThe local image path

Returns

ImageThe image instance

function setup()
+  createWindow(600, 600);
+  img = loadImage('/path/to/mypic.png');
+end
+
+function draw()
+  background(51);
+
+  image(img, 0, 0);
+end   

image(img, x, y, [w], [h]);

Draw an image to the screen

Arguments

imgThe Image instance
xThe x position of the image
yThe y position of the image
[w]The width of the image, if not specified, using source width
[h]The height of the image, if not specified, using source height


Image.crop(x, y, w, h);

Crop an Image into an other Image

Arguments

xThe x position of the image
yThe y position of the image
wThe width of the new cropped image
hThe height of the new cropped image

Returns

Imagethe cropped image


\ No newline at end of file diff --git a/docs/v0.1.6/index.html b/docs/v0.1.6/index.html new file mode 100644 index 00000000..3af33325 --- /dev/null +++ b/docs/v0.1.6/index.html @@ -0,0 +1 @@ +lu5 | Reference

Reference

v0.1.6
\ No newline at end of file diff --git a/docs/v0.1.6/io/index.html b/docs/v0.1.6/io/index.html new file mode 100644 index 00000000..788dc60f --- /dev/null +++ b/docs/v0.1.6/io/index.html @@ -0,0 +1,9 @@ +lu5 | io

io

v0.1.6
print(value);

Printing utility, can take any lua type.

Arguments

valueThe value to print to stdout

print(42);
+
+print(1, 2, 3);
+
+print('Hello world');
+
+print({ 3, 8, 1 });

loadText(file_path);

Read a file as a string

Arguments

file_pathThe path of the file

file = loadText("./your-file.txt");
+print(file)

loadStrings(file_path);

Read a file as an array of strings split by line

Arguments

file_pathThe path of the file

file = loadStrings("./your-file.txt");
+print(file)

\ No newline at end of file diff --git a/docs/v0.1.6/keyboard/index.html b/docs/v0.1.6/keyboard/index.html new file mode 100644 index 00000000..5a2271c0 --- /dev/null +++ b/docs/v0.1.6/keyboard/index.html @@ -0,0 +1,19 @@ +lu5 | keyboard

keyboard

v0.1.6
keyIsDown(k);

Check if a keyboard key is pressed, returns true if key is down and returns false if it's not

Arguments

kThe keyboard key to check as a key global, or a string

Returns

booleanWhether or not the key is down

-- Use a string 
+if (keyIsDown('a')) then
+  -- key 'a' is down
+end
+
+-- use a global
+if (keyIsDown(LEFT_ARROW)) then
+  -- left arrow is down
+end

keyPressed(key, keyCode);Event

Called whenever a key is pressed.

Arguments

keyThe pressed key as a string, is nil if glfw cannot find a name for the key
keyCodeThe pressed key as a key code

function setup()
+   createWindow(600, 600);
+end
+
+function draw()
+   background(51);
+end
+
+function keyPressed(key, keyCode)
+   print(key, keyCode)
+end

keyReleased(key, keyCode);Event

Called whenever a key is released.

Arguments

keyThe released key as a string, is nil if glfw cannot find a name for the key
keyCodeThe released key as a key code


keyHeld(key, keyCode);Event

Called whenever a key is held down.

Arguments

keyThe held key as a string, is nil if glfw cannot find a name for the key
keyCodeThe held key as a key code


UP_ARROWConstant

No description


DOWN_ARROWConstant

No description


LEFT_ARROWConstant

No description


RIGHT_ARROWConstant

No description


KEY_ENTERConstant

No description


KEY_BACKSPACEConstant

No description


KEY_AConstant

No description


KEY_BConstant

No description


KEY_CConstant

No description


KEY_DConstant

No description


KEY_EConstant

No description


KEY_FConstant

No description


KEY_GConstant

No description


KEY_HConstant

No description


KEY_IConstant

No description


KEY_JConstant

No description


KEY_KConstant

No description


KEY_LConstant

No description


KEY_MConstant

No description


KEY_NConstant

No description


KEY_OConstant

No description


KEY_PConstant

No description


KEY_QConstant

No description


KEY_RConstant

No description


KEY_SConstant

No description


KEY_TConstant

No description


KEY_UConstant

No description


KEY_VConstant

No description


KEY_WConstant

No description


KEY_XConstant

No description


KEY_YConstant

No description


KEY_ZConstant

No description


\ No newline at end of file diff --git a/docs/v0.1.6/math/index.html b/docs/v0.1.6/math/index.html new file mode 100644 index 00000000..a1b98b1d --- /dev/null +++ b/docs/v0.1.6/math/index.html @@ -0,0 +1,13 @@ +lu5 | math

math

v0.1.6
randomSeed(seed);

Set a random seed

Arguments

seedThe seed value

Returns

numberThe random value


random(min, max);

Get a random number

Arguments

minThe minimum of the range
maxThe maximum of the range

Returns

numberThe random value

random()      -- random number between 0 and 1
+random(3)     -- random number between 0 and 3
+random(3, 12) -- random number between 3 and 12
+
+random({ 'A', 'B', 'C' }) -- random element in table

round(x);

Round a number to the nearest integer

Arguments

xThe value to round

Returns

intThe rounded value


floor(x);

floor is a function that takes in a number, and returns the greatest integer less or equal to x
see here

Arguments

xThe value to floor

Returns

intgreatest integer less than or equals to x


ceil(x);

ceil is a function that takes in a number, and returns the smallest integer greater or equal to x
see here

Arguments

xThe value to floor

Returns

intThe floored value


min(a, b);

Return the smallest value.
Can also take any number of arguments, or a table.

Arguments

aThe first value
bThe second value

Returns

numberThe smallest value

min(6, 7); -- returns 6
+
+min(6, 7, 4); -- returns 4
+
+min({ 6, 7, 4 }); -- returns 4

max(a, b);

Return the largest value.
Can also take any number of arguments, or a table.

Arguments

aThe first value
bThe second value

Returns

numberThe largest value

max(2, 5); -- returns 5
+
+max(2, 5, 7); -- returns 7
+
+max({ 2, 5, 7 }); -- returns 7

abs(x);

Returns the absolute value of x
see here

Arguments

xThe input value

Returns

numberThe absolote value of the input


map(x, s1, e1, s2, e2);

Maps x from an original range to a target range

Arguments

xThe value to map
s1The start of the initial range
e1The end of the initial range
s2The start of the target range
e2The end of the target range

Returns

numberThe mapped value


dist(x1, y1, x2, y1);

Calculates the distance between 2 points in 2D space

Arguments

x1The x coordinate of the first point
y1The y coordinate of the first point
x2The x coordinate of the second point
y1The y coordinate of the second point

Returns

numberThe distance between the points


constrain(x, min, max);

Limits x to a minimum and maximum value

Arguments

xThe input value
minThe minimum value
maxThe maximum value

Returns

numberThe constrained value


sin(x);

Sine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


cos(x);

Cosine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


tan(x);

Tangent function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


PIConstant

No description


TWO_PIConstant

No description


HALF_PIConstant

No description


QUARTER_PIConstant

No description


\ No newline at end of file diff --git a/docs/v0.1.6/models/index.html b/docs/v0.1.6/models/index.html new file mode 100644 index 00000000..8f3658e5 --- /dev/null +++ b/docs/v0.1.6/models/index.html @@ -0,0 +1 @@ +lu5 | models

models

v0.1.6
model(model);

Draw a 3D model

Arguments

modelThe 3D model


loadModel(model);

Load a 3D model

Arguments

modelThe 3D model


\ No newline at end of file diff --git a/docs/v0.1.6/mouse/index.html b/docs/v0.1.6/mouse/index.html new file mode 100644 index 00000000..a6645364 --- /dev/null +++ b/docs/v0.1.6/mouse/index.html @@ -0,0 +1,66 @@ +lu5 | mouse

mouse

v0.1.6
mouseYGlobal

The y mouse coordinate

createWindow(400, 400);
+
+function draw()
+  background(51);
+  
+  line(0, mouseY, width, mouseY);
+end

mouseXGlobal

The x mouse coordinate

createWindow(400, 400);
+
+function draw()
+  background(51);
+  
+  line(mouseX, 0, mouseX, height);
+end

pmouseYGlobal

No description


pmouseXGlobal

No description


mouseIsPressedGlobal

Is true when the mouse is pressed, is false when it's not


mousePressed(button);Event

Called when a mouse button is pressed.

Arguments

buttonThe pressed mouse button


+In the following example, the circle's size increases when the user clicks the mouse.

size = 0;
+
+function setup()
+  createWindow(400, 400);
+end
+
+function draw()
+  background(51);
+
+  circle(mouseX, mouseY, size);
+end
+
+-- Increase circle size when mouse pressed
+function mousePressed()
+  size = size + 1;
+end

mouseReleased(button);Event

Called when a mouse button is released.

Arguments

buttonThe released mouse button


+In the following example, the circle's size increases when the user clicks the mouse.

size = 32;
+
+function setup()
+  createWindow(400, 400);
+end
+
+function draw()
+  background(51);
+
+  circle(mouseX, mouseY, size);
+end
+
+-- Set larger circle size
+function mousePressed()
+  size = 64;
+end
+
+-- Reset size
+function mouseReleased()
+  size = size + 6;
+end

mouseWheel(button);Event

Called when a mouse wheel is used

Arguments

buttonThe pressed mouse button


+In the following example, the circle's size changes when the user scrolls

size = 0;
+
+function setup()
+  createWindow(400, 400);
+end
+
+function draw()
+  background(51);
+
+  circle(mouseX, mouseY, size);
+end
+
+-- Change circle size when mouse is scrolled
+function mouseWheel(delta)
+  size = size + delta;
+end

\ No newline at end of file diff --git a/docs/v0.1.6/setting/index.html b/docs/v0.1.6/setting/index.html new file mode 100644 index 00000000..6ebe4b61 --- /dev/null +++ b/docs/v0.1.6/setting/index.html @@ -0,0 +1,3 @@ +lu5 | setting

setting

v0.1.6
background(r, g, b, a);

Clear a background with a color

Arguments

rThe red byte
gThe green byte
bThe blue byte
aThe alpha byte


fill(r, g, b, [a]);

Set the fill color for shapes

Arguments

rThe red byte
gThe green byte
bThe blue byte
[a]The alpha byte

Can also accept a hexadecimal or color name as string

fill(255, 150, 40);
+square(200, 200, 64);

strokeWeight(weight);

No description

Arguments

weightThe line width in pixels

trokeWeight(8);
+ine(200, 200, mouseX, mouseY);

noFill();

Disable fill


stroke(r, g, b, a);

Set the stroke color for shapes

Arguments

rThe red byte
gThe green byte
bThe blue byte
aThe alpha byte

Only implemented for line and circle


noStroke();

Disable stroke
Only implemented for line and circle


push();

Save the style settings


pop();

Restore the style settings


\ No newline at end of file diff --git a/docs/v0.1.6/shapes/index.html b/docs/v0.1.6/shapes/index.html new file mode 100644 index 00000000..2a5a0bb1 --- /dev/null +++ b/docs/v0.1.6/shapes/index.html @@ -0,0 +1,7 @@ +lu5 | 2D Shapes

2D Shapes

v0.1.6
circle(x, y, d);

Draw a circle to the opengl context

Arguments

xThe x position of the circle
yThe y position of the circle
dThe diameter of the circle


rect(x, y, w, h);

Draw a rectangle to the opengl context

Arguments

xThe x position of the reactangle
yThe y position of the reactangle
wThe width
hThe height


square(x, y, s);

Draw a square to the opengl context

Arguments

xThe x position of the square
yThe y position of the square
sThe size of the square


line(x1, y1, x2, y2);

Draw a line to the opengl context

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point


quad(x1, y1, x2, y2, x3, y3, x4, y4);

Draw a quad on the screen

Arguments

x1The x position of the first point
y1The y position of the first point
x2The x position of the second point
y2The y position of the second point
x3The x position of the third point
y3The y position of the third point
x4The x position of the fourth point
y4The y position of the fourth point


point();

Draw a point on the screen


arc();

Draw an arc on the screen


ellipse();

Draw an ellipse on the screen


triangle();

Draw a triangle on the screen


beginShape(mode);

Begin adding vertices to a custom shape

Arguments

modeThe opengl shape mode LINES, POINTS, QUADS, TRIANGLES, TRIANGLE_FAN

The following would draw a 100 by 100 square at position 100, 100 +The following would draw a 100 by 100 square at position 100, 100

beginShape(QUADS);
+  vertex(100, 100);
+  vertex(100, 200);
+  vertex(200, 200);
+  vertex(200, 100);
+endShape();

vertex(x, y);

beginShape must be called prior
Adding a vertex to a custom shape

Arguments

xThe x position
yThe y position


endShape();

beginShape must be called prior
Close the custom shape


\ No newline at end of file diff --git a/docs/v0.1.6/shapes3D/index.html b/docs/v0.1.6/shapes3D/index.html new file mode 100644 index 00000000..dafa7c00 --- /dev/null +++ b/docs/v0.1.6/shapes3D/index.html @@ -0,0 +1 @@ +lu5 | 3D Shapes

3D Shapes

v0.1.6
plane(w, h);

Draw a plane

Arguments

wThe width dimension
hThe height dimension


box(w, [h], [d]);

Draw a 3D box

Arguments

wThe width dimension
[h]The height dimension
[d]The depth dimension


sphere(w, [detailX], [detailY]);

Draw a 3D Sphere

Arguments

wThe width dimension
[detailX]The detail in the X axis
[detailY]the detailt in the Y axis


debugMode();

Helpful 3D Graphics


\ No newline at end of file diff --git a/docs/v0.1.6/transform/index.html b/docs/v0.1.6/transform/index.html new file mode 100644 index 00000000..13f6e231 --- /dev/null +++ b/docs/v0.1.6/transform/index.html @@ -0,0 +1 @@ +lu5 | transform

transform

v0.1.6
rotateX(angle);

Rotate geometry around the X axis

Arguments

angleThe angle of rotation


rotateY(angle);

Rotate geometry around the Y axis

Arguments

angleThe angle of rotation


rotateZ(angle);

Rotate geometry around the Z axis

Arguments

angleThe angle of rotation


rotate(angle);

Rotate geometry in 2D

Arguments

angleThe angle of rotation


scale(x, y, [z]);

scale geometry
currently only used for 3D

Arguments

xThe x scaling
yThe y scaling
[z]The z scaling


translate(x, y, [z]);

translate geometry
currently only used for 3D

Arguments

xThe x translation
yThe y translation
[z]The z translation


\ No newline at end of file diff --git a/docs/v0.1.6/typography/index.html b/docs/v0.1.6/typography/index.html new file mode 100644 index 00000000..0c71ecad --- /dev/null +++ b/docs/v0.1.6/typography/index.html @@ -0,0 +1,13 @@ +lu5 | typography

typography

v0.1.6
loadFont(path);

Load a font

Arguments

pathThe font path on the local system

Returns

fontThe image reference

function setup()
+  createWindow(600, 600);
+  font = loadFont('/path/to/myfont.ttf');
+end
+
+function draw()
+  background(51);
+
+  textFont(font);
+  text('Hello from lu5!', 30, 50);
+end   

textSize(size);

Set the font size

Arguments

sizeThe size of the font in pixels

If this is called using fonts, make sure to call textSize after calling textFont

textSize(56);
+text('Big Text', 50, 50);

textFont(font);

Set the font family

Arguments

fontThe font value returned when using loadFont

textFont(myfont);
+text('Hello world!', 100, 200);

text(str, x, y);

Draw text on the screen

Arguments

strString to render
xThe x position of the start of the text
yThe y position of the top of the text

Fonts are not yet implemented

text('Hello lu5!', 40, 60);

\ No newline at end of file diff --git a/docs/v0.1.6/vector/index.html b/docs/v0.1.6/vector/index.html new file mode 100644 index 00000000..f3e36be8 --- /dev/null +++ b/docs/v0.1.6/vector/index.html @@ -0,0 +1,80 @@ +lu5 | vector

vector

v0.1.6
createVector(x, y);

Create a vector instance

Arguments

xThe first component of the vector
yThe second component of the vector

Returns

VectorThe created vector

local point = createVector(80, 125);
+
+print(point);

Vector.print();

Since a Vector implements a print method, it can be used in the print function

local a = createVector(3, 5);
+
+-- With print
+print(a);
+
+-- With class method
+Vector.print(a);
+
+-- with instance
+a:print();

Vector.dist(a, b);

No description

Arguments

aThe first point
bThe second point

Returns

numberThe distance between the two points

local a = createVector(300, 500);
+local b = createVector(200, 250);
+
+local distance = a:dist(b);
+print(distance);

Vector.dot(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

numberThe dot product

local a = createVector(3, 5);
+local b = createVector(1, 3);
+
+-- From prototype
+print(a:dot(b)); -- 18.0
+
+-- With static method
+print(Vector.dot(a, b)); -- 18.0
+
+-- With concat syntax
+print(a .. b); -- 18.0

Vector.add(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe added vector

local a = createVector(4, 2);
+local b = createVector(2, 1);
+
+-- Non-mutable
+print(Vector.add(a, b)); -- { 6.0, 3.0 }
+print(a + b);            -- { 6.0, 3.0 }
+print(a);                -- { 4.0, 2.0 }
+
+-- Mutable
+print(a:add(b));	-- { 6.0, 3.0 }
+print(a) 		-- { 6.0, 3.0 }

Vector.sub(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe subtracted vector

local a = createVector(3, 5);
+local b = createVector(2, 3);
+
+-- Non-mutable
+print(Vector.sub(a, b)); -- { 1.0, 2.0 }
+print(a - b);            -- { 1.0, 2.0 }
+print(a);                -- { 3.0, 5.0 }
+
+-- Mutable
+print(a:sub(b)); -- { 1.0, 2.0 }
+print(a);        -- { 1.0, 2.0 }

Vector.mult(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe multiplied vector

local a = createVector(3, 5);
+local b = createVector(2, 3);
+
+-- Non-mutable
+print(Vector.mult(a, b)); -- { 6.0, 15.0 }
+print(a * b);             -- { 6.0, 15.0 }
+print(a);                 -- { 3.0, 5.0 }
+
+-- Mutable
+print(a:mult(b)); -- { 3.0, 15.0 }
+print(a);         -- { 3.0, 15.0 }

Vector.div(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe divided vector

local a = createVector(4, 2);
+local b = createVector(2, 1);
+
+-- Non-mutable
+print(Vector.div(a, b)); -- { 2.0, 2.0 }
+print(a / b);            -- { 2.0, 2.0 }
+print(a);                -- { 4.0, 2.0 }
+
+-- Mutable
+print(a:div(b));	-- { 2.0, 2.0 }
+print(a) 		-- { 2.0, 2.0 }

Vector.idiv(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe divided vector

local a = createVector(7, 8);
+local b = createVector(2, 3);
+
+-- Non-mutable
+print(Vector.idiv(a, b)) -- { 3.0, 2.0 }
+print(a // b);           -- { 3.0, 2.0 }
+print(a);                -- { 7.0, 8.0 }
+
+-- Mutable
+print(a:idiv(b)); -- { 3.0, 2.0 }
+print(a)          -- { 3.0, 2.0 }

Vector.copy();

No description

Returns

VectorThe divided vector

local a = createVector(300, 450, 400);
+
+local copy_1 = a:copy();
+
+local copy_2 = Vector.copy(a);

\ No newline at end of file diff --git a/docs/v0.1.6/window/index.html b/docs/v0.1.6/window/index.html new file mode 100644 index 00000000..558f7168 --- /dev/null +++ b/docs/v0.1.6/window/index.html @@ -0,0 +1,52 @@ +lu5 | window

window

v0.1.6
createWindow(w, h);

Create a GLFW window.

Arguments

wWindow width
hWindow height

It is also possible to create a window in the global scope without defining a setup function.

function setup()
+  -- Create the window here
+  createWindow(600, 600);
+end
+
+function draw()
+  -- draw things
+end

frameRate(fps);

Set the frame rate

Arguments

fpsThe frame rate to set

If frame rate is called without an argument, it will return frame per seconds

x = 0;
+
+function setup()
+  createWindow(400, 400);
+  frameRate(24);
+end
+
+function draw()
+  background(51);
+  text('fps: ' .. frameRate(), 20, 10);
+
+  circle(x, 200, 32);
+  x = x + 1;
+end

deltaTimeGlobal

Elapsed time since the last draw call in seconds

x = 0;
+vx = 128;
+
+function setup()
+  createWindow(400, 400);
+  frameRate(24); -- try with 60
+end
+
+function draw()
+  background(51);
+
+  circle(x, height/2, 32);
+
+  -- Get the same velocity with different framerates
+  x = x + vx * deltaTime;
+end

widthGlobal

The window's width in pixels. If no window was created, this value is nil

createWindow(800, 600);
+
+print(width);
+-- 800

heightGlobal

The window's height in pixels. If no window was created, this value is nil

createWindow(800, 600);
+
+print(height);
+-- 600

windowResized();Event

Called when the window is resized

function setup()
+    createWindow(500, 500);
+end
+
+function draw()
+    background(51)
+end
+
+function windowResized()
+    print('Resized!')
+end

\ No newline at end of file