forum-msg-id-133915-edit

Original date:2019-05-29 20:31:53 Edited by: euphoric Subject: Re: A Little Help

Looks like your end while is in the wrong place.

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) 
 
Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu