Re: A Little Help

new topic     » goto parent     » topic index » view thread      » older message » newer message

Looks like your end while is in the wrong place. (And the C example looks wrong...)

Icy_Viking said...
--Example 
include std/machine.e 
include std/get.e 
 
include NGD.ew 
 
atom key 
 
position(1,1) 
puts(1,"Press ESC to close\n") 
 
atom ver = NewtonWorldGetVersion() --this works 
public atom world 
atom timeStep = 1.0 / 60 
 
position(2,1) 
printf(1,"Newton Game Dynamics Version: %d",{ver}) --this works 
 
procedure Init() 
 
    world = NewtonCreate() 
	 
end procedure 
 
Init() -- only need to call once (?) 
 
while 1 do 
 
	key = get_key() 
	 
	if key = 27 then 
		exit 
	end if 
 
-- not sure if this should be inside or outside while loop 
-- you might want to refactor so you don't have a for loop inside your while 
 
-- you need a timeDelta or something else depending on the frame rate 
 
 for i = 0 to 60 do 
 	NewtonUpdate(world,timeStep) 
 end for 
 
end while -- should go here? 
  
 NewtonDestroyAllBodies(world) 
 NewtonDestroy(world) 
 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu