[SOLVED] Change Window size without changin Game size

● ARCHIVED · READ-ONLY
Started by Argami 15 posts View original ↗
  1. 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:
    Spoiler
    h9QOSeZ.png

    And I want it to look like this:
    Spoiler
    61EkVdL.png

    Thanks in advance! :)
  2. 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
  3. @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 :(
  4. 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.
  5. 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.
  6. 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:
    Spoiler
    rAdeuob.png

    Is any way to solve it?
  7. 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.
  8. 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.
  9. TheoAllen said:
    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.
  10. Roninator2 said:
    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.
  11. TheoAllen said:
    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.
  12. 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?
  13. I would say you would do it by event. Do a show picture and don't erase it.
  14. I found it!
    I placed this line in Scene_Title so it starts every time you run the game:
    Spoiler
    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*
  15. 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.