improve script hot reload
This commit is contained in:
parent
01d6e09a91
commit
15041984f1
25 changed files with 1516 additions and 293 deletions
|
|
@ -14,7 +14,7 @@ local transition = require("pxl8.transition")
|
|||
local anim = require("pxl8.anim")
|
||||
local sfx = require("pxl8.sfx")
|
||||
|
||||
core.init(_pxl8_gfx, _pxl8_input, _pxl8_sfx_mixer, _pxl8_sys)
|
||||
core.init(_pxl8_gfx, _pxl8_input, _pxl8_rng, _pxl8_sfx_mixer, _pxl8_sys)
|
||||
|
||||
local pxl8 = {}
|
||||
|
||||
|
|
@ -29,6 +29,11 @@ pxl8.debug = core.debug
|
|||
pxl8.trace = core.trace
|
||||
pxl8.quit = core.quit
|
||||
|
||||
pxl8.rng_seed = core.rng_seed
|
||||
pxl8.rng_next = core.rng_next
|
||||
pxl8.rng_f32 = core.rng_f32
|
||||
pxl8.rng_range = core.rng_range
|
||||
|
||||
pxl8.clear = gfx2d.clear
|
||||
pxl8.pixel = gfx2d.pixel
|
||||
pxl8.line = gfx2d.line
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@ local C = ffi.C
|
|||
|
||||
local core = {}
|
||||
|
||||
function core.init(gfx, input, sfx_mixer, sys)
|
||||
function core.init(gfx, input, rng, sfx_mixer, sys)
|
||||
core.gfx = gfx
|
||||
core.input = input
|
||||
core.rng = rng
|
||||
core.sfx_mixer = sfx_mixer
|
||||
core.sys = sys
|
||||
end
|
||||
|
|
@ -72,4 +73,20 @@ function core.quit()
|
|||
C.pxl8_set_running(core.sys, false)
|
||||
end
|
||||
|
||||
function core.rng_seed(seed)
|
||||
C.pxl8_rng_seed(core.rng, seed)
|
||||
end
|
||||
|
||||
function core.rng_next()
|
||||
return C.pxl8_rng_next(core.rng)
|
||||
end
|
||||
|
||||
function core.rng_f32()
|
||||
return C.pxl8_rng_f32(core.rng)
|
||||
end
|
||||
|
||||
function core.rng_range(min, max)
|
||||
return C.pxl8_rng_range(core.rng, min, max)
|
||||
end
|
||||
|
||||
return core
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ local core = require("pxl8.core")
|
|||
local particles = {}
|
||||
|
||||
function particles.new(max_count)
|
||||
return C.pxl8_particles_create(max_count or 1000)
|
||||
return C.pxl8_particles_create(max_count or 1000, core.rng)
|
||||
end
|
||||
|
||||
function particles.destroy(ps)
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ function sfx.note_to_freq(note)
|
|||
return C.pxl8_sfx_note_to_freq(note)
|
||||
end
|
||||
|
||||
function sfx.play_note(ctx, note, params, volume)
|
||||
return C.pxl8_sfx_play_note(ctx, note, params, volume or 0.8)
|
||||
function sfx.play_note(ctx, note, params, volume, duration)
|
||||
return C.pxl8_sfx_play_note(ctx, note, params, volume or 0.8, duration or 0)
|
||||
end
|
||||
|
||||
function sfx.release_voice(ctx, voice_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue