addaptive
This commit is contained in:
parent
35de3d2cd5
commit
97a7e7b751
|
|
@ -1,8 +1,37 @@
|
||||||
|
module Graphics
|
||||||
|
RESOLUTION_ASPECT =
|
||||||
|
if Graphics.width == 1280 && Graphics.height == 720
|
||||||
|
"_16_9_hd"
|
||||||
|
elsif Graphics.width == 1920 / 2 && Graphics.height == 1080 / 2
|
||||||
|
"_16_9"
|
||||||
|
elsif Graphics.width == 640 && Graphics.height == 480
|
||||||
|
"_4_3"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
module Kernel
|
||||||
|
alias_method :original_puts, :puts
|
||||||
|
|
||||||
|
def puts(*args)
|
||||||
|
string = ""
|
||||||
|
args.each do |arg|
|
||||||
|
string << arg.to_s
|
||||||
|
end
|
||||||
|
MKXP.puts string
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
module_function :puts
|
||||||
|
end
|
||||||
|
|
||||||
module RPG
|
module RPG
|
||||||
module Cache
|
module Cache
|
||||||
@cache = {}
|
@cache = {}
|
||||||
def self.load_bitmap(folder_name, filename, hue = 0)
|
def self.load_bitmap(folder_name, filename, hue = 0)
|
||||||
path = folder_name + filename
|
path = folder_name + filename
|
||||||
|
if File.exist?(folder_name + filename + Graphics::RESOLUTION_ASPECT + ".png")
|
||||||
|
path += Graphics::RESOLUTION_ASPECT
|
||||||
|
end
|
||||||
if not @cache.include?(path) or @cache[path].disposed?
|
if not @cache.include?(path) or @cache[path].disposed?
|
||||||
if filename != ""
|
if filename != ""
|
||||||
@cache[path] = Bitmap.new(path)
|
@cache[path] = Bitmap.new(path)
|
||||||
|
|
@ -72,18 +101,10 @@ module RPG
|
||||||
self.load_bitmap("Graphics/Icons/", filename)
|
self.load_bitmap("Graphics/Icons/", filename)
|
||||||
end
|
end
|
||||||
def self.panorama(filename, hue)
|
def self.panorama(filename, hue)
|
||||||
if Graphics.width == 1280 && File.exist?("Graphics/Panoramas/" + filename + "_16.png")
|
self.load_bitmap("Graphics/Panoramas/", filename, hue)
|
||||||
self.load_bitmap("Graphics/Panoramas/", filename + "_16", hue)
|
|
||||||
else
|
|
||||||
self.load_bitmap("Graphics/Panoramas/", filename, hue)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
def self.picture(filename)
|
def self.picture(filename)
|
||||||
if Graphics.width == 1280 && File.exist?("Graphics/Pictures/" + filename + "_16.png")
|
self.load_bitmap("Graphics/Pictures/", filename)
|
||||||
self.load_bitmap("Graphics/Pictures/", filename + "_16")
|
|
||||||
else
|
|
||||||
self.load_bitmap("Graphics/Pictures/", filename)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
def self.tileset(filename)
|
def self.tileset(filename)
|
||||||
self.load_bitmap("Graphics/Tilesets/", filename)
|
self.load_bitmap("Graphics/Tilesets/", filename)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ module Settings
|
||||||
:in_game_timer => false,
|
:in_game_timer => false,
|
||||||
:language => 0,
|
:language => 0,
|
||||||
:fasttravel_ui => 0,
|
:fasttravel_ui => 0,
|
||||||
:debug_text_scene_title => true,
|
|
||||||
|
|
||||||
# Gameplay
|
# Gameplay
|
||||||
:movement => 0,
|
:movement => 0,
|
||||||
|
|
@ -41,6 +40,8 @@ module Settings
|
||||||
:debug => false,
|
:debug => false,
|
||||||
:debug_character => false,
|
:debug_character => false,
|
||||||
:debug_text => false,
|
:debug_text => false,
|
||||||
|
:debug_text_scene_title => true,
|
||||||
|
:debug_picture_names => false,
|
||||||
}
|
}
|
||||||
reset_controls!
|
reset_controls!
|
||||||
end
|
end
|
||||||
|
|
@ -185,11 +186,6 @@ class Window_Settings
|
||||||
:parameter => :fasttravel_ui,
|
:parameter => :fasttravel_ui,
|
||||||
:values => [tr("Original"), tr("WME")]
|
:values => [tr("Original"), tr("WME")]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
:type => :bool,
|
|
||||||
:name => tr('Draw debug text in main menu(RR)'),
|
|
||||||
:parameter => :debug_text_scene_title
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
tr("Gameplay") => [
|
tr("Gameplay") => [
|
||||||
{
|
{
|
||||||
|
|
@ -320,13 +316,7 @@ class Window_Settings
|
||||||
:parameter => :controls_nav_right,
|
:parameter => :controls_nav_right,
|
||||||
:bind => Input::R
|
:bind => Input::R
|
||||||
},
|
},
|
||||||
{ :type => :sep, :name => tr("Other") },
|
#{ :type => :sep, :name => tr("Other") },
|
||||||
{
|
|
||||||
:type => :key,
|
|
||||||
:name => tr("Debug"),
|
|
||||||
:parameter => :controls_debug,
|
|
||||||
:bind => Input::DEBUGACTION
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
:type => :action,
|
:type => :action,
|
||||||
:name => tr("Reset Controls"),
|
:name => tr("Reset Controls"),
|
||||||
|
|
@ -351,11 +341,28 @@ class Window_Settings
|
||||||
:name => tr('Show debug character'),
|
:name => tr('Show debug character'),
|
||||||
:parameter => :debug_character
|
:parameter => :debug_character
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
:type => :bool,
|
||||||
|
:name => tr('Draw debug text in main menu'),
|
||||||
|
:parameter => :debug_text_scene_title
|
||||||
|
},
|
||||||
{
|
{
|
||||||
:type => :bool,
|
:type => :bool,
|
||||||
:name => tr('Show debug text'),
|
:name => tr('Show debug text'),
|
||||||
:parameter => :debug_text
|
:parameter => :debug_text
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
:type => :bool,
|
||||||
|
:name => tr('Show picture names'),
|
||||||
|
:parameter => :debug_picture_names
|
||||||
|
},
|
||||||
|
{ :type => :sep },
|
||||||
|
{
|
||||||
|
:type => :key,
|
||||||
|
:name => tr("Debug"),
|
||||||
|
:parameter => :controls_debug,
|
||||||
|
:bind => Input::DEBUGACTION
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class Window_Settings
|
||||||
|
|
||||||
@selection_sprite = Sprite.new(@viewport)
|
@selection_sprite = Sprite.new(@viewport)
|
||||||
@selection_sprite.bitmap = Bitmap.new(PARAMETER_WIDTH + 16, PARAMETER_HEIGHT)
|
@selection_sprite.bitmap = Bitmap.new(PARAMETER_WIDTH + 16, PARAMETER_HEIGHT)
|
||||||
@selection_sprite.bitmap.fill_rect(Rect.new(0, 0, PARAMETER_WIDTH + 16, PARAMETER_HEIGHT), Color.new(255, 255, 255, 128))
|
@selection_sprite.bitmap.fill_rect(Rect.new(0, 0, PARAMETER_WIDTH + 16, PARAMETER_HEIGHT), Color.new(255, 255, 255, 64))
|
||||||
@selection_sprite.x = @x - 8
|
@selection_sprite.x = @x - 8
|
||||||
@selection_sprite.y = @offset
|
@selection_sprite.y = @offset
|
||||||
@selection_sprite.opacity = 0
|
@selection_sprite.opacity = 0
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,6 @@ class Game_Map
|
||||||
def setup(map_id)
|
def setup(map_id)
|
||||||
# Put map ID in @map_id memory
|
# Put map ID in @map_id memory
|
||||||
@map_id = map_id
|
@map_id = map_id
|
||||||
puts map_id
|
|
||||||
# Load map from file and set @map
|
# Load map from file and set @map
|
||||||
@map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))
|
@map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))
|
||||||
# set tile set information in opening instance variables
|
# set tile set information in opening instance variables
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,10 @@ class Scene_Title
|
||||||
|
|
||||||
@window_settings_title = Window_Settings.new
|
@window_settings_title = Window_Settings.new
|
||||||
|
|
||||||
|
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
|
|
||||||
# Make title graphic
|
# Make title graphic
|
||||||
@sprite = Sprite.new
|
@sprite = Sprite.new(@viewport)
|
||||||
|
|
||||||
# chinese has its own special title screen so check for it
|
# chinese has its own special title screen so check for it
|
||||||
translation_name = "#{$persistent.langcode}/#{$data_system.title_name}"
|
translation_name = "#{$persistent.langcode}/#{$data_system.title_name}"
|
||||||
|
|
@ -45,65 +47,55 @@ class Scene_Title
|
||||||
@sprite.bitmap = RPG::Cache.title(translation_name)
|
@sprite.bitmap = RPG::Cache.title(translation_name)
|
||||||
else
|
else
|
||||||
if File.exist?("badend.lock")
|
if File.exist?("badend.lock")
|
||||||
if Graphics.width == 1280
|
@sprite.bitmap = RPG::Cache.title("badend")
|
||||||
@sprite.bitmap = RPG::Cache.title("badend_16")
|
|
||||||
else
|
|
||||||
@sprite.bitmap = RPG::Cache.title("badend")
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
if Graphics.width == 1280
|
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
|
||||||
@sprite.bitmap = RPG::Cache.title("normal_16")
|
|
||||||
else
|
|
||||||
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@sprite.x = Graphics.width / 2
|
||||||
|
@sprite.y = Graphics.height / 2
|
||||||
|
@sprite.ox = @sprite.bitmap.width / 2
|
||||||
|
@sprite.oy = @sprite.bitmap.height / 2
|
||||||
|
|
||||||
RPG::Mod.exec_hooks("hooks/Scene_Title/init", binding)
|
RPG::Mod.exec_hooks("hooks/Scene_Title/init", binding)
|
||||||
|
|
||||||
# check for debug file to add debug items
|
# check for debug file to add debug items
|
||||||
if Settings[:debug]
|
if Settings[:debug]
|
||||||
$game_party.gain_item(54, 1) # debug save
|
$game_party.gain_item(54, 1) # debug save
|
||||||
$game_party.gain_item(82, 1) # plight skip
|
$game_party.gain_item(82, 1) # plight skip
|
||||||
$game_party.gain_item(81, 1) # George reroler
|
$game_party.gain_item(81, 1) # George reroler
|
||||||
end
|
end
|
||||||
|
|
||||||
@sprite.zoom_x = 2.0
|
@sprite.zoom_x = 2.0
|
||||||
@sprite.zoom_y = 2.0
|
@sprite.zoom_y = 2.0
|
||||||
# Create/render menu options
|
# Create/render menu options
|
||||||
@menu = Sprite.new
|
@menu = Sprite.new(@viewport)
|
||||||
@menu.z += 1
|
@menu.z += 1
|
||||||
@menu.bitmap = Bitmap.new(Graphics.width, Graphics.height)
|
@menu.bitmap = Bitmap.new(Graphics.width, Graphics.height)
|
||||||
@menu.bitmap.draw_text(MENU_X, MENU_Y, 150, 24, tr("Start"))
|
@menu.bitmap.draw_text(MENU_X, MENU_Y, 150, 24, tr("Start"))
|
||||||
@menu.bitmap.draw_text(MENU_X, MENU_Y + 25, 150, 24, tr("Settings"))
|
@menu.bitmap.draw_text(MENU_X, MENU_Y + 25, 150, 24, tr("Settings"))
|
||||||
@menu.bitmap.draw_text(MENU_X, MENU_Y + 50, 150, 24, tr("Exit"))
|
@menu.bitmap.draw_text(MENU_X, MENU_Y + 50, 150, 24, tr("Exit"))
|
||||||
if Settings[:debug_text_scene_title]
|
|
||||||
@debug = Sprite.new
|
@debug = Sprite.new(@viewport)
|
||||||
@debug.z += @menu.z
|
@debug.z += 1
|
||||||
@debug.bitmap = Bitmap.new(Graphics.width, Graphics.height)
|
@debug.visible = Settings[:debug_text_scene_title] || false
|
||||||
@debug.bitmap.draw_text(5, 5, 200, 20, tr("Ruby #{RUBY_VERSION}"))
|
@debug.bitmap = Bitmap.new(Graphics.width, Graphics.height)
|
||||||
@debug.bitmap.draw_text(5, 25, 200, 20, tr("SDL #{SDLVer}"))
|
@debug.bitmap.draw_text(5, 5, 200, 20, tr("Ruby #{RUBY_VERSION}"))
|
||||||
@debug.bitmap.draw_text(5, 45, 200, 20, tr("Sunshine #{SunshineVer}"))
|
@debug.bitmap.draw_text(5, 25, 200, 20, tr("SDL #{SDLVer}"))
|
||||||
@debug.bitmap.draw_text(5, 65, 200, 20, tr("sec_#{Sunshine::SECURITYSTATE}"))
|
@debug.bitmap.draw_text(5, 45, 200, 20, tr("Sunshine #{SunshineVer}"))
|
||||||
if defined?(RubyVM::YJIT)
|
@debug.bitmap.draw_text(5, 65, 200, 20, tr("sec_#{Sunshine::SECURITYSTATE}"))
|
||||||
if RubyVM::YJIT.enabled?
|
jit_text = "JIT: unsupported"
|
||||||
@debug.bitmap.draw_text(5, 85, 200, 20, tr("JIT: YJIT"))
|
if defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled?
|
||||||
end
|
jit_text = "JIT: YJIT"
|
||||||
elsif defined?(RubyVM::ZJIT)
|
elsif defined?(RubyVM::ZJIT) && RubyVM::ZJIT.enabled?
|
||||||
if RubyVM::ZJIT.enabled?
|
jit_text = "JIT: ZJIT"
|
||||||
@debug.bitmap.draw_text(5, 85, 200, 20, tr("JIT: ZJIT"))
|
elsif defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled?
|
||||||
end
|
jit_text = "JIT: RJIT"
|
||||||
elsif defined?(RubyVM::RJIT)
|
end
|
||||||
if RubyVM::RJIT.enabled?
|
@debug.bitmap.draw_text(5, 85, 200, 20, tr(jit_text))
|
||||||
@debug.bitmap.draw_text(5, 85, 200, 20, tr("JIT: RJIT"))
|
if ModLoader::IS_ENABLED
|
||||||
end
|
@debug.bitmap.draw_text(5, 65, 200, 20, tr("Mods loaded: #{ModLoader::COUNT}"))
|
||||||
else
|
end
|
||||||
@debug.bitmap.draw_text(5, 85, 200, 20, tr("JIT: unsupported"))
|
|
||||||
end
|
|
||||||
if ModLoader::IS_ENABLED
|
|
||||||
@debug.bitmap.draw_text(5, 65, 200, 20, tr("Mods loaded: #{ModLoader::COUNT}"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if $game_switches[160] && $game_switches[152]
|
if $game_switches[160] && $game_switches[152]
|
||||||
@menu.bitmap.draw_text(MENU_X, MENU_Y + 75, 150, 24, tr("..."))
|
@menu.bitmap.draw_text(MENU_X, MENU_Y + 75, 150, 24, tr("..."))
|
||||||
|
|
@ -112,7 +104,7 @@ class Scene_Title
|
||||||
Language.register_text_sprite(self.class.name + "_contents", @menu.bitmap)
|
Language.register_text_sprite(self.class.name + "_contents", @menu.bitmap)
|
||||||
|
|
||||||
# Make cursor graphic
|
# Make cursor graphic
|
||||||
@cursor = Sprite.new
|
@cursor = Sprite.new(@viewport)
|
||||||
@cursor.zoom_x = @cursor.zoom_y = 2
|
@cursor.zoom_x = @cursor.zoom_y = 2
|
||||||
@cursor.bitmap
|
@cursor.bitmap
|
||||||
@cursor.z += 2
|
@cursor.z += 2
|
||||||
|
|
@ -159,7 +151,10 @@ class Scene_Title
|
||||||
@menu.dispose
|
@menu.dispose
|
||||||
@cursor.bitmap.dispose
|
@cursor.bitmap.dispose
|
||||||
@cursor.dispose
|
@cursor.dispose
|
||||||
@window_settings_title.dispose
|
@debug.bitmap.dispose
|
||||||
|
@debug.dispose
|
||||||
|
@viewport.dispose
|
||||||
|
@window_settings_title.dispose
|
||||||
Audio.bgm_fade(60)
|
Audio.bgm_fade(60)
|
||||||
Graphics.transition(60)
|
Graphics.transition(60)
|
||||||
# Run automatic change for BGM and BGS set with map
|
# Run automatic change for BGM and BGS set with map
|
||||||
|
|
@ -169,6 +164,8 @@ class Scene_Title
|
||||||
# * Frame Update
|
# * Frame Update
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
def update
|
def update
|
||||||
|
@debug.visible = Settings[:debug_text_scene_title] || false # if undefined don't render
|
||||||
|
|
||||||
# Handle cursor movement
|
# Handle cursor movement
|
||||||
if !@window_settings_title.visible
|
if !@window_settings_title.visible
|
||||||
@cursor.y = (MENU_Y.to_f + (20.0 - @cursor.bitmap.height.to_f) / 2.0 + 25.5 * @cursor_pos) * 0.65 + @cursor.y.to_f * 0.35
|
@cursor.y = (MENU_Y.to_f + (20.0 - @cursor.bitmap.height.to_f) / 2.0 + 25.5 * @cursor_pos) * 0.65 + @cursor.y.to_f * 0.35
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class Sprite_Picture < Sprite
|
||||||
if @picture_name != ""
|
if @picture_name != ""
|
||||||
# Get picture graphic
|
# Get picture graphic
|
||||||
self.bitmap = RPG::Cache.picture(@picture_name)
|
self.bitmap = RPG::Cache.picture(@picture_name)
|
||||||
if Settings[:debug]
|
if Settings[:debug_picture_names]
|
||||||
self.bitmap.draw_text(0, 0, 500, 20, @picture_name)
|
self.bitmap.draw_text(0, 0, 500, 20, @picture_name)
|
||||||
end
|
end
|
||||||
if @picture_name == "cg_desktop_no_effects"
|
if @picture_name == "cg_desktop_no_effects"
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,7 @@ class Window_Settings
|
||||||
@viewport.z = 9998
|
@viewport.z = 9998
|
||||||
@bg = Sprite.new(@viewport)
|
@bg = Sprite.new(@viewport)
|
||||||
@bg.bitmap = Bitmap.new(Graphics.width, Graphics.height)
|
@bg.bitmap = Bitmap.new(Graphics.width, Graphics.height)
|
||||||
@bg.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(255, 255, 255, 196))
|
@bg.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0, 0, 0, 196))
|
||||||
@bg.blend_type = 2
|
|
||||||
@title = Sprite.new(@viewport)
|
@title = Sprite.new(@viewport)
|
||||||
@title.bitmap = Bitmap.new(320, 20)
|
@title.bitmap = Bitmap.new(320, 20)
|
||||||
@title.bitmap.font.size = 20
|
@title.bitmap.font.size = 20
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue