mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-16 08:02:36 +00:00
Updated gems, fix issues caused by the removal of $window from cyberarm_engine
This commit is contained in:
@@ -7,7 +7,7 @@ class IMICFPS
|
||||
|
||||
module CommonMethods
|
||||
def window
|
||||
$window
|
||||
CyberarmEngine::Window.instance
|
||||
end
|
||||
|
||||
def delta_time
|
||||
|
||||
@@ -77,12 +77,12 @@ class IMICFPS
|
||||
when "up"
|
||||
input = InputMapper.get(data.last.to_sym)
|
||||
key = input.is_a?(Array) ? input.first : input
|
||||
$window.current_state.button_up(key) if key
|
||||
CyberarmEngine::Window.instance.current_state.button_up(key) if key
|
||||
|
||||
when "down"
|
||||
input = InputMapper.get(data.last.to_sym)
|
||||
key = input.is_a?(Array) ? input.first : input
|
||||
$window.current_state.button_down(key) if key
|
||||
CyberarmEngine::Window.instance.current_state.button_down(key) if key
|
||||
|
||||
when "mouse"
|
||||
@camera.orientation.z = data[1].to_f
|
||||
|
||||
@@ -65,11 +65,11 @@ class IMICFPS
|
||||
end
|
||||
|
||||
def hijack_input!
|
||||
$window.input_hijack = self
|
||||
CyberarmEngine::Window.instance.input_hijack = self
|
||||
end
|
||||
|
||||
def release_input!
|
||||
$window.input_hijack = nil
|
||||
CyberarmEngine::Window.instance.input_hijack = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@ class IMICFPS
|
||||
return unless @text_input
|
||||
|
||||
Gosu.draw_rect(
|
||||
Widget.horizontal_margin, $window.height / 2 - (@text.height / 2 + Widget.horizontal_padding),
|
||||
Widget.horizontal_margin, CyberarmEngine::Window.instance.height / 2 - (@text.height / 2 + Widget.horizontal_padding),
|
||||
@width - Widget.horizontal_padding * 2, @text.height + Widget.vertical_padding * 2,
|
||||
@background
|
||||
)
|
||||
@@ -44,11 +44,11 @@ class IMICFPS
|
||||
def update
|
||||
@deliver_to_text.text = "#{@deliver_to}: "
|
||||
@deliver_to_text.x = Widget.horizontal_margin + Widget.horizontal_padding
|
||||
@deliver_to_text.y = $window.height / 2 - (@text.height / 2)
|
||||
@deliver_to_text.y = CyberarmEngine::Window.instance.height / 2 - (@text.height / 2)
|
||||
|
||||
@text.text = @text_input&.text.to_s
|
||||
@text.x = Widget.horizontal_margin + Widget.horizontal_padding + @deliver_to_text.width
|
||||
@text.y = $window.height / 2 - (@text.height / 2)
|
||||
@text.y = CyberarmEngine::Window.instance.height / 2 - (@text.height / 2)
|
||||
end
|
||||
|
||||
def button_down(id)
|
||||
|
||||
@@ -26,7 +26,7 @@ class IMICFPS
|
||||
def available_light
|
||||
raise "Using to many lights, #{light_count}/#{LightManager::MAX_LIGHTS}" if light_count > LightManager::MAX_LIGHTS
|
||||
|
||||
puts "OpenGL::GL_LIGHT#{light_count}" if $window.config.get(:debug_options, :stats)
|
||||
puts "OpenGL::GL_LIGHT#{light_count}" if CyberarmEngine::Window.instance.config.get(:debug_options, :stats)
|
||||
Object.const_get "OpenGL::GL_LIGHT#{light_count}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class IMICFPS
|
||||
attr_reader :camera, :entities, :lights
|
||||
|
||||
def initialize
|
||||
@camera = PerspectiveCamera.new(position: Vector.new, aspect_ratio: $window.aspect_ratio)
|
||||
@camera = PerspectiveCamera.new(position: Vector.new, aspect_ratio: CyberarmEngine::Window.instance.aspect_ratio)
|
||||
@entities = []
|
||||
@lights = []
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class IMICFPS
|
||||
end
|
||||
|
||||
def map
|
||||
$window.director.map
|
||||
CyberarmEngine::Window.instance.director.map
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,20 +12,20 @@ class IMICFPS
|
||||
end
|
||||
|
||||
def set(key, value)
|
||||
$window.config[:debug_options, key] = value
|
||||
CyberarmEngine::Window.instance.config[:debug_options, key] = value
|
||||
end
|
||||
|
||||
def get(key)
|
||||
$window.config.get(:debug_options, key)
|
||||
CyberarmEngine::Window.instance.config.get(:debug_options, key)
|
||||
end
|
||||
|
||||
def setup
|
||||
set(:boundingboxes, false) if $window.config.get(:debug_options, :boundingboxes).nil?
|
||||
set(:wireframe, false) if $window.config.get(:debug_options, :wireframe).nil?
|
||||
set(:stats, false) if $window.config.get(:debug_options, :stats).nil?
|
||||
set(:skydome, true) if $window.config.get(:debug_options, :skydome).nil?
|
||||
set(:use_shaders, true) if $window.config.get(:debug_options, :use_shaders).nil?
|
||||
set(:opengl_error_panic, false) if $window.config.get(:debug_options, :opengl_error_panic).nil?
|
||||
set(:boundingboxes, false) if CyberarmEngine::Window.instance.config.get(:debug_options, :boundingboxes).nil?
|
||||
set(:wireframe, false) if CyberarmEngine::Window.instance.config.get(:debug_options, :wireframe).nil?
|
||||
set(:stats, false) if CyberarmEngine::Window.instance.config.get(:debug_options, :stats).nil?
|
||||
set(:skydome, true) if CyberarmEngine::Window.instance.config.get(:debug_options, :skydome).nil?
|
||||
set(:use_shaders, true) if CyberarmEngine::Window.instance.config.get(:debug_options, :use_shaders).nil?
|
||||
set(:opengl_error_panic, false) if CyberarmEngine::Window.instance.config.get(:debug_options, :opengl_error_panic).nil?
|
||||
|
||||
subcommand(:boundingboxes, :boolean)
|
||||
subcommand(:wireframe, :boolean)
|
||||
|
||||
@@ -19,12 +19,12 @@ class IMICFPS
|
||||
|
||||
case arguments.last
|
||||
when "", nil
|
||||
console.stdin("#{Console::Style.highlight('fps')}: #{$window.config.get(:options, :fps)}")
|
||||
console.stdin("#{Console::Style.highlight('fps')}: #{CyberarmEngine::Window.instance.config.get(:options, :fps)}")
|
||||
when "on"
|
||||
var = $window.config[:options, :fps] = true
|
||||
var = CyberarmEngine::Window.instance.config[:options, :fps] = true
|
||||
console.stdin("fps => #{Console::Style.highlight(var)}")
|
||||
when "off"
|
||||
var = $window.config[:options, :fps] = false
|
||||
var = CyberarmEngine::Window.instance.config[:options, :fps] = false
|
||||
console.stdin("fps => #{Console::Style.highlight(var)}")
|
||||
else
|
||||
console.stdin("Invalid argument for #{Console::Style.highlight(command.to_s)}, got #{Console::Style.error(arguments.last)} expected #{Console::Style.notice('on')}, or #{Console::Style.notice('off')}.")
|
||||
|
||||
@@ -12,7 +12,7 @@ class IMICFPS
|
||||
end
|
||||
|
||||
def setup
|
||||
$window.config[:options, :hud] = true if $window.config.get(:options, :hud).nil?
|
||||
CyberarmEngine::Window.instance.config[:options, :hud] = true if CyberarmEngine::Window.instance.config.get(:options, :hud).nil?
|
||||
end
|
||||
|
||||
def handle(arguments, console)
|
||||
@@ -23,12 +23,12 @@ class IMICFPS
|
||||
|
||||
case arguments.last
|
||||
when "", nil
|
||||
console.stdin("#{Console::Style.highlight(command.to_s)}: #{$window.config.get(:options, command)}")
|
||||
console.stdin("#{Console::Style.highlight(command.to_s)}: #{CyberarmEngine::Window.instance.config.get(:options, command)}")
|
||||
when "on"
|
||||
var = $window.config[:options, command] = true
|
||||
var = CyberarmEngine::Window.instance.config[:options, command] = true
|
||||
console.stdin("#{command} => #{Console::Style.highlight(var)}")
|
||||
when "off"
|
||||
var = $window.config[:options, command] = false
|
||||
var = CyberarmEngine::Window.instance.config[:options, command] = false
|
||||
console.stdin("#{command} => #{Console::Style.highlight(var)}")
|
||||
else
|
||||
console.stdin("Invalid argument for #{Console::Style.highlight(command.to_s)}, got #{Console::Style.error(arguments.last)} expected #{Console::Style.notice('on')}, or #{Console::Style.notice('off')}.")
|
||||
|
||||
@@ -5,20 +5,20 @@ class IMICFPS
|
||||
include CommonMethods
|
||||
|
||||
def self.set_defaults
|
||||
if $window.config.get(:options, :audio, :volume_master).nil?
|
||||
$window.config[:options, :audio, :volume_master] = 1.0
|
||||
if CyberarmEngine::Window.instance.config.get(:options, :audio, :volume_master).nil?
|
||||
CyberarmEngine::Window.instance.config[:options, :audio, :volume_master] = 1.0
|
||||
end
|
||||
|
||||
if $window.config.get(:options, :audio, :volume_sound_effects).nil?
|
||||
$window.config[:options, :audio, :volume_sound_effects] = 1.0
|
||||
if CyberarmEngine::Window.instance.config.get(:options, :audio, :volume_sound_effects).nil?
|
||||
CyberarmEngine::Window.instance.config[:options, :audio, :volume_sound_effects] = 1.0
|
||||
end
|
||||
|
||||
if $window.config.get(:options, :audio, :volume_music).nil?
|
||||
$window.config[:options, :audio, :volume_music] = 0.7
|
||||
if CyberarmEngine::Window.instance.config.get(:options, :audio, :volume_music).nil?
|
||||
CyberarmEngine::Window.instance.config[:options, :audio, :volume_music] = 0.7
|
||||
end
|
||||
|
||||
if $window.config.get(:options, :audio, :volume_dialogue).nil?
|
||||
$window.config[:options, :audio, :volume_dialogue] = 0.7
|
||||
if CyberarmEngine::Window.instance.config.get(:options, :audio, :volume_dialogue).nil?
|
||||
CyberarmEngine::Window.instance.config[:options, :audio, :volume_dialogue] = 0.7
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user