mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-16 16:12:35 +00:00
Compare commits
10 Commits
87bff4ab82
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c3c549f27 | ||
| 2da9edb6d0 | |||
| 8f2d7ff905 | |||
| 580c9d79ce | |||
| 07c8dfa45b | |||
|
|
b69bdc8e46 | ||
| 3481de2498 | |||
|
|
7bcd973a88 | ||
| 1d34cbb63d | |||
|
|
2df2df8488 |
35
Gemfile.lock
35
Gemfile.lock
@@ -1,10 +1,9 @@
|
|||||||
GIT
|
GIT
|
||||||
remote: https://github.com/cyberarm/cyberarm_engine
|
remote: https://github.com/cyberarm/cyberarm_engine
|
||||||
revision: 1b080f9fb99cc4ec696f32f00f28cbf89b40ed04
|
revision: 72037efc735089cf1ff4b56ec57eb793699b27c6
|
||||||
specs:
|
specs:
|
||||||
cyberarm_engine (0.18.0)
|
cyberarm_engine (0.23.0)
|
||||||
clipboard (~> 1.3.5)
|
excon (~> 0.88)
|
||||||
excon (~> 0.78.0)
|
|
||||||
gosu (~> 1.1)
|
gosu (~> 1.1)
|
||||||
gosu_more_drawables (~> 0.3)
|
gosu_more_drawables (~> 0.3)
|
||||||
|
|
||||||
@@ -21,28 +20,26 @@ GIT
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
clipboard (1.3.5)
|
concurrent-ruby (1.2.2)
|
||||||
concurrent-ruby (1.1.8)
|
|
||||||
cri (2.1.0)
|
cri (2.1.0)
|
||||||
excon (0.78.1)
|
excon (0.99.0)
|
||||||
gosu (1.2.0)
|
gosu (1.4.5)
|
||||||
gosu_more_drawables (0.3.1)
|
gosu_more_drawables (0.3.1)
|
||||||
i18n (1.8.10)
|
i18n (1.12.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
mini_portile2 (2.5.3)
|
mini_portile2 (2.8.1)
|
||||||
nokogiri (1.11.6)
|
nokogiri (1.14.3)
|
||||||
mini_portile2 (~> 2.5.0)
|
mini_portile2 (~> 2.8.0)
|
||||||
racc (~> 1.4)
|
|
||||||
nokogiri (1.11.6-x64-mingw32)
|
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
ocra (1.3.11)
|
ocra (1.3.11)
|
||||||
opengl-bindings (1.6.11)
|
opengl-bindings (1.6.13)
|
||||||
racc (1.5.2)
|
racc (1.6.2)
|
||||||
rake (13.0.3)
|
rake (13.0.6)
|
||||||
rubyzip (2.3.0)
|
rubyzip (2.3.2)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
x64-mingw-ucrt
|
||||||
x64-mingw32
|
x64-mingw32
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
@@ -57,4 +54,4 @@ DEPENDENCIES
|
|||||||
rubyzip
|
rubyzip
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.2.3
|
2.4.8
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ end
|
|||||||
class Window < Gosu::Window
|
class Window < Gosu::Window
|
||||||
def initialize
|
def initialize
|
||||||
super(Gosu.screen_width, Gosu.screen_height, fullscreen: true)
|
super(Gosu.screen_width, Gosu.screen_height, fullscreen: true)
|
||||||
$window = self
|
CyberarmEngine::Window.instance = self
|
||||||
@size = 50
|
@size = 50
|
||||||
@slope = 250
|
@slope = 250
|
||||||
@color_step = 10
|
@color_step = 10
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
component(:vehicle) # Generic, Weapon
|
component(:vehicle) # Generic, Weapon
|
||||||
|
|
||||||
on.button_down(:interact) do |event|
|
on.button_down(:interact) do |event|
|
||||||
$window.console.stdin("#{event.entity.name} handled button_down(:interact)")
|
CyberarmEngine::Window.instance.console.stdin("#{event.entity.name} handled button_down(:interact)")
|
||||||
# if event.player.touching?(event.entity)
|
# if event.player.touching?(event.entity)
|
||||||
# event.player.enter_vehicle
|
# event.player.enter_vehicle
|
||||||
# elsif event.player.driving?(event.entity) or event.player.passenger?(event.entity)
|
# elsif event.player.driving?(event.entity) or event.player.passenger?(event.entity)
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ class IMICFPS
|
|||||||
|
|
||||||
module CommonMethods
|
module CommonMethods
|
||||||
def window
|
def window
|
||||||
$window
|
CyberarmEngine::Window.instance
|
||||||
end
|
end
|
||||||
|
|
||||||
def delta_time
|
def delta_time
|
||||||
(Gosu.milliseconds - window.delta_time) / 1000.0
|
window.delta_time
|
||||||
end
|
end
|
||||||
|
|
||||||
def button_down?(id)
|
def button_down?(id)
|
||||||
|
|||||||
@@ -77,12 +77,12 @@ class IMICFPS
|
|||||||
when "up"
|
when "up"
|
||||||
input = InputMapper.get(data.last.to_sym)
|
input = InputMapper.get(data.last.to_sym)
|
||||||
key = input.is_a?(Array) ? input.first : input
|
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"
|
when "down"
|
||||||
input = InputMapper.get(data.last.to_sym)
|
input = InputMapper.get(data.last.to_sym)
|
||||||
key = input.is_a?(Array) ? input.first : input
|
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"
|
when "mouse"
|
||||||
@camera.orientation.z = data[1].to_f
|
@camera.orientation.z = data[1].to_f
|
||||||
|
|||||||
@@ -65,11 +65,11 @@ class IMICFPS
|
|||||||
end
|
end
|
||||||
|
|
||||||
def hijack_input!
|
def hijack_input!
|
||||||
$window.input_hijack = self
|
CyberarmEngine::Window.instance.input_hijack = self
|
||||||
end
|
end
|
||||||
|
|
||||||
def release_input!
|
def release_input!
|
||||||
$window.input_hijack = nil
|
CyberarmEngine::Window.instance.input_hijack = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class IMICFPS
|
|||||||
return unless @text_input
|
return unless @text_input
|
||||||
|
|
||||||
Gosu.draw_rect(
|
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,
|
@width - Widget.horizontal_padding * 2, @text.height + Widget.vertical_padding * 2,
|
||||||
@background
|
@background
|
||||||
)
|
)
|
||||||
@@ -44,11 +44,11 @@ class IMICFPS
|
|||||||
def update
|
def update
|
||||||
@deliver_to_text.text = "#{@deliver_to}: "
|
@deliver_to_text.text = "#{@deliver_to}: "
|
||||||
@deliver_to_text.x = Widget.horizontal_margin + Widget.horizontal_padding
|
@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.text = @text_input&.text.to_s
|
||||||
@text.x = Widget.horizontal_margin + Widget.horizontal_padding + @deliver_to_text.width
|
@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
|
end
|
||||||
|
|
||||||
def button_down(id)
|
def button_down(id)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class IMICFPS
|
|||||||
def available_light
|
def available_light
|
||||||
raise "Using to many lights, #{light_count}/#{LightManager::MAX_LIGHTS}" if light_count > LightManager::MAX_LIGHTS
|
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}"
|
Object.const_get "OpenGL::GL_LIGHT#{light_count}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class IMICFPS
|
|||||||
def tick(delta_time)
|
def tick(delta_time)
|
||||||
return unless @map
|
return unless @map
|
||||||
|
|
||||||
Publisher.instance.publish(:tick, delta_time * 1000.0)
|
Publisher.instance.publish(:tick, delta_time)
|
||||||
|
|
||||||
@map.update
|
@map.update
|
||||||
@server&.update
|
@server&.update
|
||||||
|
|||||||
@@ -21,6 +21,31 @@ class IMICFPS
|
|||||||
Gosu.draw_rect(2, 2, width - 4, (@text.height + 4) - 4, Gosu::Color.rgba(100, 100, 100, 100))
|
Gosu.draw_rect(2, 2, width - 4, (@text.height + 4) - 4, Gosu::Color.rgba(100, 100, 100, 100))
|
||||||
|
|
||||||
@text.draw
|
@text.draw
|
||||||
|
|
||||||
|
sample_points = 256
|
||||||
|
frame_stats = CyberarmEngine::Stats.frames.select(&:complete?)
|
||||||
|
return if frame_stats.empty?
|
||||||
|
|
||||||
|
right_origin = CyberarmEngine::Vector.new(10, 128)
|
||||||
|
nodes = Array.new(sample_points) { [] }
|
||||||
|
|
||||||
|
slice = 0
|
||||||
|
frame_stats.each_slice((CyberarmEngine::Stats.max_frame_history / sample_points.to_f).ceil) do |bucket|
|
||||||
|
bucket.each do |frame|
|
||||||
|
nodes[slice] << frame.frame_timing.duration
|
||||||
|
end
|
||||||
|
|
||||||
|
slice += 1
|
||||||
|
end
|
||||||
|
|
||||||
|
points = []
|
||||||
|
nodes.each_with_index do |cluster, i|
|
||||||
|
break if cluster.empty?
|
||||||
|
|
||||||
|
points << CyberarmEngine::Vector.new(right_origin.x + 1 * i, right_origin.y - cluster.max)
|
||||||
|
end
|
||||||
|
|
||||||
|
Gosu.draw_path(points, Gosu::Color::WHITE, Float::INFINITY) if points.size > 1
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@@ -33,7 +58,7 @@ class IMICFPS
|
|||||||
if window.config.get(:options, :fps)
|
if window.config.get(:options, :fps)
|
||||||
create_slot "FPS: #{Gosu.fps}"
|
create_slot "FPS: #{Gosu.fps}"
|
||||||
if window.config.get(:debug_options, :stats)
|
if window.config.get(:debug_options, :stats)
|
||||||
create_slot "Frame time: #{(Gosu.milliseconds - window.delta_time).to_s.rjust(3, '0')}ms"
|
create_slot "Frame time: #{(window.delta_time * 1000).round.to_s}ms"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class IMICFPS
|
|||||||
attr_reader :camera, :entities, :lights
|
attr_reader :camera, :entities, :lights
|
||||||
|
|
||||||
def initialize
|
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 = []
|
@entities = []
|
||||||
@lights = []
|
@lights = []
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class IMICFPS
|
|||||||
end
|
end
|
||||||
|
|
||||||
def map
|
def map
|
||||||
$window.director.map
|
CyberarmEngine::Window.instance.director.map
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class IMICFPS
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
super
|
super
|
||||||
Publisher.instance.publish(:tick, Gosu.milliseconds - window.delta_time)
|
Publisher.instance.publish(:tick, window.delta_time)
|
||||||
|
|
||||||
control_editor
|
control_editor
|
||||||
|
|
||||||
|
|||||||
@@ -12,20 +12,20 @@ class IMICFPS
|
|||||||
end
|
end
|
||||||
|
|
||||||
def set(key, value)
|
def set(key, value)
|
||||||
$window.config[:debug_options, key] = value
|
CyberarmEngine::Window.instance.config[:debug_options, key] = value
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(key)
|
def get(key)
|
||||||
$window.config.get(:debug_options, key)
|
CyberarmEngine::Window.instance.config.get(:debug_options, key)
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
set(:boundingboxes, false) if $window.config.get(:debug_options, :boundingboxes).nil?
|
set(:boundingboxes, false) if CyberarmEngine::Window.instance.config.get(:debug_options, :boundingboxes).nil?
|
||||||
set(:wireframe, false) if $window.config.get(:debug_options, :wireframe).nil?
|
set(:wireframe, false) if CyberarmEngine::Window.instance.config.get(:debug_options, :wireframe).nil?
|
||||||
set(:stats, false) if $window.config.get(:debug_options, :stats).nil?
|
set(:stats, false) if CyberarmEngine::Window.instance.config.get(:debug_options, :stats).nil?
|
||||||
set(:skydome, true) if $window.config.get(:debug_options, :skydome).nil?
|
set(:skydome, true) if CyberarmEngine::Window.instance.config.get(:debug_options, :skydome).nil?
|
||||||
set(:use_shaders, true) if $window.config.get(:debug_options, :use_shaders).nil?
|
set(:use_shaders, true) if CyberarmEngine::Window.instance.config.get(:debug_options, :use_shaders).nil?
|
||||||
set(:opengl_error_panic, false) if $window.config.get(:debug_options, :opengl_error_panic).nil?
|
set(:opengl_error_panic, false) if CyberarmEngine::Window.instance.config.get(:debug_options, :opengl_error_panic).nil?
|
||||||
|
|
||||||
subcommand(:boundingboxes, :boolean)
|
subcommand(:boundingboxes, :boolean)
|
||||||
subcommand(:wireframe, :boolean)
|
subcommand(:wireframe, :boolean)
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ class IMICFPS
|
|||||||
|
|
||||||
case arguments.last
|
case arguments.last
|
||||||
when "", nil
|
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"
|
when "on"
|
||||||
var = $window.config[:options, :fps] = true
|
var = CyberarmEngine::Window.instance.config[:options, :fps] = true
|
||||||
console.stdin("fps => #{Console::Style.highlight(var)}")
|
console.stdin("fps => #{Console::Style.highlight(var)}")
|
||||||
when "off"
|
when "off"
|
||||||
var = $window.config[:options, :fps] = false
|
var = CyberarmEngine::Window.instance.config[:options, :fps] = false
|
||||||
console.stdin("fps => #{Console::Style.highlight(var)}")
|
console.stdin("fps => #{Console::Style.highlight(var)}")
|
||||||
else
|
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')}.")
|
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
|
end
|
||||||
|
|
||||||
def setup
|
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
|
end
|
||||||
|
|
||||||
def handle(arguments, console)
|
def handle(arguments, console)
|
||||||
@@ -23,12 +23,12 @@ class IMICFPS
|
|||||||
|
|
||||||
case arguments.last
|
case arguments.last
|
||||||
when "", nil
|
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"
|
when "on"
|
||||||
var = $window.config[:options, command] = true
|
var = CyberarmEngine::Window.instance.config[:options, command] = true
|
||||||
console.stdin("#{command} => #{Console::Style.highlight(var)}")
|
console.stdin("#{command} => #{Console::Style.highlight(var)}")
|
||||||
when "off"
|
when "off"
|
||||||
var = $window.config[:options, command] = false
|
var = CyberarmEngine::Window.instance.config[:options, command] = false
|
||||||
console.stdin("#{command} => #{Console::Style.highlight(var)}")
|
console.stdin("#{command} => #{Console::Style.highlight(var)}")
|
||||||
else
|
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')}.")
|
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
|
include CommonMethods
|
||||||
|
|
||||||
def self.set_defaults
|
def self.set_defaults
|
||||||
if $window.config.get(:options, :audio, :volume_master).nil?
|
if CyberarmEngine::Window.instance.config.get(:options, :audio, :volume_master).nil?
|
||||||
$window.config[:options, :audio, :volume_master] = 1.0
|
CyberarmEngine::Window.instance.config[:options, :audio, :volume_master] = 1.0
|
||||||
end
|
end
|
||||||
|
|
||||||
if $window.config.get(:options, :audio, :volume_sound_effects).nil?
|
if CyberarmEngine::Window.instance.config.get(:options, :audio, :volume_sound_effects).nil?
|
||||||
$window.config[:options, :audio, :volume_sound_effects] = 1.0
|
CyberarmEngine::Window.instance.config[:options, :audio, :volume_sound_effects] = 1.0
|
||||||
end
|
end
|
||||||
|
|
||||||
if $window.config.get(:options, :audio, :volume_music).nil?
|
if CyberarmEngine::Window.instance.config.get(:options, :audio, :volume_music).nil?
|
||||||
$window.config[:options, :audio, :volume_music] = 0.7
|
CyberarmEngine::Window.instance.config[:options, :audio, :volume_music] = 0.7
|
||||||
end
|
end
|
||||||
|
|
||||||
if $window.config.get(:options, :audio, :volume_dialogue).nil?
|
if CyberarmEngine::Window.instance.config.get(:options, :audio, :volume_dialogue).nil?
|
||||||
$window.config[:options, :audio, :volume_dialogue] = 0.7
|
CyberarmEngine::Window.instance.config[:options, :audio, :volume_dialogue] = 0.7
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -30,15 +30,17 @@ class IMICFPS
|
|||||||
stack(width: 0.25, height: 1.0) do
|
stack(width: 0.25, height: 1.0) do
|
||||||
end
|
end
|
||||||
|
|
||||||
stack(width: 0.5, height: 1.0) do
|
stack(fill: true, height: 1.0) do
|
||||||
stack(width: 1.0, height: 0.25) do
|
title "Settings", width: 1.0, text_align: :center
|
||||||
title "Settings"
|
|
||||||
|
|
||||||
|
stack(width: 1.0, height: 96) do
|
||||||
flow(width: 1.0) do
|
flow(width: 1.0) do
|
||||||
link I18n.t("menus.back"), width: nil do
|
link I18n.t("menus.back"), width: nil do
|
||||||
pop_state
|
pop_state
|
||||||
end
|
end
|
||||||
|
|
||||||
|
flow(fill: true)
|
||||||
|
|
||||||
button get_image("#{GAME_ROOT_PATH}/static/icons/settings_display.png"), image_width: 64, tip: I18n.t("settings.display") do
|
button get_image("#{GAME_ROOT_PATH}/static/icons/settings_display.png"), image_width: 64, tip: I18n.t("settings.display") do
|
||||||
show_page(:display)
|
show_page(:display)
|
||||||
end
|
end
|
||||||
@@ -61,9 +63,12 @@ class IMICFPS
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@page_container = stack(width: 1.0, height: 0.75, scroll: true) do
|
@page_container = stack(width: 1.0, fill: true, scroll: true, padding: 10) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
stack(width: 0.25, height: 1.0) do
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# @categories.each do |category|
|
# @categories.each do |category|
|
||||||
@@ -90,41 +95,42 @@ class IMICFPS
|
|||||||
def page_display
|
def page_display
|
||||||
label "Display", text_size: 50
|
label "Display", text_size: 50
|
||||||
|
|
||||||
label "Resolution"
|
stack(width: 1.0, height: 128) do
|
||||||
flow do
|
flow(width: 1.0) do
|
||||||
stack do
|
label "Width", width: 96
|
||||||
label "Width"
|
edit_line window.width.to_s, fill: true
|
||||||
label "Height"
|
|
||||||
end
|
end
|
||||||
stack do
|
|
||||||
edit_line window.width.to_s
|
flow(width: 1.0) do
|
||||||
edit_line window.height.to_s
|
label "Height", width: 96
|
||||||
|
edit_line window.height.to_s, fill: true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
check_box "Fullscreen", margin_top: 25, margin_bottom: 25
|
# check_box "Fullscreen", margin_top: 25, margin_bottom: 25, width: 1.0
|
||||||
|
|
||||||
stack do
|
stack(width: 1.0, height: 128, margin_top: 20) do
|
||||||
longest_string = "Gamma Correction"
|
flow(width: 1.0, fill: true) do
|
||||||
flow do
|
label "Gamma Correction", width: 256
|
||||||
label "Gamma Correction".ljust(longest_string.length, " ")
|
@display_gamma_correction = slider range: 0.0..1.0, value: 0.5, fill: true
|
||||||
@display_gamma_correction = slider range: 0.0..1.0, value: 0.5
|
|
||||||
@display_gamma_correction.subscribe(:changed) do |_sender, value|
|
@display_gamma_correction.subscribe(:changed) do |_sender, value|
|
||||||
@display_gamma_correction_label.value = value.round(1).to_s
|
@display_gamma_correction_label.value = value.round(1).to_s
|
||||||
end
|
end
|
||||||
@display_gamma_correction_label = label "0.0"
|
@display_gamma_correction_label = label "0.0"
|
||||||
end
|
end
|
||||||
flow do
|
|
||||||
label "Brightness".ljust(longest_string.length, " ")
|
flow(width: 1.0, fill: true) do
|
||||||
@display_brightness = slider range: 0.0..1.0, value: 0.5
|
label "Brightness", width: 256
|
||||||
|
@display_brightness = slider range: 0.0..1.0, value: 0.5, fill: true
|
||||||
@display_brightness.subscribe(:changed) do |_sender, value|
|
@display_brightness.subscribe(:changed) do |_sender, value|
|
||||||
@display_brightness_label.value = value.round(1).to_s
|
@display_brightness_label.value = value.round(1).to_s
|
||||||
end
|
end
|
||||||
@display_brightness_label = label "0.0"
|
@display_brightness_label = label "0.0"
|
||||||
end
|
end
|
||||||
flow do
|
|
||||||
label "Contrast".ljust(longest_string.length, " ")
|
flow(width: 1.0, fill: true) do
|
||||||
@display_contrast = slider range: 0.0..1.0, value: 0.5
|
label "Contrast", width: 256
|
||||||
|
@display_contrast = slider range: 0.0..1.0, value: 0.5, fill: true
|
||||||
@display_contrast.subscribe(:changed) do |_sender, value|
|
@display_contrast.subscribe(:changed) do |_sender, value|
|
||||||
@display_contrast_label.value = value.round(1).to_s
|
@display_contrast_label.value = value.round(1).to_s
|
||||||
end
|
end
|
||||||
@@ -135,29 +141,22 @@ class IMICFPS
|
|||||||
|
|
||||||
def page_audio
|
def page_audio
|
||||||
label "Audio", text_size: 50
|
label "Audio", text_size: 50
|
||||||
longest_string = "Dialogue".length
|
|
||||||
volumes = %i[master sound_effects music dialogue]
|
volumes = %i[master sound_effects music dialogue]
|
||||||
|
|
||||||
stack(width: 1.0) do
|
stack(width: 1.0, height: 48 * volumes.count) do
|
||||||
volumes.each do |volume|
|
volumes.each do |volume|
|
||||||
config_value = window.config.get(:options, :audio, :"volume_#{volume}")
|
config_value = window.config.get(:options, :audio, :"volume_#{volume}")
|
||||||
|
|
||||||
flow(width: 1.0, margin_bottom: 10) do
|
flow(width: 1.0, fill: true, margin_bottom: 10) do
|
||||||
flow(width: 0.25) do
|
label volume.to_s.split("_").map(&:capitalize).join(" "), width: 172
|
||||||
label volume.to_s.split("_").map(&:capitalize).join(" ").ljust(longest_string, " ")
|
|
||||||
|
instance_variable_set(:"@volume_#{volume}", slider(range: 0.0..1.0, value: config_value, fill: true))
|
||||||
|
instance_variable_get(:"@volume_#{volume}").subscribe(:changed) do |_sender, value|
|
||||||
|
instance_variable_get(:"@volume_#{volume}_label").value = format("%03.2f%%", value * 100.0)
|
||||||
|
window.config[:options, :audio, :"volume_#{volume}"] = value
|
||||||
end
|
end
|
||||||
|
|
||||||
flow(width: 0.5) do
|
instance_variable_set(:"@volume_#{volume}_label", label(format("%03.2f%%", config_value * 100.0), width: 96, text_align: :right))
|
||||||
instance_variable_set(:"@volume_#{volume}", slider(range: 0.0..1.0, value: config_value, width: 1.0))
|
|
||||||
instance_variable_get(:"@volume_#{volume}").subscribe(:changed) do |_sender, value|
|
|
||||||
instance_variable_get(:"@volume_#{volume}_label").value = format("%03.2f%%", value * 100.0)
|
|
||||||
window.config[:options, :audio, :"volume_#{volume}"] = value
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
flow(width: 0.25) do
|
|
||||||
instance_variable_set(:"@volume_#{volume}_label", label(format("%03.2f%%", config_value * 100.0)))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -167,16 +166,16 @@ class IMICFPS
|
|||||||
label "Controls", text_size: 50
|
label "Controls", text_size: 50
|
||||||
|
|
||||||
InputMapper.keymap.each do |key, values|
|
InputMapper.keymap.each do |key, values|
|
||||||
flow do
|
flow(width: 1.0, height: 64) do
|
||||||
label key.to_s
|
label key.to_s, width: 0.5, max_width: 312
|
||||||
|
|
||||||
[values].flatten.each do |value|
|
[values].flatten.each do |value|
|
||||||
if name = Gosu.button_name(value)
|
unless (name = Gosu.button_name(value))
|
||||||
else
|
|
||||||
name = Gosu.constants.find { |const| Gosu.const_get(const) == value }
|
name = Gosu.constants.find { |const| Gosu.const_get(const) == value }
|
||||||
name = name.to_s.capitalize.split("_").join(" ") if name
|
name = name.to_s.capitalize.split("_").join(" ") if name
|
||||||
end
|
end
|
||||||
button name
|
|
||||||
|
button name, fill: true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -185,61 +184,55 @@ class IMICFPS
|
|||||||
def page_graphics
|
def page_graphics
|
||||||
label "Graphics", text_size: 50
|
label "Graphics", text_size: 50
|
||||||
|
|
||||||
longest_string = "Surface Effect Detail"
|
check_box "V-Sync (Not Disableable, Yet.)", checked: true, enabled: false, width: 1.0
|
||||||
|
|
||||||
flow do
|
flow(width: 1.0, height: 64) do
|
||||||
check_box "V-Sync (Not Disableable, Yet.)", checked: true, enabled: false
|
label "Field of View", width: 128
|
||||||
end
|
@fov = slider range: 70.0..110.0, fill: true
|
||||||
|
|
||||||
flow do
|
|
||||||
label "Field of View".ljust(longest_string.length, " ")
|
|
||||||
@fov = slider range: 70.0..110.0
|
|
||||||
@fov.subscribe(:changed) do |_sender, value|
|
@fov.subscribe(:changed) do |_sender, value|
|
||||||
@fov_label.value = value.round.to_s
|
@fov_label.value = value.round.to_s
|
||||||
end
|
end
|
||||||
@fov_label = label "90.0"
|
@fov_label = label "90.0"
|
||||||
end
|
end
|
||||||
|
|
||||||
flow do
|
flow(width: 1.0, height: 64) do
|
||||||
label "Detail".ljust(longest_string.length, " ")
|
label "Detail", width: 128
|
||||||
list_box items: %i[high medium low], width: 250
|
list_box items: %i[high medium low], fill: true
|
||||||
end
|
end
|
||||||
|
|
||||||
label ""
|
advanced_mode = check_box "Advanced Settings", margin_top: 20, margin_bottom: 20
|
||||||
advanced_mode = check_box "Advanced Settings"
|
|
||||||
label ""
|
|
||||||
|
|
||||||
advanced_settings = stack width: 1.0 do |element|
|
advanced_settings = stack(width: 1.0) do |element|
|
||||||
element.hide
|
element.hide
|
||||||
|
|
||||||
stack do
|
stack(width: 1.0, height: 64 * 7) do
|
||||||
flow do
|
flow(width: 1.0, height: 64) do
|
||||||
label "Geometry Detail".ljust(longest_string.length, " ")
|
label "Geometry Detail", width: 312
|
||||||
list_box items: %i[high medium low], width: 250
|
list_box items: %i[high medium low], fill: true
|
||||||
end
|
end
|
||||||
flow do
|
flow(width: 1.0, height: 64) do
|
||||||
label "Shadow Detail".ljust(longest_string.length, " ")
|
label "Shadow Detail", width: 312
|
||||||
list_box items: %i[high medium low off], width: 250
|
list_box items: %i[high medium low off], fill: true
|
||||||
end
|
end
|
||||||
flow do
|
flow(width: 1.0, height: 64) do
|
||||||
label "Texture Detail".ljust(longest_string.length, " ")
|
label "Texture Detail", width: 312
|
||||||
list_box items: %i[high medium low], width: 250
|
list_box items: %i[high medium low], fill: true
|
||||||
end
|
end
|
||||||
flow do
|
flow(width: 1.0, height: 64) do
|
||||||
label "Particle Detail".ljust(longest_string.length, " ")
|
label "Particle Detail", width: 312
|
||||||
list_box items: %i[high medium low off], width: 250
|
list_box items: %i[high medium low off], fill: true
|
||||||
end
|
end
|
||||||
flow do
|
flow(width: 1.0, height: 64) do
|
||||||
label "Surface Effect Detail".ljust(longest_string.length, " ")
|
label "Surface Effect Detail", width: 312
|
||||||
list_box items: %i[high medium low], width: 250
|
list_box items: %i[high medium low], fill: true
|
||||||
end
|
end
|
||||||
flow do
|
flow(width: 1.0, height: 64) do
|
||||||
label "Lighting Mode".ljust(longest_string.length, " ")
|
label "Lighting Mode", width: 312
|
||||||
list_box items: %i[per_pixel per_vertex], width: 250
|
list_box items: %i[per_pixel per_vertex], fill: true
|
||||||
end
|
end
|
||||||
flow do
|
flow(width: 1.0, height: 64) do
|
||||||
label "Texture Filtering".ljust(longest_string.length, " ")
|
label "Texture Filtering", width: 312
|
||||||
list_box items: [:none], width: 250
|
list_box items: [:none], fill: true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -253,10 +246,11 @@ class IMICFPS
|
|||||||
def page_multiplayer
|
def page_multiplayer
|
||||||
label "Multiplayer", text_size: 50
|
label "Multiplayer", text_size: 50
|
||||||
|
|
||||||
flow do
|
flow(width: 1.0, height: 64) do
|
||||||
label "Player Name"
|
label "Player Name", width: 172
|
||||||
edit_line "player-#{SecureRandom.hex(2)}"
|
edit_line "player-#{SecureRandom.hex(2)}", fill: true
|
||||||
end
|
end
|
||||||
|
|
||||||
check_box "Show player names"
|
check_box "Show player names"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ class IMICFPS
|
|||||||
SettingsMenu.set_defaults
|
SettingsMenu.set_defaults
|
||||||
|
|
||||||
@renderer = Renderer.new
|
@renderer = Renderer.new
|
||||||
preload_default_shaders
|
|
||||||
@scene = TurnTableScene.new
|
@scene = TurnTableScene.new
|
||||||
@overlay = Overlay.new
|
@overlay = Overlay.new
|
||||||
|
|
||||||
@@ -38,20 +37,6 @@ class IMICFPS
|
|||||||
end
|
end
|
||||||
|
|
||||||
push_state(CyberarmEngine::IntroState, forward: Boot)
|
push_state(CyberarmEngine::IntroState, forward: Boot)
|
||||||
|
|
||||||
@delta_time = Gosu.milliseconds
|
|
||||||
end
|
|
||||||
|
|
||||||
def preload_default_shaders
|
|
||||||
shaders = %w[g_buffer lighting]
|
|
||||||
shaders.each do |shader|
|
|
||||||
Shader.new(
|
|
||||||
name: shader,
|
|
||||||
includes_dir: "shaders/include",
|
|
||||||
vertex: "shaders/vertex/#{shader}.glsl",
|
|
||||||
fragment: "shaders/fragment/#{shader}.glsl"
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def input_hijack=(hijacker)
|
def input_hijack=(hijacker)
|
||||||
@@ -88,8 +73,6 @@ class IMICFPS
|
|||||||
@console.update if @show_console
|
@console.update if @show_console
|
||||||
@overlay.update
|
@overlay.update
|
||||||
SoundManager.update
|
SoundManager.update
|
||||||
|
|
||||||
@delta_time = Gosu.milliseconds
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def close
|
def close
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
# version 330 core
|
|
||||||
|
|
||||||
layout(location = 0) out vec3 fragPosition;
|
|
||||||
layout (location = 1) out vec4 fragColor;
|
|
||||||
layout (location = 2) out vec3 fragNormal;
|
|
||||||
layout (location = 3) out vec3 fragUV;
|
|
||||||
|
|
||||||
in vec3 outPosition, outColor, outNormal, outUV, outFragPos, outCameraPos;
|
|
||||||
out vec4 outputFragColor;
|
|
||||||
flat in int outHasTexture;
|
|
||||||
|
|
||||||
uniform sampler2D diffuse_texture;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
vec3 result;
|
|
||||||
|
|
||||||
if (outHasTexture == 0) {
|
|
||||||
result = outColor;
|
|
||||||
} else {
|
|
||||||
result = texture(diffuse_texture, outUV.xy).xyz + 0.25;
|
|
||||||
}
|
|
||||||
|
|
||||||
fragPosition = outPosition;
|
|
||||||
fragColor = vec4(result, 1.0);
|
|
||||||
fragNormal = outNormal;
|
|
||||||
fragUV = outUV;
|
|
||||||
|
|
||||||
float gamma = 2.2;
|
|
||||||
outputFragColor.rgb = pow(fragColor.rgb, vec3(1.0 / gamma));
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
#version 330 core
|
|
||||||
out vec4 FragColor;
|
|
||||||
|
|
||||||
@include "light_struct"
|
|
||||||
const int DIRECTIONAL = 0;
|
|
||||||
const int POINT = 1;
|
|
||||||
const int SPOT = 2;
|
|
||||||
|
|
||||||
in vec2 outTexCoords;
|
|
||||||
flat in Light outLight[1];
|
|
||||||
|
|
||||||
uniform sampler2D diffuse, position, texcoord, normal, depth;
|
|
||||||
|
|
||||||
vec4 directionalLight(Light light) {
|
|
||||||
vec3 norm = normalize(texture(normal, outTexCoords).rgb);
|
|
||||||
vec3 diffuse_color = texture(diffuse, outTexCoords).rgb;
|
|
||||||
vec3 fragPos = texture(position, outTexCoords).rgb;
|
|
||||||
|
|
||||||
vec3 lightDir = normalize(light.position - fragPos);
|
|
||||||
float diff = max(dot(norm, lightDir), 0);
|
|
||||||
|
|
||||||
vec3 _ambient = light.ambient;
|
|
||||||
vec3 _diffuse = light.diffuse * diff;
|
|
||||||
vec3 _specular = light.specular;
|
|
||||||
|
|
||||||
return vec4(_diffuse + _ambient + _specular, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 pointLight(Light light) {
|
|
||||||
return vec4(0.25, 0.25, 0.25, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 spotLight(Light light) {
|
|
||||||
return vec4(0.5, 0.5, 0.5, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 calculateLighting(Light light) {
|
|
||||||
vec4 result;
|
|
||||||
|
|
||||||
// switch(light.type) {
|
|
||||||
// case DIRECTIONAL: {
|
|
||||||
// result = directionalLight(light);
|
|
||||||
// }
|
|
||||||
// case SPOT: {
|
|
||||||
// result = spotLight(light);
|
|
||||||
// }
|
|
||||||
// default: {
|
|
||||||
// result = pointLight(light);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (light.type == DIRECTIONAL) {
|
|
||||||
result = directionalLight(light);
|
|
||||||
} else {
|
|
||||||
result = pointLight(light);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
FragColor = texture(diffuse, outTexCoords) * calculateLighting(outLight[0]);
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
struct Light {
|
|
||||||
int type;
|
|
||||||
vec3 direction;
|
|
||||||
vec3 position;
|
|
||||||
|
|
||||||
vec3 diffuse;
|
|
||||||
vec3 ambient;
|
|
||||||
vec3 specular;
|
|
||||||
|
|
||||||
float intensity;
|
|
||||||
};
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
# version 330 core
|
|
||||||
|
|
||||||
layout(location = 0) in vec3 inPosition;
|
|
||||||
layout(location = 1) in vec3 inColor;
|
|
||||||
layout(location = 2) in vec3 inNormal;
|
|
||||||
layout(location = 3) in vec3 inUV;
|
|
||||||
|
|
||||||
uniform mat4 projection, view, model;
|
|
||||||
uniform int hasTexture;
|
|
||||||
uniform vec3 cameraPos;
|
|
||||||
|
|
||||||
out vec3 outPosition, outColor, outNormal, outUV;
|
|
||||||
out vec3 outFragPos, outViewPos, outCameraPos;
|
|
||||||
flat out int outHasTexture;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
// projection * view * model * position
|
|
||||||
outPosition = inPosition;
|
|
||||||
outColor = inColor;
|
|
||||||
outNormal= normalize(transpose(inverse(mat3(model))) * inNormal);
|
|
||||||
outUV = inUV;
|
|
||||||
outHasTexture = hasTexture;
|
|
||||||
outCameraPos = cameraPos;
|
|
||||||
|
|
||||||
outFragPos = vec3(model * vec4(inPosition, 1.0));
|
|
||||||
|
|
||||||
gl_Position = projection * view * model * vec4(inPosition, 1.0);
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#version 330 core
|
|
||||||
@include "light_struct"
|
|
||||||
|
|
||||||
layout (location = 0) in vec3 inPosition;
|
|
||||||
layout (location = 1) in vec2 inTexCoords;
|
|
||||||
|
|
||||||
uniform sampler2D diffuse, position, texcoord, normal, depth;
|
|
||||||
uniform Light light[1];
|
|
||||||
|
|
||||||
out vec2 outTexCoords;
|
|
||||||
flat out Light outLight[1];
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
gl_Position = vec4(inPosition.x, inPosition.y, inPosition.z, 1.0);
|
|
||||||
outTexCoords = inTexCoords;
|
|
||||||
outLight = light;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user