Advertisement
FlipelyFlip

Option-Menu_Resolution (edited)

May 26th, 2024 (edited)
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.72 KB | None | 0 0
  1. class Window_SystemOptions < Window_Command
  2.  
  3.   def ok_enabled?
  4.     return true if [:to_title, :shutdown, :keySettings].include?(current_symbol)
  5.     return true if [:fitToScreen].include?(current_symbol)
  6.     return false
  7.   end
  8.  
  9.   def draw_resolution
  10.     rect = item_rect(1)
  11.     contents.clear_rect(rect)
  12.     name = Mewgles_SystemOptionsEdit::RESOLUTION_NAME
  13.     draw_text(0, rect.y, contents.width/2, line_height, name, 1)
  14.     dx = contents.width / 2
  15.     enabled = true
  16. #~     if Mewgles_SystemOptionsEdit::toggle_state == false
  17.       change_color(normal_color, enabled)
  18. #~     else
  19. #~       change_color(normal_color, !enabled)
  20. #~     end
  21.     indx = Mewgles_SystemOptionsEdit::resolution_index
  22.     option = Mewgles_SystemOptionsEdit::RESOLUTIONS[indx][0]
  23.     draw_text(dx, rect.y, contents.width/4, line_height, option, 1)
  24.   end
  25.  
  26.   def draw_fit_to_screen
  27.     rect = item_rect(2)
  28.     contents.clear_rect(rect)
  29. #~     if Mewgles_SystemOptionsEdit::toggle_state == false
  30.       change_color(normal_color, true)
  31. #~     else
  32. #~       change_color(normal_color, false)
  33. #~     end
  34.     name = Mewgles_SystemOptionsEdit::FIT_TO_SCREEN_NAME
  35.     draw_text(contents.width/4, rect.y, contents.width/2, line_height, name, 1)
  36.   end
  37.  
  38.   def change_screen_toggle(direction)
  39.     value = direction == :left ? false : true
  40.     ext = current_ext
  41. #~     if Mewgles_SystemOptionsEdit::toggle_state == false
  42.      
  43.       Mewgles_SystemOptionsEdit::fit_state = true
  44.       Mewgles_SystemOptionsEdit::toggle_state = !Mewgles_SystemOptionsEdit::toggle_state
  45. #~       Mewgles_SystemOptionsEdit::resolution_index = 0
  46.       draw_fit_to_screen
  47.       draw_resolution
  48. #~     else
  49. #~       Mewgles_SystemOptionsEdit::toggle_state = false
  50. #~       Mewgles_SystemOptionsEdit::resolution_index = 0
  51. #~       draw_fit_to_screen
  52. #~       draw_resolution
  53. #~     end
  54.     Graphics.toggle_fullscreen
  55.     Window_Resize.f
  56.     Sound.play_cursor
  57.     draw_item(index)
  58.   end
  59.  
  60.   def change_resolution(direction)
  61.     value = direction == :left ? false : true
  62.     ext = current_ext
  63. #~     if Mewgles_SystemOptionsEdit::toggle_state == false
  64.       maxlength = Mewgles_SystemOptionsEdit::RESOLUTIONS.length() - 2
  65.       if direction == :left && Mewgles_SystemOptionsEdit::resolution_index >= 0
  66.         Mewgles_SystemOptionsEdit::resolution_index -= 1
  67.       elsif direction == :left && Mewgles_SystemOptionsEdit::resolution_index < 0
  68.         Mewgles_SystemOptionsEdit::resolution_index = maxlength
  69.       end
  70.      
  71.       if direction == :right && Mewgles_SystemOptionsEdit::resolution_index <= maxlength
  72.         Mewgles_SystemOptionsEdit::resolution_index += 1
  73.       elsif direction == :right && Mewgles_SystemOptionsEdit::resolution_index > maxlength
  74.         Mewgles_SystemOptionsEdit::resolution_index = 0
  75.       end
  76.       index = Mewgles_SystemOptionsEdit::resolution_index
  77.  
  78.       Mewgles_SystemOptionsEdit::fit_state = false
  79.  
  80.       x = Mewgles_SystemOptionsEdit::RESOLUTIONS[index][1]
  81.       y = Mewgles_SystemOptionsEdit::RESOLUTIONS[index][2]
  82.       Window_Resize.r(x, y)
  83.       Sound.play_cursor
  84.       draw_resolution
  85. #~     else
  86. #~       Sound.play_buzzer
  87. #~     end
  88.   end
  89.    
  90. end
  91.  
  92. class Scene_System < Scene_MenuBase
  93.  
  94.   def command_fit_to_screen
  95. #~     if !Mewgles_SystemOptionsEdit::toggle_state
  96.       if !Mewgles_SystemOptionsEdit::fit_state
  97.         Window_Resize.f
  98.         Mewgles_SystemOptionsEdit::fit_state = true
  99.       else
  100.         index = Mewgles_SystemOptionsEdit::resolution_index
  101.         x = Mewgles_SystemOptionsEdit::RESOLUTIONS[index][1]
  102.         y = Mewgles_SystemOptionsEdit::RESOLUTIONS[index][2]
  103.         Window_Resize.r(x, y)
  104.         Mewgles_SystemOptionsEdit::fit_state = false
  105.       end
  106.       @command_window.activate
  107.   end
  108.  
  109. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement