Project1

标题: 请教如何整体放大画面? [打印本页]

作者: 文雅夕露    时间: 2018-12-5 23:07
标题: 请教如何整体放大画面?
在WOLF RPG Editor有一个功能是按某个键可以将窗口整体放大的。
比如原来的画面为640*480
按F5之后可以将游戏窗口调节到960*640
再F5之后可以将游戏窗口调节到1280*960
请问这种功能该在XP内怎么实现?
作者: 失落的乐章    时间: 2018-12-6 18:40
  1. module Input
  2.   
  3.   RES_KEY = Input::F5
  4.   HWND = Win32API.new('user32', 'GetActiveWindow', nil, 'l').call
  5.   SetWindowPos  = Win32API.new('user32', 'SetWindowPos', 'lliiiii', 'i')
  6.   GetSystemMetrics = Win32API.new('user32', 'GetSystemMetrics', 'i', 'i')
  7.   
  8.   @state = 0
  9.   
  10.   class << self
  11.     alias update_res update
  12.     def update
  13.       if Input.trigger?(RES_KEY)
  14.         case @state
  15.         when 0
  16.           @state = 1
  17.           set_window(960, 640)
  18.         when 1
  19.           @state = 2
  20.           set_window(1280, 960)
  21.         when 2
  22.           @state = 0
  23.           set_window(640, 480)
  24.         end
  25.       end
  26.       update_res
  27.     end
  28.   
  29.     def set_window(w, h)
  30.       x = (GetSystemMetrics.call(0) - w) / 2
  31.       y = (GetSystemMetrics.call(1) - h) / 2
  32.       h += GetSystemMetrics.call(4)
  33.       SetWindowPos.call(HWND, 0, x, y, w, h, 0x0020)
  34.     end
  35.   end
  36. end
复制代码


以上代码能更改窗口分辨率,但是无法同时拉伸窗口内容。
作者: 文雅夕露    时间: 2018-12-7 08:13
失落的乐章 发表于 2018-12-6 18:40
以上代码能更改窗口分辨率,但是无法同时拉伸窗口内容。

谢谢前辈的解答
但是这样做游戏内部的画面不会随之扩大耶
我想要的效果是游戏内部的图像等内容也随着窗口放大缩小
作者: soulsaga    时间: 2018-12-7 12:47
只找到可以放大RM窗口大小的工具..日文的..
https://forest.watch.impress.co.jp/docs/review/692097.html

shinkirou1262.zip

214.95 KB, 下载次数: 321


作者: 李时珍的皮    时间: 2018-12-8 18:27
失落的乐章 发表于 2018-12-6 18:40
以上代码能更改窗口分辨率,但是无法同时拉伸窗口内容。

前辈,如果想让玩家自己设置想要的分辨率大小,应该怎么弄呢?
作者: soulsaga    时间: 2018-12-8 20:15
李时珍的皮 发表于 2018-12-8 18:27
前辈,如果想让玩家自己设置想要的分辨率大小,应该怎么弄呢?


RUBY 代码复制
  1. module Input
  2.  
  3.   RES_KEY = Input::F5
  4.   HWND = Win32API.new('user32', 'GetActiveWindow', nil, 'l').call
  5.   SetWindowPos  = Win32API.new('user32', 'SetWindowPos', 'lliiiii', 'i')
  6.   GetSystemMetrics = Win32API.new('user32', 'GetSystemMetrics', 'i', 'i')
  7.  
  8.   @state = 0
  9.  
  10.   class << self
  11.     alias update_res update
  12.     def update
  13.           set_window($game_variables[x], $game_variables[y])
  14.       update_res
  15.     end
  16.  
  17.     def set_window(w, h)
  18.       x = (GetSystemMetrics.call(0) - w) / 2
  19.       y = (GetSystemMetrics.call(1) - h) / 2
  20.       h += GetSystemMetrics.call(4)
  21.       SetWindowPos.call(HWND, 0, x, y, w, h, 0x0020)
  22.     end
  23.   end
  24. end



改成这样不行吗?
作者: 精灵使者    时间: 2018-12-11 10:52
https://rpg.blue/forum.php?mod=viewthread&tid=321213
我找到了这个工具来着。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1