lovr.exe
and put it in the same folder that you have your project folder in.main.lua
in your project folder.lovr_graphics_engine
from the repo into your project folder.main.lua
or any other script.main.lua
script includes LGE and has the default LOVR functions.-- Include
local LGE = require "lovr_graphics_engine.include"
-- Primary Functions
function lovr.load()
-- This is called once on load.
-- You can use it to load assets and set everything up.
end
function lovr.update(dt)
-- This is called continuously and is passed the "delta time" as dt, which
-- is the number of seconds elapsed since the last update.
-- You can use it to simulate physics or update game logic.
end
function lovr.draw(pass)
-- This is called once every frame.
-- You can call functions on the pass to render graphics.
end
lovr.load()
function, you can create a new Scene.-- Reference Variables
local myScene
function lovr.load()
-- Create a new Scene object
myScene = LGE.Scene()
end
root
must be set to it. The root
is the primary Node object of the Scene! All other Node objects added should be descendants of the root Node.-- Reference Variables
local myScene
function lovr.load()
-- Create a new Scene object
myScene = LGE.Scene()
-- Create the root Node of the scene. root.name is an optional parameter available across all nodes.
myScene.root = LGE.Node()
myScene.root.name = "RootNode"
end
lovr.load()
function. All of these special Node objects are extensions of regular Nodes, meaning they have the same properties that Node objects do. They also have their own functions and properties.parent
. When thinking of children and parents in programming, think of a file inside a folder. The file is the child of the folder, and folder is the parent. Node objects function in a similar manner, where an Object can be a child of a parent Object.-- Reference Variables
local myScene
local myModel
local myLight
function lovr.load()
-- Create a new Scene object
myScene = LGE.Scene()
-- Create the root Node of the scene. root.name is an optional parameter available across all nodes.
-- Root nodes do not have parents.
myScene.root = LGE.Node()
myScene.root.name = "RootNode"
-- Create a new Model that is a child of the root node.
-- All Node objects that aren't root nodes should have a parent.
myModel = LGE.Model({parent = myScene.root})
-- Create a new point light that is a child of myModel.
-- Check the link above for Light objects to learn more about types!
myLight = LGE.Light({type = "pointLight"})
end
-- The new update function:
function lovr.update(dt)
-- Make sure any changes that are made to the Scene and it's Nodes are updated every frame!
myScene:update(dt)
end
myScene
can be rendered to the screen in the lovr.draw()
function.-- The new draw function:
function lovr.draw(pass)
-- Draw all visual Node Objects (Lights, Models, Particles) to the screen!
return myScene:drawFull(pass)
end
main.lua
.-- Reference Variables
local myScene
local myModel
local myLight
function lovr.load()
-- Create a new Scene object
myScene = LGE.Scene()
-- Create the root Node of the scene. root.name is an optional parameter available across all nodes.
-- Root nodes do not have parents.
myScene.root = LGE.Node()
myScene.root.name = "RootNode"
-- Create a new Model that is a child of the root node.
-- All Node objects that aren't root nodes should have a parent.
myModel = LGE.Model({parent = myScene.root})
-- Create a new point light that is a child of myModel.
-- Check the link above for Light objects to learn more about types!
myLight = LGE.Light({type = "pointLight"})
end
function lovr.update(dt)
-- Make sure any changes that are made to the Scene and it's Nodes are updated every frame!
myScene:update(dt)
end
function lovr.draw(pass)
-- Draw all visual Node Objects (Lights, Models, Particles) to the screen!
return myScene:drawFull(pass)
end
lovr.exe
file!print()
functions, open the command prompt, and enter cd "directory_to_lovr"
directory_to_lovr
should be the directory to your nightly builds installation.lovr --console "directory_to_your_project"
.directory_to_yout_project
should be the directory to where your main.lua
file is, or inside your project folder.print()
messages and errors as well.