Added a proper cursor, game pause menu now has a transparent background (Game is drawn behind menu)

This commit is contained in:
2020-01-28 23:17:25 -06:00
parent 46cffa293e
commit c1b5e72d7d
4 changed files with 13 additions and 10 deletions

View File

@@ -6,6 +6,7 @@ class IMICFPS
@slope = 250 @slope = 250
@color_step = 10 @color_step = 10
@base_color = Gosu::Color.rgb(255, 127, 0) @base_color = Gosu::Color.rgb(255, 127, 0)
@background_alpha = 200
window.needs_cursor = true window.needs_cursor = true
super(*args) super(*args)
end end
@@ -40,14 +41,14 @@ class IMICFPS
0, @slope+(i*@size), 0, @slope+(i*@size),
window.width/2, (-@slope)+(i*@size), window.width/2, (-@slope)+(i*@size),
window.width/2, i*@size, window.width/2, i*@size,
Gosu::Color.rgba(@base_color.red-i*@color_step, @base_color.green-i*@color_step, @base_color.blue-i*@color_step, 200) Gosu::Color.rgba(@base_color.red-i*@color_step, @base_color.green-i*@color_step, @base_color.blue-i*@color_step, @background_alpha)
) )
fill_quad( fill_quad(
window.width, i*@size, window.width, i*@size,
window.width, @slope+(i*@size), window.width, @slope+(i*@size),
window.width/2, (-@slope)+(i*@size), window.width/2, (-@slope)+(i*@size),
window.width/2, i*@size, window.width/2, i*@size,
Gosu::Color.rgba(@base_color.red-i*@color_step, @base_color.green-i*@color_step, @base_color.blue-i*@color_step, 200) Gosu::Color.rgba(@base_color.red-i*@color_step, @base_color.green-i*@color_step, @base_color.blue-i*@color_step, @background_alpha)
) )
end end

View File

@@ -1,6 +1,7 @@
class IMICFPS class IMICFPS
class GamePauseMenu < Menu class GamePauseMenu < Menu
def setup def setup
@background_alpha = 50
title "I-MIC FPS" title "I-MIC FPS"
subtitle "Paused" subtitle "Paused"
@@ -8,6 +9,10 @@ class IMICFPS
pop_state pop_state
end end
link "Settings" do
push_state(SettingsMenu)
end
link "Disconnect" do link "Disconnect" do
push_state(MainMenu) push_state(MainMenu)
end end
@@ -20,4 +25,4 @@ class IMICFPS
super super
end end
end end
end end

View File

@@ -13,6 +13,7 @@ class IMICFPS
end end
$window = self $window = self
@needs_cursor = false @needs_cursor = false
@cursor = Gosu::Image.new(IMICFPS::GAME_ROOT_PATH + "/static/cursors/pointer.png")
@number_of_vertices = 0 @number_of_vertices = 0
self.caption = "#{IMICFPS::NAME} v#{IMICFPS::VERSION} (#{IMICFPS::RELEASE_NAME})" self.caption = "#{IMICFPS::NAME} v#{IMICFPS::VERSION} (#{IMICFPS::RELEASE_NAME})"
@@ -37,14 +38,10 @@ class IMICFPS
end end
def draw_cursor def draw_cursor
size = 16
if needs_cursor if needs_cursor
draw_quad( @cursor.draw(mouse_x, mouse_y, Float::INFINITY)
mouse_x, mouse_y, Gosu::Color::WHITE,
mouse_x+16, mouse_y, Gosu::Color::WHITE,
mouse_x, mouse_y+16, Gosu::Color::WHITE,
mouse_x, mouse_y+16, Gosu::Color::WHITE,
Float::INFINITY
)
end end
end end

BIN
static/cursors/pointer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB