Josh Posted July 27, 2012 Share Posted July 27, 2012 Use the "lua" forum tag for Lua syntax highlighting: --[[------------------------------------------------------------ This is a block of comments You can have multiple lines of comments Pretty neat, huh? ------------------------------------------------------------]]-- --This function will be called once when the program starts function App:Start() --Set the application title self.title="Darkness Awaits" --Create settings table and add defaults self.settings={} self.settings.vsync=true --Load the user's settings self:LoadSettings() --Create a window self.window=Window:Create(self.title,0,0,1024,768,Window.Titlebar) --Create the graphics context self.context=Context:Create(self.window,0) if self.context==nil then return false end --Create a world self.world=World:Create() --Create a camera self.camera = Camera:Create() self.camera:SetPosition(0,5,-10) --Load a test scene Scene:Load("Scenes\\trash.scene") return true end --This is our main program loop and will be called continuously until the program ends function App:Continue() --If window has been closed, end the program if self.window:Closed() then return false end --If escape key has been pressed, end the program if self.window:KeyHit(KeyCode.Escape) then return false end --Update the world self.world:Update() --Render the world self.world:Render() --Refresh the screen self.context:Swap(self.settings.vsync) --Returning true tells the main program to keep looping return true end function App:Pause() --Pause time updating Time:Pause() end function App:Resume() --Resume time updating Time:Resume() end function App:Finish() --Save user settings to a file self:SaveSettings() end --Load user settings from a file (not yet implemented) function App:LoadSettings() return true end --Save user settings to a file (not yet implemented) function App:SaveSettings() return true end 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted August 9, 2012 Author Share Posted August 9, 2012 This is what the code block does: --This function will be called once when the program starts function App:Start() --Set the application title self.title="Darkness Awaits" --Create settings table and add defaults self.settings={} self.settings.vsync=true --Load the user's settings self:LoadSettings() --Create a window self.window=Window:Create(self.title,0,0,1024,768,Window.Titlebar) --Create the graphics context self.context=Context:Create(self.window,0) if self.context==nil then return false end --Create a world self.world=World:Create() --Create a camera self.camera = Camera:Create() self.camera:SetPosition(0,5,-10) --Load a test scene Scene:Load("Scenes\\trash.scene") return true end Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
shadmar Posted August 9, 2012 Share Posted August 9, 2012 +1 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.