diff --git a/docs/assets/style.css b/docs/assets/style.css index 0b9f249f..62454570 100644 --- a/docs/assets/style.css +++ b/docs/assets/style.css @@ -1 +1 @@ -:root{--dark:#461164;--primary:#AA36EF;--lighter:#d49af7;--white:#efefef}::-webkit-scrollbar{width:10px}::-webkit-scrollbar-track{background:rgba(0,0,0,0)}::-webkit-scrollbar-thumb{background:var(--primary)}::-webkit-scrollbar-thumb:hover{background:var(--dark)}code.inline{border-radius:4px;background-color:#dfd4ff;padding:0.1em}html,body{width:100%;height:100%;margin:0px;background-color:var(--white)}body{display:flex;flex-direction:row;justify-content:flex-start;min-height:100%;height:fit-content}a,p,span.text,h1,h2,h3,h4,h5,h6{font-family:"Trebuchet MS",Tahoma,sans-serif}ul{list-style-type:none;margin:0px;padding:0px}li:not(:last-child){padding-bottom:12px}.method{padding-top:2rem}.btn{padding-left:0.5rem}.light{color:var(--white)}.btn.light > a > h4{color:var(--white)}.btn:hover > a > h4,.btn:active > a > h4{color:var(--dark);transition:0.1s}code,pre{font-family:inconsolata,lucida console,monospace}header{width:100%;display:flex;flex-direction:row;align-items:baseline;gap:0.9rem;flex-wrap:wrap}.modules{display:flex;flex-wrap:wrap;width:76%;gap:3.5rem}a{text-decoration:none}a:visited{text-decoration:none}.version{color:var(--dark);position:relative;top:-0.25em;left:-0.25em}main{padding:1.8em;height:fit-content;width:100%;display:flex;flex-direction:column;gap:0rem}.summary{min-width:8em}h1.module{position:relative;top:-0.25em;color:var(--primary);font-weight:bold;font-size:26pt}pre code.hljs{padding:1em;max-width:100%;font-size:10pt}.modules{margin-right:auto;margin-left:auto}.modules.open{margin-right:10.2rem;margin-left:2em}@media (min-width:900px){.modules{margin-right:auto;margin-left:auto}.modules.open{margin-right:auto;margin-left:auto}main > .method{padding-left:10%}h1.module{font-size:32pt}pre code.hljs{padding:1em 6em 1em 1em;max-width:38em;width:fit-content;font-size:13pt}}.param{display:flex;gap:1rem;margin:0.2rem;vertical-align:middle;align-items:flex-start}.method{max-width:87.5%}.method > code{font-size:16pt}.menuBtn{position:fixed;top:45dvh;right:-3.5em;width:7em;border-radius:49%;height:7em;border:none;outline:none;background-color:var(--primary)}.menuBtn > img{position:relative;left:-1.5em}.nav{background-color:var(--primary);position:fixed;min-width:10em;min-height:100%;position:fixed;padding:1.6rem;display:flex;flex-direction:column;right:calc(-100%);z-index:10}.nav.open{right:0px} \ No newline at end of file +:root{--dark:#461164;--primary:#AA36EF;--lighter:#d49af7;--white:#efefef}::-webkit-scrollbar{width:10px}::-webkit-scrollbar-track{background:rgba(0,0,0,0)}::-webkit-scrollbar-thumb{background:var(--primary)}::-webkit-scrollbar-thumb:hover{background:var(--dark)}code.inline{border-radius:4px;background-color:#dfd4ff;padding:0.1em}html,body{width:100%;height:100%;margin:0px;background-color:var(--white)}body{display:flex;flex-direction:row;justify-content:flex-start;min-height:100%;height:fit-content}a,p,span.text,span.decorator,h1,h2,h3,h4,h5,h6{font-family:"Trebuchet MS",Tahoma,sans-serif}.decorator{font-size:18pt;border-radius:6px;color:var(--white);font-weight:bold;background-color:var(--primary);margin:0 2.5rem;padding:0.2em 0.4em}ul{list-style-type:none;margin:0px;padding:0px}li:not(:last-child){padding-bottom:12px}.method{padding-top:2rem}.btn{padding-left:0.5rem}.light{color:var(--white)}.btn.light > a > h4{color:var(--white)}.btn:hover > a > h4,.btn:active > a > h4{color:var(--dark);transition:0.1s}code,pre{font-family:inconsolata,lucida console,monospace}header{width:100%;display:flex;flex-direction:row;align-items:baseline;gap:0.9rem;flex-wrap:wrap}.modules{display:flex;flex-wrap:wrap;width:76%;gap:3.5rem}a{text-decoration:none}a:visited{text-decoration:none}.version{color:var(--dark);position:relative;top:-0.25em;left:-0.25em}main{padding:1.8em;height:fit-content;width:100%;display:flex;flex-direction:column;gap:0rem}.summary{min-width:8em}h1.module{position:relative;top:-0.25em;color:var(--primary);font-weight:bold;font-size:26pt}pre code.hljs{padding:1em;max-width:100%;font-size:10pt}.modules{margin-right:auto;margin-left:auto}.modules.open{margin-right:10.2rem;margin-left:2em}@media (min-width:900px){.modules{margin-right:auto;margin-left:auto}.modules.open{margin-right:auto;margin-left:auto}main > .method{padding-left:10%}h1.module{font-size:32pt}pre code.hljs{padding:1em 6em 1em 1em;max-width:38em;width:fit-content;font-size:13pt}}.param{display:flex;gap:1rem;margin:0.2rem;vertical-align:middle;align-items:flex-start}.method{max-width:87.5%}.method > div > code{font-size:16pt}.menuBtn{position:fixed;top:45dvh;right:-3.5em;width:7em;border-radius:49%;height:7em;border:none;outline:none;background-color:var(--primary)}.menuBtn > img{position:relative;left:-1.5em}.nav{background-color:var(--primary);position:fixed;min-width:10em;min-height:100%;position:fixed;padding:1.6rem;display:flex;flex-direction:column;right:calc(-100%);z-index:10}.nav.open{right:0px} \ No newline at end of file diff --git a/docs/events.html b/docs/events.html index ba04a930..1670c22c 100644 --- a/docs/events.html +++ b/docs/events.html @@ -32,8 +32,55 @@

events

-
isKeyDown(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 +
isKeyDown(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

Returns

booleanWhether or not the key is down


+
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

+
keyPressed(key);Event

Called whenever a key is pressed.

Arguments

keyThe pressed key +


+
keyReleased(key);Event

Called whenever a key is released.

Arguments

keyThe released key +


+
keyHeld(key);Event

Called whenever a key is held down.

Arguments

keyThe held key +


diff --git a/docs/index.html b/docs/index.html index 1d327001..99ee25b0 100644 --- a/docs/index.html +++ b/docs/index.html @@ -31,7 +31,7 @@

Reference

v0.0.3 - + diff --git a/docs/io.html b/docs/io.html index 7f49b58e..3a5388bd 100644 --- a/docs/io.html +++ b/docs/io.html @@ -32,7 +32,7 @@

io

-
print(value);

Printing utility, can take any lua type (except objects).

Arguments

valueThe value to print to stdout +
print(value);

Printing utility, can take any lua type (except objects).

Arguments

valueThe value to print to stdout


diff --git a/docs/loaders.html b/docs/loaders.html index 819634aa..3735bf33 100644 --- a/docs/loaders.html +++ b/docs/loaders.html @@ -32,7 +32,7 @@

loaders

-
loadFont(path);

Load a font face

Arguments

pathThe font path on the local system +
loadFont(path);

Load a font face

Arguments

pathThe font path on the local system

 function setup()
    createWindow(600, 600);
    myfont = loadFont('/path/to/myfont.ttf');
diff --git a/docs/math.html b/docs/math.html
index fbe16ea6..aa42130b 100644
--- a/docs/math.html
+++ b/docs/math.html
@@ -32,19 +32,19 @@ 

math

-
round(x);

Round a number to the nearest integer

Arguments

xThe value to round +
round(x);

Round a number to the nearest integer

Arguments

xThe value to round

Returns

intThe rounded value


-
floor(x);

see here +

floor(x);

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

Arguments

xThe value to floor

Returns

intgreatest integer less than or equals to x


-
ceil(x);

see here +

ceil(x);

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

Arguments

xThe value to floor

Returns

intThe floored value


-
sin(x);

Sine function (Trigonometry)

Arguments

xThe input value +
sin(x);

Sine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


-
cos(x);

Cosine function (Trigonometry)

Arguments

xThe input value +
cos(x);

Cosine function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


-
tan(x);

Tangent function (Trigonometry)

Arguments

xThe input value +
tan(x);

Tangent function (Trigonometry)

Arguments

xThe input value

Returns

numberThe output value


diff --git a/docs/setting.html b/docs/setting.html index 612abbc0..fd2dcff7 100644 --- a/docs/setting.html +++ b/docs/setting.html @@ -32,26 +32,26 @@

setting

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

Set the fill color for shapes

Arguments

rThe red 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);

Arguments

weightThe line width in pixels +
strokeWeight(weight);

Arguments

weightThe line width in pixels

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

-
noFill();

Disable fill

Arguments


-
stroke(r, g, b, a);

Set the stroke color for shapes

Arguments

rThe red byte +
noFill();

Disable fill

Arguments


+
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();

Only implemented for line and circle +

noStroke();

Only implemented for line and circle Disable stroke

Arguments


-
textSize(size);

Set the font size

Arguments

sizeThe size of the font in pixels +
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


-
textFont(font);

Set the font family

Arguments

fontThe font value returned when using loadFont +
textFont(font);

Set the font family

Arguments

fontThe font value returned when using loadFont

 function setup()
    createWindow(600, 600);
 
diff --git a/docs/shapes.html b/docs/shapes.html
index a14eafa0..6cd3f717 100644
--- a/docs/shapes.html
+++ b/docs/shapes.html
@@ -32,25 +32,25 @@ 

shapes

-
circle(x, y, d);

Draw a circle to the opengl context

Arguments

xThe x position of the circle's center +
circle(x, y, d);

Draw a circle to the opengl context

Arguments

xThe x position of the circle's center
yThe y position of the circle's center
dThe diameter of the circle


-
rect(x, y, w, h);

Draw a rectangle to the opengl context

Arguments

xThe x position of the reactangle's top left corner +
rect(x, y, w, h);

Draw a rectangle to the opengl context

Arguments

xThe x position of the reactangle's top left corner
yThe y position of the reactangle's top left corner
wThe width
hThe height


-
square(x, y, s);

Draw a square to the opengl context

Arguments

xThe x position of the square's top left corner +
square(x, y, s);

Draw a square to the opengl context

Arguments

xThe x position of the square's top left corner
yThe y position of the square's top left corner
sThe size of the square's sides


-
line(x1, y1, x2, y2);

Draw a line to the opengl context

Arguments

x1The x position of the first point +
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 +
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 @@ -59,16 +59,16 @@

shapes

x4The x position of the fourth point
y4The y position of the fourth point


-
text(str, x, y);

Draw text on the screen

Arguments

strString to render +
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

 fill(150, 50, 255);
  text('Hello lu5!', 40, 60);

-
point();

Draw a point on the screen

Arguments


-
arc();

Draw an arc on the screen

Arguments


-
ellipse();

+

point();

Draw a point on the screen

Arguments


+
arc();

Draw an arc on the screen

Arguments


+
ellipse();

Draw an ellipse on the screen

Arguments


-
triangle();

Draw a triangle on the screen

Arguments


+
triangle();

Draw a triangle on the screen

Arguments


diff --git a/docs/window.html b/docs/window.html index 3df884d9..a5b21a29 100644 --- a/docs/window.html +++ b/docs/window.html @@ -32,9 +32,9 @@

window

-
createWindow(w, h);

Create a GLFW window

Arguments

wWindow width +
createWindow(w, h);

Create a GLFW window.

Arguments

wWindow width
hWindow height -

 function setup()
+

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
@@ -42,7 +42,7 @@ 

window

function draw() -- draw things end

-
background(r, g, b, a);

Clear a background with a color

Arguments

rThe red byte +
background(r, g, b, a);

Clear a background with a color

Arguments

rThe red byte
gThe green byte
bThe blue byte
aThe alpha byte diff --git a/src/bindings/window.h b/src/bindings/window.h index 6586224f..65708468 100644 --- a/src/bindings/window.h +++ b/src/bindings/window.h @@ -4,11 +4,13 @@ #include /** - * Create a GLFW window + * Create a GLFW window. * * @param w Window width * @param h Window height * + * It is also possible to create a window in the global scope without defining a setup function. + * * @example * function setup() * -- Create the window here