LOVR-OOP-Graphics-Engine

Version 0.2.2

Object Classes

Getting Started (WIP)

Creating Your First Project

-- 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
-- Reference Variables
local myScene

function lovr.load()
    -- Create a new Scene object
    myScene = LGE.Scene()
end
-- 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
-- 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
-- The new draw function:
function lovr.draw(pass)
    -- Draw all visual Node Objects (Lights, Models, Particles) to the screen!
    return myScene:drawFull(pass)
end
-- 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

Executing your Project