Added GAME_ROOT_PATH and ASSETS_PATH constants, make boot and closing use ASSETS_PATH, simplified Camera#mouse_pick and Camera#center

This commit is contained in:
2019-10-01 12:44:47 -05:00
parent a3a2e2a2ac
commit b945255849
6 changed files with 27 additions and 35 deletions

View File

@@ -4,7 +4,7 @@ class IMICRTS
@title = Gosu::Font.new(56, name: "Noto Sans Display", bold: true)
@text = Gosu::Font.new(18, name: "Noto Sans Thaana", bold: true)
@name = IMICRTS::NAME
@logo = Gosu::Image.new("assets/logo.png")
@logo = Gosu::Image.new("#{ASSETS_PATH}/logo.png")
@messages = ["Loading", "Compiling Protons", "Launching Warhead", "git push origin --force"]
@messages_index = 0
@@ -30,39 +30,35 @@ class IMICRTS
@background = Gosu::Color.new(0x007a0d71)
@background_two = Gosu::Color.new(0x007b6ead)
$window.width = Gosu.screen_width
$window.height = Gosu.screen_height
$window.fullscreen = true
end
def draw
Gosu.draw_quad(
0, 0, @background_two,
$window.width, 0, @background,
0, $window.height, @background,
$window.width, $window.height, @background_two
window.width, 0, @background,
0, window.height, @background,
window.width, window.height, @background_two
)
Gosu.draw_rect(
0, $window.height/2 - 35,
$window.width, 71,
0, window.height/2 - 35,
window.width, 71,
Gosu::Color.new(0xff949dad)
)
c = Gosu::Color.new(0xff55dae1)
c2 = Gosu::Color.new(0xff3c9ec5)
Gosu.draw_quad(
0, $window.height/2 - 30, c,
$window.width, $window.height/2 - 30, c2,
0, $window.height/2 + 30, c,
$window.width, $window.height/2 + 30, c2
0, window.height/2 - 30, c,
window.width, window.height/2 - 30, c2,
0, window.height/2 + 30, c,
window.width, window.height/2 + 30, c2
)
@logo.draw($window.width/2 - @logo.width/2, $window.height/2 - (@logo.height/3 + 14), 0)
@logo.draw(window.width/2 - @logo.width/2, window.height/2 - (@logo.height/3 + 14), 0)
@text.draw_text(@status, $window.width - (@text.text_width(@status.gsub(".", "")) + @text.text_width("...")), $window.height - @text.height, 0)
@text.draw_text(@status, window.width - (@text.text_width(@status.gsub(".", "")) + @text.text_width("...")), window.height - @text.height, 0)
end
def update

View File

@@ -1,7 +1,7 @@
class IMICRTS
class Closing < CyberarmEngine::GuiState
def setup
@logo = Gosu::Image.new("assets/logo.png")
@logo = Gosu::Image.new("#{ASSETS_PATH}/logo.png")
@color = Gosu::Color.new(0xffffffff)
@started_at = Gosu.milliseconds

View File

@@ -12,14 +12,14 @@ class IMICRTS
@h = button("Harvester", width: 1.0) do
@units << Entity.new(
images: Gosu::Image.new("assets/vehicles/harvester/images/harvester.png", retro: true),
images: Gosu::Image.new("#{ASSETS_PATH}/vehicles/harvester/images/harvester.png", retro: true),
position: CyberarmEngine::Vector.new(rand(window.width), rand(window.height), ZOrder::GROUND_VEHICLE),
angle: rand(360)
)
end
@c = button("Construction Worker", width: 1.0) do
@units << Entity.new(
images: Gosu::Image.new("assets/vehicles/construction_worker/images/construction_worker.png", retro: true),
images: Gosu::Image.new("#{ASSETS_PATH}/vehicles/construction_worker/images/construction_worker.png", retro: true),
position: CyberarmEngine::Vector.new(rand(window.width), rand(window.height), ZOrder::GROUND_VEHICLE),
angle: rand(360)
)