mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
update settings menu, misc tweaks and fixes
This commit is contained in:
@@ -5,6 +5,7 @@ require "abbrev"
|
|||||||
require "time"
|
require "time"
|
||||||
require "socket"
|
require "socket"
|
||||||
require "tmpdir"
|
require "tmpdir"
|
||||||
|
require "securerandom"
|
||||||
|
|
||||||
require "opengl"
|
require "opengl"
|
||||||
require "glu"
|
require "glu"
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class IMICFPS
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@text.x = window.width - (@text.width + Widget.margin)
|
@text.x = window.width - (@text.markup_width + Widget.margin)
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_random_data
|
def generate_random_data
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class IMICFPS
|
|||||||
|
|
||||||
def draw
|
def draw
|
||||||
return if @text.text.empty?
|
return if @text.text.empty?
|
||||||
width = @text.width + 8
|
width = @text.markup_width + 8
|
||||||
|
|
||||||
Gosu.draw_rect(0, 0, width, (@text.height + 4), Gosu::Color.rgba(0, 0, 0, 100))
|
Gosu.draw_rect(0, 0, width, (@text.height + 4), Gosu::Color.rgba(0, 0, 0, 100))
|
||||||
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))
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ class IMICFPS
|
|||||||
def update
|
def update
|
||||||
super
|
super
|
||||||
|
|
||||||
# @camera.update
|
|
||||||
@light.position = @camera.position.clone
|
@light.position = @camera.position.clone
|
||||||
@light.position.y += 1.5
|
@light.position.y += 1.5
|
||||||
@camera_position.value = "Camera Position: X #{@camera.position.x.round(2)}, Y #{@camera.position.y.round(2)}, Z #{@camera.position.z.round(2)}"
|
@camera_position.value = "Camera Position: X #{@camera.position.x.round(2)}, Y #{@camera.position.y.round(2)}, Z #{@camera.position.z.round(2)}"
|
||||||
@@ -75,7 +74,6 @@ class IMICFPS
|
|||||||
super
|
super
|
||||||
|
|
||||||
InputMapper.keyup(id)
|
InputMapper.keyup(id)
|
||||||
@camera.button_up(id)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,12 @@ class IMICFPS
|
|||||||
class SettingsMenu < Menu
|
class SettingsMenu < Menu
|
||||||
include CommonMethods
|
include CommonMethods
|
||||||
|
|
||||||
|
def self.set_defaults
|
||||||
|
$window.config[:options, :audio, :volume_sound] = 1.0 if $window.config.get(:options, :audio, :volume_sound).nil?
|
||||||
|
$window.config[:options, :audio, :volume_music] = 0.7 if $window.config.get(:options, :audio, :volume_music).nil?
|
||||||
|
$window.config[:options, :audio, :volume_dialogue] = 0.7 if $window.config.get(:options, :audio, :volume_dialogue).nil?
|
||||||
|
end
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@categories = [
|
@categories = [
|
||||||
"Display",
|
"Display",
|
||||||
@@ -68,46 +74,52 @@ class IMICFPS
|
|||||||
|
|
||||||
check_box "Fullscreen", padding_top: 25, padding_bottom: 25
|
check_box "Fullscreen", padding_top: 25, padding_bottom: 25
|
||||||
|
|
||||||
|
stack do
|
||||||
|
longest_string = "Gamma Correction"
|
||||||
flow do
|
flow do
|
||||||
stack do
|
label "Gamma Correction".ljust(longest_string.length, " ")
|
||||||
label "Gamma Correction"
|
@display_gamma_correction = slider range: 0.0..1.0, value: 0.5
|
||||||
label "Brightness"
|
@display_gamma_correction.subscribe(:changed) do |sender, value|
|
||||||
label "Contrast"
|
@display_gamma_correction_label.value = value.round(1).to_s
|
||||||
end
|
end
|
||||||
stack do
|
@display_gamma_correction_label = label "0.0"
|
||||||
slider
|
|
||||||
slider
|
|
||||||
slider
|
|
||||||
end
|
end
|
||||||
stack do
|
flow do
|
||||||
label "0.0"
|
label "Brightness".ljust(longest_string.length, " ")
|
||||||
label "0.0"
|
@display_brightness = slider range: 0.0..1.0, value: 0.5
|
||||||
label "0.0"
|
@display_brightness.subscribe(:changed) do |sender, value|
|
||||||
|
@display_brightness_label.value = value.round(1).to_s
|
||||||
|
end
|
||||||
|
@display_brightness_label = label "0.0" end
|
||||||
|
flow do
|
||||||
|
label "Contrast".ljust(longest_string.length, " ")
|
||||||
|
@display_contrast = slider range: 0.0..1.0, value: 0.5
|
||||||
|
@display_contrast.subscribe(:changed) do |sender, value|
|
||||||
|
@display_contrast_label.value = value.round(1).to_s
|
||||||
|
end
|
||||||
|
@display_contrast_label = label "0.0"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_page_audio
|
def create_page_audio
|
||||||
label "Audio", text_size: 50
|
label "Audio", text_size: 50
|
||||||
|
longest_string = "Dialogue".length
|
||||||
|
volumes = [:sound, :music, :dialogue]
|
||||||
|
|
||||||
|
stack do
|
||||||
|
volumes.each do |volume|
|
||||||
|
config_value = window.config.get(:options, :audio, :"volume_#{volume}")
|
||||||
|
|
||||||
flow do
|
flow do
|
||||||
stack do
|
label volume.to_s.split("_").join(" ").capitalize.ljust(longest_string, " ")
|
||||||
label "Master Volume"
|
instance_variable_set(:"@volume_#{volume}", slider(range: 0.0..1.0, value: config_value))
|
||||||
label "Sound Effects"
|
instance_variable_get(:"@volume_#{volume}").subscribe(:changed) do |sender, value|
|
||||||
label "Dialog"
|
instance_variable_get(:"@volume_#{volume}_label").value = "%03.2f%%" % [value * 100.0]
|
||||||
label "Cinematic"
|
window.config[:options, :audio, :"volume_#{volume}"] = value
|
||||||
end
|
end
|
||||||
stack do
|
instance_variable_set(:"@volume_#{volume}_label", label("%03.2f%%" % [config_value * 100.0]))
|
||||||
slider range: 0.0..1.0, value: 1.0
|
|
||||||
slider range: 0.0..1.0, value: 1.0
|
|
||||||
slider range: 0.0..1.0, value: 1.0
|
|
||||||
slider range: 0.0..1.0, value: 1.0
|
|
||||||
end
|
end
|
||||||
stack do
|
|
||||||
label "0.0"
|
|
||||||
label "0.0"
|
|
||||||
label "0.0"
|
|
||||||
label "0.0"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -120,7 +132,12 @@ class IMICFPS
|
|||||||
label "#{key}"
|
label "#{key}"
|
||||||
|
|
||||||
[values].flatten.each do |value|
|
[values].flatten.each do |value|
|
||||||
button Gosu.button_id_to_char(value)
|
if name = Gosu.button_name(value)
|
||||||
|
else
|
||||||
|
name = Gosu.constants.find { |const| Gosu.const_get(const) == value }
|
||||||
|
name = name.to_s.capitalize.split("_").join(" ") if name
|
||||||
|
end
|
||||||
|
button name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -129,66 +146,61 @@ class IMICFPS
|
|||||||
def create_page_graphics
|
def create_page_graphics
|
||||||
label "Graphics", text_size: 50
|
label "Graphics", text_size: 50
|
||||||
|
|
||||||
|
longest_string = "Surface Effect Detail"
|
||||||
|
|
||||||
flow do
|
flow do
|
||||||
check_box "V-Sync"
|
check_box "V-Sync (Not Disableable, Yet.)", checked: true, enabled: false
|
||||||
label "(No Supported)"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
flow do
|
flow do
|
||||||
label "Field of View"
|
label "Field of View".ljust(longest_string.length, " ")
|
||||||
slider range: 70.0..110.0
|
@fov = slider range: 70.0..110.0
|
||||||
label "90.0"
|
@fov.subscribe(:changed) do |sender, value|
|
||||||
|
@fov_label.value = value.round.to_s
|
||||||
|
end
|
||||||
|
@fov_label = label "90.0"
|
||||||
end
|
end
|
||||||
|
|
||||||
flow do
|
flow do
|
||||||
stack do
|
label "Detail".ljust(longest_string.length, " ")
|
||||||
label "Detail"
|
list_box items: [:high, :medium, :low], width: 250
|
||||||
end
|
|
||||||
stack do
|
|
||||||
slider range: 1..3
|
|
||||||
end
|
|
||||||
stack do
|
|
||||||
label "High"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
advanced_mode = check_box "Advanced Mode"
|
label ""
|
||||||
|
advanced_mode = check_box "Advanced Settings"
|
||||||
|
label ""
|
||||||
|
|
||||||
advanced_settings = stack do |element|
|
advanced_settings = stack width: 1.0 do |element|
|
||||||
element.hide
|
element.hide
|
||||||
|
|
||||||
|
stack do
|
||||||
flow do
|
flow do
|
||||||
stack do
|
label "Geometry Detail".ljust(longest_string.length, " ")
|
||||||
label "Geometry Detail"
|
list_box items: [:high, :medium, :low], width: 250
|
||||||
label "Shadow Detail"
|
|
||||||
label "Texture Detail"
|
|
||||||
label "Particle Detail"
|
|
||||||
label "Surface Effect Detail"
|
|
||||||
end
|
end
|
||||||
stack do
|
|
||||||
slider
|
|
||||||
slider
|
|
||||||
slider
|
|
||||||
slider
|
|
||||||
slider
|
|
||||||
end
|
|
||||||
stack do
|
|
||||||
label "High"
|
|
||||||
label "High"
|
|
||||||
label "High"
|
|
||||||
label "High"
|
|
||||||
label "High"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
flow do
|
flow do
|
||||||
stack do
|
label "Shadow Detail".ljust(longest_string.length, " ")
|
||||||
label "Lighting Mode"
|
list_box items: [:high, :medium, :low, :off], width: 250
|
||||||
edit_line ""
|
|
||||||
end
|
end
|
||||||
stack do
|
flow do
|
||||||
label "Texture Filtering"
|
label "Texture Detail".ljust(longest_string.length, " ")
|
||||||
edit_line ""
|
list_box items: [:high, :medium, :low], width: 250
|
||||||
|
end
|
||||||
|
flow do
|
||||||
|
label "Particle Detail".ljust(longest_string.length, " ")
|
||||||
|
list_box items: [:high, :medium, :low, :off], width: 250
|
||||||
|
end
|
||||||
|
flow do
|
||||||
|
label "Surface Effect Detail".ljust(longest_string.length, " ")
|
||||||
|
list_box items: [:high, :medium, :low], width: 250
|
||||||
|
end
|
||||||
|
flow do
|
||||||
|
label "Lighting Mode".ljust(longest_string.length, " ")
|
||||||
|
list_box items: [:per_pixel, :per_vertex], width: 250
|
||||||
|
end
|
||||||
|
flow do
|
||||||
|
label "Texture Filtering".ljust(longest_string.length, " ")
|
||||||
|
list_box items: [:none], width: 250
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -202,6 +214,10 @@ class IMICFPS
|
|||||||
def create_page_multiplayer
|
def create_page_multiplayer
|
||||||
label "Multiplayer", text_size: 50
|
label "Multiplayer", text_size: 50
|
||||||
|
|
||||||
|
flow do
|
||||||
|
label "Player Name"
|
||||||
|
edit_line "player-#{SecureRandom.hex(2)}"
|
||||||
|
end
|
||||||
check_box "Show player names"
|
check_box "Show player names"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class IMICFPS
|
|||||||
@show_console = false
|
@show_console = false
|
||||||
@console = Console.new
|
@console = Console.new
|
||||||
Commands::Command.setup
|
Commands::Command.setup
|
||||||
|
SettingsMenu.set_defaults
|
||||||
|
|
||||||
@renderer = Renderer.new
|
@renderer = Renderer.new
|
||||||
preload_default_shaders
|
preload_default_shaders
|
||||||
|
|||||||
Reference in New Issue
Block a user