addaptive

This commit is contained in:
Issac332 2026-07-04 14:13:27 +03:00
parent 35de3d2cd5
commit 97a7e7b751
7 changed files with 100 additions and 77 deletions

View file

@ -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 Cache
@cache = {}
def self.load_bitmap(folder_name, filename, hue = 0)
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 filename != ""
@cache[path] = Bitmap.new(path)
@ -72,18 +101,10 @@ module RPG
self.load_bitmap("Graphics/Icons/", filename)
end
def self.panorama(filename, hue)
if Graphics.width == 1280 && File.exist?("Graphics/Panoramas/" + filename + "_16.png")
self.load_bitmap("Graphics/Panoramas/", filename + "_16", hue)
else
self.load_bitmap("Graphics/Panoramas/", filename, hue)
end
self.load_bitmap("Graphics/Panoramas/", filename, hue)
end
def self.picture(filename)
if Graphics.width == 1280 && File.exist?("Graphics/Pictures/" + filename + "_16.png")
self.load_bitmap("Graphics/Pictures/", filename + "_16")
else
self.load_bitmap("Graphics/Pictures/", filename)
end
self.load_bitmap("Graphics/Pictures/", filename)
end
def self.tileset(filename)
self.load_bitmap("Graphics/Tilesets/", filename)

View file

@ -18,7 +18,6 @@ module Settings
:in_game_timer => false,
:language => 0,
:fasttravel_ui => 0,
:debug_text_scene_title => true,
# Gameplay
:movement => 0,
@ -41,6 +40,8 @@ module Settings
:debug => false,
:debug_character => false,
:debug_text => false,
:debug_text_scene_title => true,
:debug_picture_names => false,
}
reset_controls!
end
@ -185,11 +186,6 @@ class Window_Settings
:parameter => :fasttravel_ui,
:values => [tr("Original"), tr("WME")]
},
{
:type => :bool,
:name => tr('Draw debug text in main menu(RR)'),
:parameter => :debug_text_scene_title
},
],
tr("Gameplay") => [
{
@ -320,13 +316,7 @@ class Window_Settings
:parameter => :controls_nav_right,
:bind => Input::R
},
{ :type => :sep, :name => tr("Other") },
{
:type => :key,
:name => tr("Debug"),
:parameter => :controls_debug,
:bind => Input::DEBUGACTION
},
#{ :type => :sep, :name => tr("Other") },
{
:type => :action,
:name => tr("Reset Controls"),
@ -351,11 +341,28 @@ class Window_Settings
:name => tr('Show debug character'),
:parameter => :debug_character
},
{
:type => :bool,
:name => tr('Draw debug text in main menu'),
:parameter => :debug_text_scene_title
},
{
:type => :bool,
:name => tr('Show 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

View file

@ -34,7 +34,7 @@ class Window_Settings
@selection_sprite = Sprite.new(@viewport)
@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.y = @offset
@selection_sprite.opacity = 0

View file

@ -91,7 +91,6 @@ class Game_Map
def setup(map_id)
# Put map ID in @map_id memory
@map_id = map_id
puts map_id
# Load map from file and set @map
@map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))
# set tile set information in opening instance variables

View file

@ -36,8 +36,10 @@ class Scene_Title
@window_settings_title = Window_Settings.new
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
# Make title graphic
@sprite = Sprite.new
@sprite = Sprite.new(@viewport)
# chinese has its own special title screen so check for it
translation_name = "#{$persistent.langcode}/#{$data_system.title_name}"
@ -45,65 +47,55 @@ class Scene_Title
@sprite.bitmap = RPG::Cache.title(translation_name)
else
if File.exist?("badend.lock")
if Graphics.width == 1280
@sprite.bitmap = RPG::Cache.title("badend_16")
else
@sprite.bitmap = RPG::Cache.title("badend")
end
@sprite.bitmap = RPG::Cache.title("badend")
else
if Graphics.width == 1280
@sprite.bitmap = RPG::Cache.title("normal_16")
else
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
end
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
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)
# check for debug file to add debug items
if Settings[:debug]
$game_party.gain_item(54, 1) # debug save
$game_party.gain_item(82, 1) # plight skip
$game_party.gain_item(81, 1) # George reroler
end
RPG::Mod.exec_hooks("hooks/Scene_Title/init", binding)
# check for debug file to add debug items
if Settings[:debug]
$game_party.gain_item(54, 1) # debug save
$game_party.gain_item(82, 1) # plight skip
$game_party.gain_item(81, 1) # George reroler
end
@sprite.zoom_x = 2.0
@sprite.zoom_y = 2.0
# Create/render menu options
@menu = Sprite.new
@menu = Sprite.new(@viewport)
@menu.z += 1
@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 + 25, 150, 24, tr("Settings"))
@menu.bitmap.draw_text(MENU_X, MENU_Y + 50, 150, 24, tr("Exit"))
if Settings[:debug_text_scene_title]
@debug = Sprite.new
@debug.z += @menu.z
@debug.bitmap = Bitmap.new(Graphics.width, Graphics.height)
@debug.bitmap.draw_text(5, 5, 200, 20, tr("Ruby #{RUBY_VERSION}"))
@debug.bitmap.draw_text(5, 25, 200, 20, tr("SDL #{SDLVer}"))
@debug.bitmap.draw_text(5, 45, 200, 20, tr("Sunshine #{SunshineVer}"))
@debug.bitmap.draw_text(5, 65, 200, 20, tr("sec_#{Sunshine::SECURITYSTATE}"))
if defined?(RubyVM::YJIT)
if RubyVM::YJIT.enabled?
@debug.bitmap.draw_text(5, 85, 200, 20, tr("JIT: YJIT"))
end
elsif defined?(RubyVM::ZJIT)
if RubyVM::ZJIT.enabled?
@debug.bitmap.draw_text(5, 85, 200, 20, tr("JIT: ZJIT"))
end
elsif defined?(RubyVM::RJIT)
if RubyVM::RJIT.enabled?
@debug.bitmap.draw_text(5, 85, 200, 20, tr("JIT: RJIT"))
end
else
@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
@debug = Sprite.new(@viewport)
@debug.z += 1
@debug.visible = Settings[:debug_text_scene_title] || false
@debug.bitmap = Bitmap.new(Graphics.width, Graphics.height)
@debug.bitmap.draw_text(5, 5, 200, 20, tr("Ruby #{RUBY_VERSION}"))
@debug.bitmap.draw_text(5, 25, 200, 20, tr("SDL #{SDLVer}"))
@debug.bitmap.draw_text(5, 45, 200, 20, tr("Sunshine #{SunshineVer}"))
@debug.bitmap.draw_text(5, 65, 200, 20, tr("sec_#{Sunshine::SECURITYSTATE}"))
jit_text = "JIT: unsupported"
if defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled?
jit_text = "JIT: YJIT"
elsif defined?(RubyVM::ZJIT) && RubyVM::ZJIT.enabled?
jit_text = "JIT: ZJIT"
elsif defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled?
jit_text = "JIT: RJIT"
end
@debug.bitmap.draw_text(5, 85, 200, 20, tr(jit_text))
if ModLoader::IS_ENABLED
@debug.bitmap.draw_text(5, 65, 200, 20, tr("Mods loaded: #{ModLoader::COUNT}"))
end
if $game_switches[160] && $game_switches[152]
@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)
# Make cursor graphic
@cursor = Sprite.new
@cursor = Sprite.new(@viewport)
@cursor.zoom_x = @cursor.zoom_y = 2
@cursor.bitmap
@cursor.z += 2
@ -159,7 +151,10 @@ class Scene_Title
@menu.dispose
@cursor.bitmap.dispose
@cursor.dispose
@window_settings_title.dispose
@debug.bitmap.dispose
@debug.dispose
@viewport.dispose
@window_settings_title.dispose
Audio.bgm_fade(60)
Graphics.transition(60)
# Run automatic change for BGM and BGS set with map
@ -169,6 +164,8 @@ class Scene_Title
# * Frame Update
#--------------------------------------------------------------------------
def update
@debug.visible = Settings[:debug_text_scene_title] || false # if undefined don't render
# Handle cursor movement
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

View file

@ -39,7 +39,7 @@ class Sprite_Picture < Sprite
if @picture_name != ""
# Get picture graphic
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)
end
if @picture_name == "cg_desktop_no_effects"

View file

@ -11,8 +11,7 @@ class Window_Settings
@viewport.z = 9998
@bg = Sprite.new(@viewport)
@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.blend_type = 2
@bg.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0, 0, 0, 196))
@title = Sprite.new(@viewport)
@title.bitmap = Bitmap.new(320, 20)
@title.bitmap.font.size = 20