minor API changes
This commit is contained in:
parent
2c34f362d4
commit
f543cd21f4
|
@ -7,7 +7,6 @@ local exclusiveAudioSample = nil
|
|||
---@field path string
|
||||
---@field exclusive boolean
|
||||
---@field loop boolean
|
||||
---@field playing boolean
|
||||
local AudioSample = {
|
||||
__name = "AudioSample"
|
||||
}
|
||||
|
@ -26,24 +25,22 @@ function AudioSample.new(params)
|
|||
end
|
||||
|
||||
function AudioSample:play()
|
||||
if not self.playing then
|
||||
if not game.IsSamplePlaying(self.path) then
|
||||
if self.exclusive then
|
||||
if exclusiveAudioSample and self ~= exclusiveAudioSample then
|
||||
exclusiveAudioSample:stop()
|
||||
end
|
||||
exclusiveAudioSample = self
|
||||
end
|
||||
self.playing = true
|
||||
game.PlaySample(self.path)
|
||||
end
|
||||
end
|
||||
|
||||
function AudioSample:stop()
|
||||
if self.playing then
|
||||
if game.IsSamplePlaying(self.path) then
|
||||
if self.exclusive and self == exclusiveAudioSample then
|
||||
exclusiveAudioSample = nil
|
||||
end
|
||||
self.playing = false
|
||||
game.StopSample(self.path)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,8 +33,10 @@ local Image = { };
|
|||
|
||||
---Image constructor
|
||||
---@param imagePath string # The path to the skin image to load
|
||||
---@param noFallback? boolean # If loading fails it displays a missing image asset instead, default false
|
||||
---@return Image
|
||||
function Image.new(imagePath, noFallback)
|
||||
noFallback = noFallback or false
|
||||
local handle = gfx.CreateSkinImage(imagePath or '', 0);
|
||||
if (not handle) then
|
||||
game.Log('Failed to load image "' .. imagePath .. '"', game.LOGGER_ERROR);
|
||||
|
@ -119,13 +121,9 @@ function Image:render(params)
|
|||
local b = 255;
|
||||
|
||||
if (params.color) then
|
||||
r = params.color[1];
|
||||
g = params.color[2];
|
||||
b = params.color[3];
|
||||
r, g, b = table.unpack(params.color)
|
||||
elseif (self.color) then
|
||||
r = self.color[1];
|
||||
g = self.color[2];
|
||||
b = self.color[3];
|
||||
r, g, b = table.unpack(self.color)
|
||||
end
|
||||
|
||||
local a = params.alpha or self.alpha or 1;
|
||||
|
|
|
@ -59,9 +59,12 @@ function Page:handleKnobInput(knob, delta) end
|
|||
---@param button integer
|
||||
function Page:handleMouseInput(x, y, button) end
|
||||
|
||||
---Event callback on page initialization
|
||||
function Page:onInit() end
|
||||
|
||||
function Page:onInvalidation() end
|
||||
---Event callback on page invalidation
|
||||
---@param reason? any # reason for the invalidation
|
||||
function Page:onInvalidation(reason) end
|
||||
|
||||
---@param deltaTime number # frametime in seconds
|
||||
function Page:drawBackground(deltaTime) end
|
||||
|
|
Loading…
Reference in New Issue