mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-13 06:42:35 +00:00
Added title screen sound, added sound when mousing over menu links, update "required" Ruby version to 3.0+ in README
This commit is contained in:
@@ -10,7 +10,7 @@ Creating a multiplayer first-person-shooter in pure Ruby; Using C extensions onl
|
|||||||

|

|
||||||
|
|
||||||
## Using
|
## Using
|
||||||
Ruby 2.5+ interpeter with support for the Gosu game library C extension.
|
Ruby 3.0+ interpeter with support for the Gosu game library C extension.
|
||||||
* Clone or download this repo
|
* Clone or download this repo
|
||||||
* `bundle install`
|
* `bundle install`
|
||||||
* `bundle exec ruby i-mic-fps.rb [options]`
|
* `bundle exec ruby i-mic-fps.rb [options]`
|
||||||
|
|||||||
13
lib/ext/element.rb
Normal file
13
lib/ext/element.rb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
module CyberarmEngine
|
||||||
|
class Element
|
||||||
|
alias enter_original enter
|
||||||
|
|
||||||
|
def enter(_sender)
|
||||||
|
if @block && is_a?(CyberarmEngine::Element::Link)
|
||||||
|
get_sample("#{IMICFPS::GAME_ROOT_PATH}/static/sounds/ui_hover.ogg").play
|
||||||
|
end
|
||||||
|
|
||||||
|
enter_original(_sender)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -19,7 +19,7 @@ class IMICFPS
|
|||||||
end
|
end
|
||||||
|
|
||||||
def calculate_volume
|
def calculate_volume
|
||||||
volume = (SoundManager.sfx_volume - @initial_volume) * ratio
|
(SoundManager.sfx_volume - @initial_volume) * ratio
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ class IMICFPS
|
|||||||
@title = Text.new(IMICFPS::NAME, size: 100, z: 0, color: Gosu::Color.new(0xff000000), border: false, font: IMICFPS::BOLD_SANS_FONT)
|
@title = Text.new(IMICFPS::NAME, size: 100, z: 0, color: Gosu::Color.new(0xff000000), border: false, font: IMICFPS::BOLD_SANS_FONT)
|
||||||
@logo = get_image("#{IMICFPS::GAME_ROOT_PATH}/static/logo.png")
|
@logo = get_image("#{IMICFPS::GAME_ROOT_PATH}/static/logo.png")
|
||||||
|
|
||||||
|
@title_screen_sound = get_sample("#{IMICFPS::GAME_ROOT_PATH}/static/sounds/title_screen.ogg")
|
||||||
|
|
||||||
@start_time = Gosu.milliseconds
|
@start_time = Gosu.milliseconds
|
||||||
@time_to_live = 5_000
|
@time_to_live = 5_000
|
||||||
|
|
||||||
@@ -43,6 +45,8 @@ class IMICFPS
|
|||||||
|
|
||||||
# SoundManager.sound_effect(SoundEffect::FadeIn, sound: SoundManager.sound("base", :shield_regen), duration: 3_000.0)
|
# SoundManager.sound_effect(SoundEffect::FadeIn, sound: SoundManager.sound("base", :shield_regen), duration: 3_000.0)
|
||||||
window.needs_cursor = false
|
window.needs_cursor = false
|
||||||
|
|
||||||
|
@title_screen_sound_channel = @title_screen_sound.play(1.0)
|
||||||
end
|
end
|
||||||
|
|
||||||
def draw
|
def draw
|
||||||
@@ -88,6 +92,7 @@ class IMICFPS
|
|||||||
def button_down(id)
|
def button_down(id)
|
||||||
super
|
super
|
||||||
|
|
||||||
|
@title_screen_sound_channel.stop
|
||||||
push_state(MainMenu)
|
push_state(MainMenu)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
BIN
static/sounds/title_screen.ogg
Normal file
BIN
static/sounds/title_screen.ogg
Normal file
Binary file not shown.
BIN
static/sounds/ui_hover.ogg
Normal file
BIN
static/sounds/ui_hover.ogg
Normal file
Binary file not shown.
Reference in New Issue
Block a user