Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> Screen Resolution Script v0.4, RGSS2/RPG Maker VX
ccoa
post Jan 15 2008, 06:01 AM
Post #1


Storm Goddess
Group Icon

Group: Revolutionary
Posts: 989
Type: Scripter
RM Skill: Masterful




Screen Resolution
Version 0.4 (beta)

Introduction

This is extremely simple, and not tested. But this will change the window size and what is displayed by the map. You will still need to remodel the menu and battle scenes to fit in the screen.

v0.3 - I've added code that will automatically center any windows if you up the screen resolution. Note that this will not work if you make the screen resolution smaller. If you want to turn off automatic centering, just find this:

CODE
WIDTH = 640
HEIGHT = 480
DELTA_WIDTH   = (WIDTH - 544).abs
DELTA_HEIGHT = (HEIGHT - 416).abs

class Game_Map
  def calc_parallax_x(bitmap)
    if bitmap == nil
      return 0
    elsif @parallax_loop_x
      return @parallax_x / 16
    elsif loop_horizontal?
      return 0
    else
      w1 = bitmap.width - WIDTH
      w2 = @map.width * 32 - WIDTH
      if w1 <= 0 or w2 <= 0
        return 0
      else
        return @parallax_x * w1 / w2 / 8
      end
    end
  end
end

class Spriteset_Map
  def create_viewports
    @viewport1 = Viewport.new(0, 0, WIDTH, HEIGHT)
    @viewport2 = Viewport.new(0, 0, WIDTH, HEIGHT)
    @viewport3 = Viewport.new(0, 0, WIDTH, HEIGHT)
    @viewport2.z = 50
    @viewport3.z = 100
  end
end

class Spriteset_Battle
  def create_viewports
    @viewport1 = Viewport.new(0, 0, WIDTH, HEIGHT)
    @viewport2 = Viewport.new(0, 0, WIDTH, HEIGHT)
    @viewport3 = Viewport.new(0, 0, WIDTH, HEIGHT)
    @viewport2.z = 50
    @viewport3.z = 100
  end
end

class Game_Player < Game_Character
  CENTER_X = (WIDTH / 2 - 16) * 8     # 画面中央の X 座標 * 8
  CENTER_Y = (HEIGHT / 2 - 16) * 8
end

class Sprite_Timer < Sprite
  def initialize(viewport)
    super(viewport)
    self.bitmap = Bitmap.new(88, 48)
    self.bitmap.font.name = "Arial"
    self.bitmap.font.size = 32
    self.x = WIDTH - self.bitmap.width
    self.y = 0
    self.z = 200
    update
  end
end

class Sprite_Base < Sprite
  def start_animation(animation, mirror = false)
    dispose_animation
    @animation = animation
    return if @animation == nil
    @animation_mirror = mirror
    @animation_duration = @animation.frame_max * 4 + 1
    load_animation_bitmap
    @animation_sprites = []
    if @animation.position != 3 or not @@animations.include?(animation)
      if @use_sprite
        for i in 0..15
          sprite = ::Sprite.new(viewport)
          sprite.visible = false
          @animation_sprites.push(sprite)
        end
        unless @@animations.include?(animation)
          @@animations.push(animation)
        end
      end
    end
    if @animation.position == 3
      if viewport == nil
        @animation_ox = WIDTH / 2
        @animation_oy = HEIGHT / 2
      else
        @animation_ox = viewport.rect.width / 2
        @animation_oy = viewport.rect.height / 2
      end
    else
      @animation_ox = x - ox + width / 2
      @animation_oy = y - oy + height / 2
      if @animation.position == 0
        @animation_oy -= height / 2
      elsif @animation.position == 2
        @animation_oy += height / 2
      end
    end
  end

end

class Window_Base < Window
  def x=(x)
    super(x + DELTA_WIDTH / 2)
  end
  
  def y=(y)
    super(y + DELTA_HEIGHT/ 2)
  end
end


class Scene_Battle < Scene_Base
  def create_info_viewport
    @info_viewport = Viewport.new(0, 288, WIDTH, HEIGHT)
    @info_viewport.z = 100
    @status_window = Window_BattleStatus.new
    @party_command_window = Window_PartyCommand.new
    @actor_command_window = Window_ActorCommand.new
    @status_window.viewport = @info_viewport
    @party_command_window.viewport = @info_viewport
    @actor_command_window.viewport = @info_viewport
    @status_window.x = 128
    @actor_command_window.x = 544
    @info_viewport.visible = false
  end
end

class Scene_Item < Scene_Base
   def start
    super
    create_menu_background
    @viewport = Viewport.new(0, 0, WIDTH, HEIGHT)
    @help_window = Window_Help.new
    @help_window.viewport = @viewport
    @item_window = Window_Item.new(0, 56, 544, 360)
    @item_window.help_window = @help_window
    @item_window.active = false
    @target_window = Window_MenuStatus.new(0,  0)
    hide_target_window
  end
  
  def show_target_window(right)
    @item_window.active = false
    width_remain = WIDTH - @target_window.width
    @target_window.x = right ? width_remain : 0
    @target_window.visible = true
    @target_window.active = true
    if right
      @viewport.rect.set(0, 0, width_remain, HEIGHT)
      @viewport.ox = 0
    else
      @viewport.rect.set(@target_window.width, 0, width_remain, HEIGHT)
      @viewport.ox = @target_window.width
    end
  end
  
  def hide_target_window
    @item_window.active = true
    @target_window.visible = false
    @target_window.active = false
    @viewport.rect.set(0, 0, WIDTH, HEIGHT)
    @viewport.ox = 0
  end
end

class Scene_Skill < Scene_Base
  def start
    super
    create_menu_background
    @actor = $game_party.members[@actor_index]
    @viewport = Viewport.new(0, 0, WIDTH, HEIGHT)
    @help_window = Window_Help.new
    @help_window.viewport = @viewport
    @status_window = Window_SkillStatus.new(0, 56, @actor)
    @status_window.viewport = @viewport
    @skill_window = Window_Skill.new(0, 112, 544, 304, @actor)
    @skill_window.viewport = @viewport
    @skill_window.help_window = @help_window
    @target_window = Window_MenuStatus.new(0, 0)
    hide_target_window
  end
  
  def show_target_window(right)
    @skill_window.active = false
    width_remain = WIDTH - @target_window.width
    @target_window.x = right ? width_remain : 0
    @target_window.visible = true
    @target_window.active = true
    if right
      @viewport.rect.set(0, 0, width_remain, HEIGHT)
      @viewport.ox = 0
    else
      @viewport.rect.set(@target_window.width, 0, width_remain, HEIGHT)
      @viewport.ox = @target_window.width
    end
  end

  def hide_target_window
    @skill_window.active = true
    @target_window.visible = false
    @target_window.active = false
    @viewport.rect.set(0, 0, WIDTH, HEIGHT)
    @viewport.ox = 0
  end
end


Then add this as the first line in Main:

CODE
  Graphics.resize_screen(WIDTH, HEIGHT)


Instructions

Simply change the HEIGHT and WIDTH values to the height and width you want.

Author's Notes

Free for noncommercial use. Please contact me for licensing options if you wish to use this commercially.

However, do not redistribute this script without permission. If you want to post it on a forum I am not active on, please link to this topic.


__________________________
Go to the top of the page
 
+Quote Post
   

Posts in this topic
- ccoa   Screen Resolution Script v0.4   Jan 15 2008, 06:01 AM
- - XxZiggitxX   Hey, but Its our First VX script! I think.   Jan 15 2008, 06:39 AM
- - ccoa   Possibly the first English VX script, period.   Jan 15 2008, 08:04 AM
- - darkkyros   Thanks ccoa! Glad to see VX scripts coming ou...   Jan 15 2008, 04:29 PM
- - ccoa   Okay, this update should make this script actually...   Jan 16 2008, 12:06 PM
- - TheJoan   Hello everyone, First of all, I want to greet you...   Jan 16 2008, 02:43 PM
- - ccoa   I'm not 100% sure I know what you're sayin...   Jan 16 2008, 02:55 PM
- - TheJoan   That's 2. Sorry, sometimes I lose my English ...   Jan 16 2008, 03:04 PM
- - ccoa   Yup. The problem here doesn't seem to be my s...   Jan 16 2008, 03:16 PM
|- - Ilikepie123   QUOTE (ccoa @ Jan 16 2008, 02:23 PM) Yup....   Mar 9 2008, 06:18 PM
- - Diedrupo   If anything, the screenshots prove the script work...   Jan 16 2008, 06:30 PM
- - ember2inferno   QUOTE (TheJoan @ Jan 17 2008, 08:41 AM) T...   Jan 17 2008, 08:17 PM
- - Diedrupo   Gah, there's a limitation to resize_screen, an...   Jan 17 2008, 11:13 PM
- - TheJoan   ember2inferno: Oh that's right, I forgot to c...   Jan 18 2008, 05:12 PM
- - Satosan   This is a cool script. Keep up the good work. Any...   Jan 20 2008, 12:20 AM
- - deadlydan   Hey guys, was just playing around with this script...   Jan 27 2008, 01:13 PM
- - ccoa   Why didn't someone tell me it wasn't cente...   Jan 28 2008, 06:32 AM
- - deadlydan   Well, the code isn't as correct as i thought i...   Jan 28 2008, 02:52 PM
- - Diedrupo   I didn't even notice that the player is not ce...   Jan 28 2008, 03:13 PM
- - ccoa   The latest update should fix it.   Jan 29 2008, 03:25 PM
- - deadlydan   Thanks for the update, you might want to know that...   Jan 30 2008, 04:39 AM
- - ccoa   Thanks. That's going to be a tricky one to fi...   Jan 30 2008, 05:55 AM
- - deadlydan   Well, i have some code i can share if you want, bu...   Jan 30 2008, 04:15 PM
- - Melkor Qc   About a week ago, I found a Resolution Script on a...   Jan 31 2008, 03:38 PM
|- - Dang_Khoa   QUOTE (Melkor Qc @ Feb 1 2008, 05:45 AM) ...   Feb 4 2008, 02:07 AM
|- - Diedrupo   QUOTE (Melkor Qc @ Jan 31 2008, 04:45 PM)...   Feb 4 2008, 10:12 AM
- - ccoa   ...Mine does that.   Feb 4 2008, 07:09 AM
- - dragonheartman   Wow, very nice script. The fact that RGSS2 allows ...   Feb 14 2008, 12:40 PM
- - ccoa   There's a screen resolution script for XP, too...   Feb 14 2008, 12:42 PM
- - Chipnyu   Now I haven't scripted in a while, but when I ...   Feb 19 2008, 12:14 PM
- - ccoa   Are you trying to use this in XP?   Feb 19 2008, 01:08 PM
- - Yuu   i thinks is a nice script but i am a noob =(...whe...   Feb 25 2008, 08:23 AM
- - ccoa   Insert a new section right before the section titl...   Feb 25 2008, 08:54 AM
- - Yuu   Oh thanks! ^^ and...i have this in my main: QU...   Feb 25 2008, 10:43 AM
- - ERZENGEL   After begin is the best place   Feb 25 2008, 10:50 AM
- - ccoa   No, no, no, no. Not in Main, above Main. Right c...   Feb 25 2008, 11:11 AM
- - Yuu   yeah i understand....its ok, works fine thank you ...   Feb 25 2008, 03:49 PM
- - MISTER BIG T   Can this make resolution larger, like 1280x1024?   Feb 26 2008, 09:48 AM
- - ccoa   According to people who have used it, it apparentl...   Feb 26 2008, 10:09 AM
- - Daray   First, sorry for my bad english. Location is Germa...   Feb 27 2008, 05:36 AM
- - ccoa   This is really getting too difficult to troublesho...   Feb 27 2008, 06:36 AM
|- - mikeDman1988   QUOTE (ccoa @ Feb 27 2008, 06:43 AM) This...   Mar 9 2008, 12:31 AM
- - Daray   No problem, just for better description i made two...   Feb 27 2008, 09:43 AM
- - Yuu   http://www.rpgrevolution.com/engine/rpg-ma...load/...   Feb 29 2008, 04:23 PM
- - ccoa   Impatient much? It was just freaking released yes...   Mar 1 2008, 07:22 AM
|- - Jediknightjace   QUOTE (ccoa @ Mar 1 2008, 09:29 AM) Impat...   Mar 4 2008, 11:38 AM
- - Daray   I hope you understood that right, like i said itīs...   Mar 1 2008, 01:28 PM
- - ccoa   First, it's not remotely funny, and second, hu...   Mar 4 2008, 01:02 PM
- - ccoa   I'm going to close this, since people can...   Mar 10 2008, 07:59 AM


Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 17th May 2013 - 10:47 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker