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
@color_step = 10
@base_color = Gosu::Color.rgb(255, 127, 0)
@background_alpha = 200
window.needs_cursor = true
super(*args)
end
@@ -40,14 +41,14 @@ class IMICFPS
0, @slope+(i*@size),
window.width/2, (-@slope)+(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(
window.width, i*@size,
window.width, @slope+(i*@size),
window.width/2, (-@slope)+(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

View File

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

View File

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

BIN
static/cursors/pointer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB