Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Screen Resolution + Map Size?

Im using this screen resolution script to change it to 720p resolution and im having troubles with the map fitting the resolution.
Im aware of the resolution script that stretches instead of changing and i dont want it.
Here is what it looks like if you were to use the script.
720p.png

Code:
#==============================================================================

# ■ Win32API

#------------------------------------------------------------------------------

# by Squall [email=squall@loeher.znn.com]squall@loeher.znn.com[/email]

# Change the window size

# I must thank cybersam for his mouse and keyboard scripts. they were very

# useful finding some winapi function.

#

# !! this script MUST be on top of all other or the game will crash,

#    if you use scripts to enlarge maps!

#==============================================================================

 

class Win32API

#--------------------------------------------------------------------------

# - define constant

#--------------------------------------------------------------------------

GAME_INI_FILE = ".\\Game.ini"         # define "Game.ini" file

HWND_TOPMOST = 0                      # window always active

HWND_TOP = -1                         # window active when used only

SWP_NOMOVE   = 0                      # window pos and sizes can be changed

#--------------------------------------------------------------------------

# - Win32API.GetPrivateProfileString // check your game title in Game.ini

#--------------------------------------------------------------------------

def Win32API.GetPrivateProfileString(section, key)

   val = "\0"*256

   gps = Win32API.new('kernel32', 'GetPrivateProfileString',%w(p p p p l p), 'l')

   gps.call(section, key, "", val, 256, GAME_INI_FILE)

   val.delete!("\0")

   return val

end

#--------------------------------------------------------------------------

# - Win32API.FindWindow // find the RGSS window

#--------------------------------------------------------------------------

def Win32API.FindWindow(class_name, title)

   fw = Win32API.new('user32', 'FindWindow', %(p, p), 'i')

   hWnd = fw.call(class_name, title)

   return hWnd

end

#--------------------------------------------------------------------------

# - Win32API.SetWindowPos // change window positions and sizes

#--------------------------------------------------------------------------

def Win32API.SetWindowPos(w, h)

   title =  Win32API.GetPrivateProfileString("Game", "Title")

   hWnd = Win32API.FindWindow("RGSS Player", title)

   swp = Win32API.new('user32', 'SetWindowPos', %(l, l, i, i, i, i, i), 'i')

   win = swp.call(hWnd, HWND_TOP, 240, 240, w + 6, h + 32, 0)

  

   #the line below makes the window on top of all others

   #win = swp.call(hWnd, HWND_TOPMOST, 0, 0, w + 6, h + 32, SWP_NOMOVE)

   return win

end

#--------------------------------------------------------------------------

# - Win32API.client_size // check the window width and height

#--------------------------------------------------------------------------

def Win32API.client_size

   title =  Win32API.GetPrivateProfileString("Game", "Title")

   hWnd = Win32API.FindWindow("RGSS Player", title)

   rect = [0, 0, 0, 0].pack('l4')

   Win32API.new('user32', 'GetClientRect', %w(l p), 'i').call(hWnd, rect)

   width, height = rect.unpack('l4')[2..3]

   return width, height

end

end

 

#==============================================================================

# - proceed with creation of the window

#------------------------------------------------------------------------------

# the width and height variables set the screen size.

#==============================================================================

$width = 1280

$height = 720

win = Win32API.SetWindowPos($width, $height)

if(win == 0)

   p "Size change has failed!"

end
I tried editing viewports in the Spriteset_Map but had nothing but fail.

What scripts would i need to change and what parts in order to see the map all the way and do scrolling correctly?

Thanks in advance.
 

Atoa

Member

The script you posted changes the resloution, but not the viewport.

Take a look on Spriset_Map and Spriteset_Battle and change the viewport values, it's probably (0, 0, 640, 480)
 
Selwyns resolution script (the one you're using, and the "stretch"-script as well, assuming my Custom Resolution Script) won't work beyond 640x480 pixels. You can't change this by simply editing viewports or the like.
I also can't point you to an existing system, as I'm not aware of one, however, I think I remember vgvgf doing something of the sort... and in general, I think I've seen it done... as I said though: Not with Selwyns script.
 
While screen resolution scripts will actually work with larger sized, you are forced to face issues related to movement, until you figure out how to define the center coordinates and bounds of a map for the new screen size. You'll also need a custom Tilemap, since the default one won't work properly in larger resolutions, and will not display all tiles on the extra portions of the screen.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top