diff options
| author | chai <chaifix@163.com> | 2018-09-02 00:48:21 +0800 | 
|---|---|---|
| committer | chai <chaifix@163.com> | 2018-09-02 00:48:21 +0800 | 
| commit | 862763a88f6b4a6cb6c034287c509a91776adf8b (patch) | |
| tree | 78c1f391c1c5ed95acfda055e3bf806290df74d8 /src/lua/modules/embed/boot.lua.h | |
| parent | b05e2443533af8e3badb4a8469a634cb302c63f8 (diff) | |
*update
Diffstat (limited to 'src/lua/modules/embed/boot.lua.h')
| -rw-r--r-- | src/lua/modules/embed/boot.lua.h | 42 | 
1 files changed, 17 insertions, 25 deletions
| diff --git a/src/lua/modules/embed/boot.lua.h b/src/lua/modules/embed/boot.lua.h index 4f8ed94..cc71102 100644 --- a/src/lua/modules/embed/boot.lua.h +++ b/src/lua/modules/embed/boot.lua.h @@ -37,16 +37,6 @@ local function call(func, ...)      end  end -jin.core.setHandler = function(handler) -	if handler == nil then  -		return  -	end  -	jin.core.onLoad = handler.onLoad -	jin.core.onEvent = handler.onEvent -	jin.core.onUpdate = handler.onUpdate -	jin.core.onDraw = handler.onDraw -end  -  function jin.core.run()      call(jin.core.onLoad)      local dt = 0 @@ -64,21 +54,12 @@ function jin.core.run()          end  		previous = current          current = jin.time.second()  -        dt = dt + current - previous -		local refresh = false -		while dt > SECOND_PER_FRAME do  -	        call(jin.core.onUpdate, SECOND_PER_FRAME) -			dt = dt - SECOND_PER_FRAME -			refresh = true -		end  -		if refresh and jin.graphics then  -			jin.graphics.clear()  -			call(jin.core.onDraw) -			jin.graphics.present() -		end  -		if jin.time then  -			jin.time.sleep(0.001) -		end +        dt = current - previous +	    call(jin.core.onUpdate, dt) +        call(jin.graphics.clear)		 +		call(jin.core.onDraw) +        call(jin.graphics.present) +        call(jin.time.sleep, 0.001)      end  end @@ -86,6 +67,16 @@ end  -- No game handler  ------------------------------------------------------------------------- +jin.core.setHandler = function(handler) +	if handler == nil then  +		return  +	end  +	jin.core.onLoad = handler.onLoad +	jin.core.onEvent = handler.onEvent +	jin.core.onUpdate = handler.onUpdate +	jin.core.onDraw = handler.onDraw +end  +  jin.nogame = {      cs = 64,       sw = jin.graphics.getWidth(),  @@ -108,6 +99,7 @@ jin.nogame = {          end      end,      onUpdate = function(dt) +        print(dt)          local nogame = jin.nogame          nogame.t = nogame.t + dt * nogame.speed           if nogame.t > nogame.ww2 then  | 
