Added dependance on cyberarm_engine, removed duplicate code which is in cyberarm_engine

This commit is contained in:
2019-08-07 12:00:39 -05:00
parent 1b6f8cf880
commit 12a588304b
12 changed files with 23 additions and 581 deletions

View File

@@ -1,36 +1,16 @@
class IMICFPS
class GameState
class GameState < CyberarmEngine::GameState
include CommonMethods
include EntityManager
include LightManager
attr_reader :options
def initialize(options = {})
@options = options
@delta_time = Gosu.milliseconds
@entities = []
@lights = []
setup
end
def push_game_state(klass_or_instance)
window.push_game_state(klass_or_instance)
end
def setup
end
def draw
end
def update
end
def button_down(id)
end
def button_up(id)
super
end
end
end

View File

@@ -16,7 +16,7 @@ class IMICFPS
add_asset(:model, "base", "biped")
# Currently broken
# Shader.new(name: "lighting", vertex_file: "shaders/vertex/lighting.glsl", fragment_file: "shaders/fragment/lighting.glsl")
Shader.new(name: "lighting", vertex: "shaders/vertex/lighting.glsl", fragment: "shaders/fragment/lighting.glsl")
@act = false
@cycled = false
@@ -59,7 +59,7 @@ class IMICFPS
unless @asset_index < @assets.count
if @act && Gosu.milliseconds-@completed_for_ms > 250
push_game_state(@options[:forward])
push_state(@options[:forward])
else
@act = true
@completed_for_ms = Gosu.milliseconds unless @lock

View File

@@ -92,11 +92,8 @@ class IMICFPS
end
def mouse_over?(object)
if mouse_x.between?(object.x, object.x+object.width)
if mouse_y.between?(object.y, object.y+object.height)
true
end
end
mouse_x.between?(object.x, object.x+object.width) &&
mouse_y.between?(object.y, object.y+object.height)
end
class Link
@@ -105,14 +102,17 @@ class IMICFPS
@text, @host, @block = text, host, block
@color = @text.color
@hover_color = Gosu::Color.rgb(64, 127, 255)
@text.shadow_alpha = 100
end
def update
if @host.mouse_over?(self)
@text.color = @hover_color
@text.shadow_size = 2
@text.shadow_color= Gosu::Color::BLACK
@text.shadow_size = 3
else
@text.color = @color
@text.shadow_color = nil
@text.shadow_size = 1
end
end

View File

@@ -3,7 +3,7 @@ class IMICFPS
def setup
title "I-MIC FPS"
link "Single Player" do
push_game_state(LoadingState.new(forward: Game))
push_state(LoadingState.new(forward: Game))
end
link "Settings" do
# push_game_state(SettingsMenu)