赞 | 1 |
VIP | 246 |
好人卡 | 87 |
积分 | 1 |
经验 | 34142 |
最后登录 | 2015-1-15 |
在线时间 | 323 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 55
- 在线时间
- 323 小时
- 注册时间
- 2010-8-21
- 帖子
- 666
|
本帖最后由 沙漠点灰 于 2011-3-13 17:24 编辑
回复 纸飞机哟 的帖子
我又来了,只不过这次带了东西....
下面代码置顶- def Graphics.zoom=(zomm)
- $zoom = zomm
- $myfirst = 'myGod'
- 宽度=(640*$zoom).to_i
- 高度=(480*$zoom).to_i
- 游戏ini名=".\\Game.ini"
- val = "\0"*256
- gps = Win32API.new('kernel32', 'GetPrivateProfileString','pppplp', 'l')
- gps.call("Game", "Title", "", val, 256, 游戏ini名)
- val.delete!("\0")
- title = val
- fw = Win32API.new('user32', 'FindWindow', 'pp', 'i')
- hWnd = fw.call("RGSS Player", title)
- swp = Win32API.new('user32', 'SetWindowPos', 'lliiiii', 'i')
- pointwds = [0,0,0,0].pack('llll')
- pointcet = [0, 0].pack('ll')
- wdsrect = Win32API.new('user32.dll', 'GetWindowRect', 'lp', 'l')
- client_screen = Win32API.new("user32", "ClientToScreen", 'ip', 'i')
- wdsrect.call(hWnd,pointwds)
- client_screen.call(hWnd, pointcet)
- wds = pointwds.unpack('llll')
- cet = pointcet.unpack('ll')
- addw = wds[2] - wds[0] - 640
- addh = wds[3] - wds[1] - 480
- x = wds[0] - (宽度 - 640) / 2
- y = wds[1] - (高度 - 480) / 2
- swp.call(hWnd, 0, x, y, 宽度 + addw, 高度 + addh, 0x20)
-
- end
复制代码 下面的代码还是置顶,只不过在上面代码的下面- Graphics.zoom=(1.2)
- # 平面类
- class Plane
- # X放大率
- alias dust_zoom_x= zoom_x=
- def zoom_x=(zoom_x_o)
- zoom_x_o *= $zoom
- self.dust_zoom_x=(zoom_x_o)
- end
- # Y放大率
- alias dust_zoom_y= zoom_y=
- def zoom_y=(zoom_y_o)
- zoom_y_o *= $zoom
- self.dust_zoom_y=(zoom_y_o)
- end
- # oX
- alias dust_ox= ox=
- def ox=(ox_o)
- ox_o *= $zoom
- self.dust_ox= ox_o
- end
- # oY
- alias dust_oy= oy=
- def oy=(oy_o)
- oy_o *= $zoom
- self.dust_oy= oy_o
- end
- end
- # 矩形
- class Rect
- alias dust_initialize initialize
- def initialize(x, y, width, height)
- x *= $zoom
- y *= $zoom
- width *= $zoom
- height*= $zoom
- dust_initialize(x, y, width, height)
- end
- end
- # 位图类
- class Bitmap
- alias dust_initialize initialize
- def initialize(width, height=0)
- if width.is_a?(Integer) or width.is_a?(Float)
- width *= $zoom
- height*= $zoom
- dust_initialize(width, height)
- else
- dust_initialize(width)
- end
- end
- alias dust_draw_text draw_text
- def draw_text(x, y, width=0, height=0, str="", align=0)
- if x.is_a?(Rect)
- self.dust_draw_text(x,y,width)
- else
- x *= $zoom
- y *= $zoom
- width *= $zoom
- height*= $zoom
- self.dust_draw_text(x, y, width, height, str, align)
- end
- end
- end
- # 字体类
- class Font
- alias dust_size= size=
- def size=(size_o)
- size_o *= $zoom
- self.dust_size= size_o
- end
- end
- # 窗口类
- class Window
- # X
- alias dust_x= x=
- def x=(x_o)
- x_o *= $zoom
- self.dust_x= x_o
- end
- # Y
- alias dust_y= y=
- def y=(y_o)
- y_o *= $zoom
- self.dust_y= y_o
- end
- # width
- alias dust_width= width=
- def width=(width_o)
- width_o *= $zoom
- self.dust_width= width_o
- end
- # height
- alias dust_height= height=
- def height=(height_o)
- height_o *= $zoom
- self.dust_height= height_o
- end
- # oX
- alias dust_ox= ox=
- def ox=(ox_o)
- ox_o *= $zoom
- self.dust_ox= ox_o
- end
- # oY
- alias dust_oy= oy=
- def oy=(oy_o)
- oy_o *= $zoom
- self.dust_oy= oy_o
- end
- end
- # 端口类
- class Viewport
- alias dust_initialize initialize
- def initialize(x, y, width, height)
- begin
- x *= $zoom
- y *= $zoom
- width *= $zoom
- height*= $zoom
- rescue
- print"不能按F12"
- exit
- end
- dust_initialize(x, y, width, height)
- end
- end
- # 雪碧类
- class Sprite
- # 初始化
- alias dust_initialize initialize
- def initialize(viewport=Viewport.new(0, 0, 640, 480))
- dust_initialize(viewport)
- self.zoom_x = 1.0
- self.zoom_y = 1.0
- self.x = 0
- self.y = 0
- self.ox = 0
- self.oy = 0
- end
- # X放大率
- alias dust_zoom_x= zoom_x=
- def zoom_x=(zoom_x_o)
- zoom_x_o *= $zoom
- self.dust_zoom_x=(zoom_x_o)
- end
- # Y放大率
- alias dust_zoom_y= zoom_y=
- def zoom_y=(zoom_y_o)
- zoom_y_o *= $zoom
- self.dust_zoom_y=(zoom_y_o)
- end
- # X
- alias dust_x= x=
- def x=(x_o)
- x_o *= $zoom
- self.dust_x= x_o
- end
- # Y
- alias dust_y= y=
- def y=(y_o)
- y_o *= $zoom
- self.dust_y= y_o
- end
- # oX
- alias dust_ox= ox=
- def ox=(ox_o)
- ox_o *= $zoom
- self.dust_ox= ox_o
- end
- # oY
- alias dust_oy= oy=
- def oy=(oy_o)
- oy_o *= $zoom
- self.dust_oy= oy_o
- end
- end
复制代码 第二个的第一行是放大率,这个脚本只能用一次
另外 Window_Selectable 中,所有的 32 改为 32 * $zoom
最后就是地图了,你知道怎么改吧....我就不改了,当然...放大率小于1.0时,不用改地图了,
大于1.0时才改(其实我不会放大地图,用stretch_blt之后,画面好壮观,马赛克....)
当然,很多bug(放大率小于1.0时,字被擦掉。。。)
附:工程 PS 按F12有惊喜
Project1.rar
(189.16 KB, 下载次数: 236)
|
|