[SOLVED] Change Window size without changin Game size

Status
Not open for further replies.

Argami

Veteran
Veteran
Joined
Jun 22, 2012
Messages
130
Reaction score
10
First Language
Spanish
Primarily Uses
Hello!
I'm looking for a script to change the Window size without changing the Game size. I tink it will be more easy to understand with images.

Now my game looks like this:

And I want it to look like this:

Thanks in advance! :)
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,599
Reaction score
6,552
First Language
Indonesian
Primarily Uses
RMVXA
It looks like Yanfly Core Engine.
What you do, keep the map 17x13, but resize the window to 640x480. It will be centered. Unless you don't want your map in 17x13
 

Argami

Veteran
Veteran
Joined
Jun 22, 2012
Messages
130
Reaction score
10
First Language
Spanish
Primarily Uses
@TheoAllen In fact as you say I use sometimes maps bigger than 17x13. What I'm looking for is some way to change the size of the window arround but mantaining the 17x13 aspect (althought the maps are bigger) with the black border.
I don't know if I'm explaining myself clear... Sorry :(
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,669
Reaction score
566
First Language
English
Primarily Uses
RMVXA
I understand what you want, but I never seen a script that does that.
There is a full screen script by zues81, but you would only get the effect you want with it at full screen and the aspect lowered (F6)
In windowed mode, I have no idea.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,599
Reaction score
6,552
First Language
Indonesian
Primarily Uses
RMVXA
Technically, centering map viewport would be something like this. Assume you already resize the screen to 640x480
Code:
class Spriteset_Map
  alias vport create_viewports
  def create_viewports
    vport
    x = (Graphics.width - 544)/2
    y = (Graphics.height - 416)/2
    w = 544
    h = 416
    size = [x,y,w,h]
    @viewport1.rect.set(*size)
    @viewport2.rect.set(*size)
    @viewport3.rect.set(*size)
  end
end
May, or may not work. May or may not compatible with most of scripts that graphically add things on map like parallax / fog / whatever.
Can't test it right now, maybe some scripters out there can extend it.
 

Argami

Veteran
Veteran
Joined
Jun 22, 2012
Messages
130
Reaction score
10
First Language
Spanish
Primarily Uses
Almost there! But I have a little issue:
I added the following code to rezise the window (I tried with Yanfly Core Engine and it does the same thing):
Code:
Graphics.resize_screen(640, 480)
So now I have the effect that I want (Well, the text and menu windows fits the new screen size but I think I can solve it touching the scripts), the only problem now is that the Player doesn't appear centered in the screen. Here's the image, I added a grid so you can apreciate the problem:

Is any way to solve it?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,420
Reaction score
7,709
First Language
German
Primarily Uses
RMMV
not by using any form of zoom.

have you thought about a different approach:
make the maps and the screen size bigger, so that everything is regular with a larger screen but without the black borders.
and then add the black borders as a picture for hiding that part of your maps.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,528
Reaction score
14,259
First Language
English
Primarily Uses
RMVXA
640 x 480 will not let the player be centered, as the tile size is 32 so 640 / 32 = 20. So no matter what you will have half a tile on both edges, due to where the literal center is of that setup.

If you want centered you need to select an odd number of tiles in both directions, then multiply that by 32. Though be advised that will cause resizing issues with monitors, as the standard today is 4:3 16:9 or 16:10, and because of that when someone resizes your game it will probably not be centered anyways.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,669
Reaction score
566
First Language
English
Primarily Uses
RMVXA
May, or may not work
Does this make sense to you?
Code:
class Spriteset_Map
  alias vport create_viewports
  def create_viewports
    vport
    x = (Graphics.width - 544)/2
    y = (Graphics.height - 416)/2
    w = 544
    h = 416
    size = [x,y,w,h]
    @viewport1.rect.set(*size)
    @viewport2.rect.set(*size)
    @viewport3.rect.set(*size)
    @viewport1.ox = ((Graphics.width - 544) / 2)
    @viewport1.oy = ((Graphics.height - 416) / 2)
  end
end
class Game_Map
  #--------------------------------------------------------------------------
  # * Number of Horizontal Tiles on Screen
  #--------------------------------------------------------------------------
  def screen_tile_x
    544 / 32
  end
  #--------------------------------------------------------------------------
  # * Number of Vertical Tiles on Screen
  #--------------------------------------------------------------------------
  def screen_tile_y
    416 / 32
  end
end
I just can't get it to move the player x to the correct position.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,599
Reaction score
6,552
First Language
Indonesian
Primarily Uses
RMVXA
Does this make sense to you?
Code:
class Spriteset_Map
  alias vport create_viewports
  def create_viewports
    vport
    x = (Graphics.width - 544)/2
    y = (Graphics.height - 416)/2
    w = 544
    h = 416
    size = [x,y,w,h]
    @viewport1.rect.set(*size)
    @viewport2.rect.set(*size)
    @viewport3.rect.set(*size)
    @viewport1.ox = ((Graphics.width - 544) / 2)
    @viewport1.oy = ((Graphics.height - 416) / 2)
  end
end
class Game_Map
  #--------------------------------------------------------------------------
  # * Number of Horizontal Tiles on Screen
  #--------------------------------------------------------------------------
  def screen_tile_x
    544 / 32
  end
  #--------------------------------------------------------------------------
  # * Number of Vertical Tiles on Screen
  #--------------------------------------------------------------------------
  def screen_tile_y
    416 / 32
  end
end
I just can't get it to move the player x to the correct position.
Sounds about right, iirc the screen_tile_x/y was to determine if the map starts to scroll.
For sprite position, it should have something to do with screen_x and screen_y from Game_CharacterBase, maybe you can try to look at them.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,669
Reaction score
566
First Language
English
Primarily Uses
RMVXA
determine if the map starts to scroll.
I found that without that part the character would walk off the screen. If the map went to the edge of the screen. and the right side of the map was not visible (on my test map). But I just realized, like @bgillisp said, you need to set your maps to odd values. On an even map my code corrects for the off positioning.

Looking at Game_CharacterBase, I tried setting screen_x but that will change the position of all sprites on the map.

It makes sense to me that it would be Game_Map
set_display_pos(x, y)

but don't know what to change in there.

I Changed a value and it sets the position when loading the map, but the scroll now does not work for moving to the right.
It resets to the offset condition.

Edit* Gave up. If you change maps it stops the screen border resize. Goes back to full window.
 
Last edited:

Argami

Veteran
Veteran
Joined
Jun 22, 2012
Messages
130
Reaction score
10
First Language
Spanish
Primarily Uses
Guys! Don't worry, you tried your best! Thanks to all!
I'd like to be able to help you with scripting but for me it seems you're talking in chinese... :aswt:

I think @Andar suggested a nice alternative. So now I would like to find the way to show the "Black border" image since the beggining of the game and above the rest of images. There's a way to do it by script so I don't have to create any event?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,669
Reaction score
566
First Language
English
Primarily Uses
RMVXA
I would say you would do it by event. Do a show picture and don't erase it.
 

Argami

Veteran
Veteran
Joined
Jun 22, 2012
Messages
130
Reaction score
10
First Language
Spanish
Primarily Uses
I found it!
I placed this line in Scene_Title so it starts every time you run the game:
Code:
$game_map.screen.pictures[index].show(fName, placement, x, y, xZoom, yZoom, opacity, blend)

# fName - Also automatically searches files included in RGSS-RTP.
# File extensions may be omitted.
# placement - [0] Upper Left, [1] Center
# x - X value of image.
# y - Y value of image.
# xZoom - [100; Default] Horizontal scaling of image.
# yZoom - [100; Default] Vertical scaling of image.
# opacity - [255; Default] Opacity of image.
# blend - [0] Normal, [1] Add, [2] Sub

In my case I used the Image Index 101 so it appears above all the rest of the images.
Thanks again to all!

*I consider it solved*
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,861
Reaction score
5,238
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

This is relevant so much I can't even!
Frostorm wrote on Featherbrain's profile.
Hey, so what species are your raptors? Any of these?
... so here's my main characters running around inside "Headspace", a place people use as a safe place away from anxious/panic related thinking.
Stream will be live shortly! I will be doing some music tonight! Feel free to drop by!
Made transition effects for going inside or outside using zoom, pixi filter, and a shutter effect

Forum statistics

Threads
105,999
Messages
1,018,220
Members
137,778
Latest member
lifehoroscopee
Top