Screen Resolution Script v0.4, RGSS2/RPG Maker VX |
|
|
|
|
Jan 15 2008, 06:01 AM
|

Storm Goddess

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

|
Screen ResolutionVersion 0.4 (beta) IntroductionThis 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) InstructionsSimply change the HEIGHT and WIDTH values to the height and width you want. Author's NotesFree 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.
__________________________

|
|
|
|
|
|
|
|
|
Jan 15 2008, 06:39 AM
|

HRRRRRRRRRRRRRRRRRNNNNNNG

Group: Revolutionary
Posts: 604
Type: None
RM Skill: Undisclosed

|
Hey, but Its our First VX script!  I think.
__________________________
BEARDS.ORG IT'S A SITE FOR BEARDS. THIS IS ALL YOU NEED TO KNOW.
|
|
|
|
|
|
|
|
|
Jan 16 2008, 03:04 PM
|

Level 2

Group: Member
Posts: 22
Type: Artist
RM Skill: Skilled

|
That's 2. Sorry, sometimes I lose my English ^^' . Here are links to screens: Screenshot 1Screenshot 2I will check once again but I'm sure I've done all you've written. EDiT: I did. ^^'
This post has been edited by TheJoan: Jan 16 2008, 03:08 PM
|
|
|
|
|
|
|
|
|
Jan 16 2008, 03:16 PM
|

Storm Goddess

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

|
Yup. The problem here doesn't seem to be my script. Unless it's not centering on the player? That would be a problem. The problem is that I don't do anything to rewrite the various scenes. If you're going to change the screen resolution, you will need to remodel the menu, battle, title, shop, etc scenes to fit inside your new window size. Especially if you're going smaller. I can't anticipate every possible screen resolution people might want.  Once I actually have a copy of VX, I can probably help you more. I may do a quick remodel for 3-4 screen sizes (probably GBA sized, PSP sized, and RMXP sized). But right now, I'm sort of shooting in the dark and I don't feel very comfortable writing things as big as menus without being able to test!  In general, though, you will have to make your windows smaller and probably either show less data per window or make your font smaller. Oh, and that gives me an idea for a contest...!
__________________________
|
|
|
|
|
|
|
|
|
Jan 17 2008, 08:17 PM
|

Level 68

Group: Revolutionary
Posts: 2,799
Type: Artist
RM Skill: Advanced

|
QUOTE (TheJoan @ Jan 17 2008, 08:41 AM)  That's 2. Sorry, sometimes I lose my English ^^' . Here are links to screens: Screenshot 1Screenshot 2I will check once again but I'm sure I've done all you've written. EDiT: I did. ^^' Yeah, it isn't ccoa's script. Like she said, you still have to change the menu and things. This goes for the title screen aswell. Just open up your script editor and go to "Scene_Title", and at about line 155/156 it says: CODE @command_window.x = (500 - @command_window.width) / 2 @command_window.y = 288 It won't be 500 for you, it'll be like 544 or something. I changed mine a little to test it. Just mess around the the x and y coordinates until your happy with where the Start, Continue and End box is. ;D I dunno how to do the menu or anything else though, I'll have a look.. but I know basically nothing about RGSS (Or RGSS2, obviously.), I'm just going off of common sense. Hope this helped. EDIT: [
This post has been edited by ember2inferno: Jan 18 2008, 04:13 AM
__________________________
|
|
|
|
|
|
|
|
|
Jan 17 2008, 11:13 PM
|
Level 10

Group: Revolutionary
Posts: 150
Type: Event Designer
RM Skill: Undisclosed

|
Gah, there's a limitation to resize_screen, and that is that 640x480 is the max you can use. Hopefully someone can get around this limitation.
|
|
|
|
|
|
|
|
|
Jan 18 2008, 05:12 PM
|

Level 2

Group: Member
Posts: 22
Type: Artist
RM Skill: Skilled

|
ember2inferno: Oh that's right, I forgot to check on the other scripts! Thank you! I'll check for a way to adjust the spriteset disposition on the map (my hero appear in the right-bottom corner, this really is too bad... ^^' ).
This post has been edited by TheJoan: Jan 18 2008, 05:15 PM
|
|
|
|
|
|
|
|
|
Jan 20 2008, 12:20 AM
|
Level 1

Group: Member
Posts: 5
Type: None
RM Skill: Undisclosed

|
This is a cool script. Keep up the good work.
Anyway, if you complete it, can you perhaps post a template?
|
|
|
|
|
|
|
|
|
Jan 27 2008, 01:13 PM
|

Level 5

Group: Member
Posts: 71
Type: Event Designer
RM Skill: Masterful

|
Hey guys, was just playing around with this script, i've got it so the player positions correctly into the middle of the screen, add this code after ccoa's and voila, there ya go  Here's the code: CODE class Game_Player < Game_Character def update_scroll ( last_real_x, last_real_y ) ax1 = $game_map.adjust_x(last_real_x) ay1 = $game_map.adjust_y(last_real_y) ax2 = $game_map.adjust_x(@real_x) ay2 = $game_map.adjust_y(@real_y) if ay2 > ay1 and ay2 > ( ( Graphics.height / 2 - 16 ) * 8 ) $game_map.scroll_down(ay2 - ay1) end if ax2 < ax1 and ax2 < ( ( Graphics.width / 2 - 16 ) * 8 ) $game_map.scroll_left(ax1 - ax2) end if ax2 > ax1 and ax2 > ( ( Graphics.width / 2 - 16 ) * 8 ) $game_map.scroll_right(ax2 - ax1) end if ay2 < ay1 and ay2 < ( ( Graphics.height / 2 - 16 ) * 8 ) $game_map.scroll_up(ay1 - ay2) end end def center ( x, y ) display_x = x * 256 - ( ( Graphics.width / 2 - 16 ) * 8 ) unless $game_map.loop_horizontal? max_x = ($game_map.width - 17) * 256 display_x = [0, [display_x, max_x].min].max end display_y = y * 256 - ( ( Graphics.height / 2 - 16 ) * 8 ) unless $game_map.loop_vertical? max_y = ($game_map.height - 13) * 256 display_y = [0, [display_y, max_y].min].max end $game_map.set_display_pos(display_x, display_y) end end
__________________________

|
|
|
|
|
|
|
|
|
Jan 28 2008, 03:13 PM
|
Level 10

Group: Revolutionary
Posts: 150
Type: Event Designer
RM Skill: Undisclosed

|
I didn't even notice that the player is not centered correctly, will have to go and fix that when I get home.
|
|
|
|
|
|
|
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
RPG RPG Revolution is an Privacy
Policy and Legal
|
|