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.

Ring-like based menu, 480x320, with RTP downsizes

Taylor

Sponsor

http://img98.imageshack.us/img98/3541/hellocmsbk1.png[/IMG]
Other scenes are downsized versions of RTP with my mentioned edits.

Here is the screen-size changer to help anyone fit it in. (You could use it too yourself, but give credit to Minkoff.)
Code:
#==============================================================================
# â–  Win32API
#------------------------------------------------------------------------------
# by Squall squall@loeher.znn.com
# Change the window size
# I must thank cybersam for his mouse and keyboard scripts. they were very
# useful finding some winapi function.
#
# combined all the 'needed things' and fixed the error due to windowsblinds
#                                                           ~ Jirbytaylor
#==============================================================================

class Win32API
 #--------------------------------------------------------------------------
 # - define constant
 #--------------------------------------------------------------------------
 GAME_INI_FILE = ".\\Game.ini"         # define "Game.ini" file
 HWND_TOPMOST = 1                      # window always active
 HWND_TOP = -1                         # window active when used only
 SWP_NOMOVE   = 1                      # 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 + 25, 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 = 480
 $height = 320
 win = Win32API.SetWindowPos($width, $height)
 if(win == 0)
   p "Size change has failed!"
 end

 #==============================================================================
# â–  Game_Player
#------------------------------------------------------------------------------
#  remade to be compatible with change sreen size script
#==============================================================================

class Game_Player < Game_Character
  CENTER_X = ($width/2 - 16) * 4    # X coordinate in the center of the screen
  CENTER_Y = ($height/2 - 16) * 4   # Y coordinate in the center of the screen
  #--------------------------------------------------------------------------
  # * Set Map Display Position to Center of Screen
  #--------------------------------------------------------------------------
  def center(x, y)
    max_x = ($game_map.width - 15) * 128
    max_y = ($game_map.height - 10) * 128
    $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max
    $game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max
  end
end


class Game_Map
 #--------------------------------------------------------------------------
# ● Scroll the map down
#     distance : Distance to scroll in real units (4 = 1 pixel).
#--------------------------------------------------------------------------
def scroll_down(distance)
if $height / 32.0 < self.height - 1
  @display_y = [@display_y + distance, (self.height - ($height / 32.0)) * 128].min
else
  @display_y = [@display_y + distance, (self.height - 15) * 128].min
end
end
#--------------------------------------------------------------------------
# ● Scroll the map left
#     distance : Distance to scroll in real units (4 = 1 pixel).
#--------------------------------------------------------------------------
def scroll_left(distance)
 @display_x = [@display_x - distance, 0].max
end
#--------------------------------------------------------------------------
# ● Scroll the map right
#     distance : Distance to scroll in real units (4 = 1 pixel).
#--------------------------------------------------------------------------
def scroll_right(distance)
if $width / 32.0 < self.width - 1
  @display_x = [@display_x + distance, (self.width - ($width / 32.0)) * 128].min
else
  @display_x = [@display_x + distance, (self.width - 20) * 128].min
end
end
#--------------------------------------------------------------------------
# ● Scroll the map up
#     distance : Distance to scroll in real units (4 = 1 pixel).
#--------------------------------------------------------------------------
def scroll_up(distance)
 @display_y = [@display_y - distance, 0].max
end
end

Much thanks in advance due to my patience with RGSS being past it's use by date. :P
 

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