Jump to content

start.lua doesn't use fw?


Rick
 Share

Recommended Posts

Looks like the example start.lua file isn't using the fw variable? Since we can just use the fw variable when running scripts in the editor I would think start.lua should have that same setup for the example.

 

Does anyone have the snippet of code to setup start.lua to be the same as when ran from editor? Not sure if anyone has ran into any other gotcha's when switching from editor to engine.

Link to comment
Share on other sites

Yeah. Just to get an example of the setup that needs to be done in Lua so that it's setup the same as when ran from the editor which does this (and other maybe?) setup for you. Come to think of it shouldn't Engine.exe set the framework up? That would seem the best way I guess so that we could xfer our editor lua game script right over to run in Engine.exe without changes. When I just tried that it complained about fw.

 

I don't even know if Engine.exe is going to not have this Lua issue I'm having but just wanted to try it before making my own exe because if I don't have to then great!

Link to comment
Share on other sites

the standalone script creates the graphics context whereas the in-game script is already using the one from the editor and the framework has already been created in the editor... and i personally do not want engine.exe to create these things for me as i do not always use framework... its just like using a c++ or bmax program where you have to create your own graphics context and framework...

 

as for the standalone spinning cube example that uses framework:

require("Scripts/constants/keycodes") 
RegisterAbstractPath("") 
Graphics(1024,768)

fw=CreateFramework() 
fw.main.camera:SetPosition(Vec3(0,0,-2))

light=CreateSpotLight(10) 
light:SetRotation(Vec3(45,55,0)) 
light:SetPosition(Vec3(5,5,-5)) 

material=LoadMaterial("abstract::cobblestones.mat") 
mesh=CreateCube() 
mesh:Paint(material) 

ground=CreateCube() 
ground:SetScale(Vec3(10,1,10)) 
ground:SetPosition(Vec3(0,-2,0)) 
ground:Paint(material) 

light=CreateDirectionalLight() 
light:SetRotation(Vec3(45,45,45)) 

while AppTerminate()==0 do 
if KeyHit(KEY_ESCAPE)==1 then
	break
end 
mesh:Turn(Vec3(AppSpeed()*0.5,AppSpeed()*0.5,AppSpeed()*0.5)) 
fw:Update()
fw:Render()
Flip(0)
end

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Thanks. I guess it would just be nice not have to change my game script at all from editor to engine. I could modify my editor one to check for fw and if not there make it I guess, but would be nice in my mind to not have to worry about that. At least it's easy :) Thanks again.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...