- added music/sfc subsystem\n- added basic audio\n- added music/sound test screen\n- added some basic vscode tasks
This commit is contained in:
16
inc/system/system.audio.lua
Normal file
16
inc/system/system.audio.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
-- Audio subsystem
|
||||
|
||||
function Audio.music_stop() music() end
|
||||
function Audio.music_play_mainmenu() end
|
||||
function Audio.music_play_wakingup() end
|
||||
function Audio.music_play_room_morning() end
|
||||
function Audio.music_play_room_street_1() end
|
||||
function Audio.music_play_room_street_2() end
|
||||
function Audio.music_play_room_() end
|
||||
function Audio.music_play_room_work() end
|
||||
|
||||
function Audio.sfx_select() sfx(17, 'C-7', 30) end
|
||||
function Audio.sfx_deselect() sfx(18, 'C-7', 30) end
|
||||
function Audio.sfx_beep() sfx(19, 'C-6', 30) end
|
||||
function Audio.sfx_success() sfx(16, 'C-7', 60) end
|
||||
function Audio.sfx_bloop() sfx(21, 'C-3', 60) end
|
||||
@@ -16,8 +16,8 @@ local INPUT_KEY_ENTER = 50
|
||||
|
||||
function Input.up() return btnp(INPUT_KEY_UP) end
|
||||
function Input.down() return btnp(INPUT_KEY_DOWN) end
|
||||
function Input.left() return btn(INPUT_KEY_LEFT) end
|
||||
function Input.right() return btn(INPUT_KEY_RIGHT) end
|
||||
function Input.left() return btnp(INPUT_KEY_LEFT) end
|
||||
function Input.right() return btnp(INPUT_KEY_RIGHT) end
|
||||
function Input.select() return btnp(INPUT_KEY_A) or keyp(INPUT_KEY_SPACE) end
|
||||
function Input.menu_confirm() return btnp(INPUT_KEY_A) or keyp(INPUT_KEY_ENTER) end
|
||||
function Input.player_interact() return btnp(INPUT_KEY_B) or keyp(INPUT_KEY_ENTER) end -- B button
|
||||
|
||||
@@ -24,6 +24,10 @@ local STATE_HANDLERS = {
|
||||
ConfigurationWindow.update()
|
||||
ConfigurationWindow.draw()
|
||||
end,
|
||||
[WINDOW_AUDIOTEST] = function()
|
||||
AudioTestWindow.update()
|
||||
AudioTestWindow.draw()
|
||||
end,
|
||||
}
|
||||
|
||||
local initialized_game = false
|
||||
|
||||
@@ -5,4 +5,4 @@ function Print.text(text, x, y, color, fixed, scale)
|
||||
scale = scale or 1
|
||||
print(text, x + 1, y + 1, shadow_color, fixed, scale)
|
||||
print(text, x, y, color, fixed, scale)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,11 +19,13 @@ end
|
||||
|
||||
function UI.update_menu(items, selected_item)
|
||||
if Input.up() then
|
||||
Audio.sfx_beep()
|
||||
selected_item = selected_item - 1
|
||||
if selected_item < 1 then
|
||||
selected_item = #items
|
||||
end
|
||||
elseif Input.down() then
|
||||
Audio.sfx_beep()
|
||||
selected_item = selected_item + 1
|
||||
if selected_item > #items then
|
||||
selected_item = 1
|
||||
|
||||
5
inc/system/system.util.lua
Normal file
5
inc/system/system.util.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
Util = {}
|
||||
|
||||
function Util.safeindex(array, index)
|
||||
return ((index - 1 + #array) % #array) + 1
|
||||
end
|
||||
Reference in New Issue
Block a user