赞 | 0 |
VIP | 8 |
好人卡 | 27 |
积分 | 55 |
经验 | 41413 |
最后登录 | 2012-10-21 |
在线时间 | 833 小时 |
Lv4.逐梦者 弓箭手?剑兰
- 梦石
- 0
- 星屑
- 5519
- 在线时间
- 833 小时
- 注册时间
- 2010-11-17
- 帖子
- 1140
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 一箭烂YiJL 于 2011-10-12 22:03 编辑
0.序
这个是我的"伪 3D Map"在 v0.4 阶段的东西,如果认为不适合在这里发布,版主请移至 RGE 专区。
主要功能:弹出一个启动画面窗口(无框边位图,透明度)
支援格式:bmp,而且不能透明背景(VX/XP 可以先加载至 Bitmap 类,再存为 bmp 或者制作 hBitmap 结构)
(RGE 最适合使用)
1.开始
图(伪3D Map):
经过序的介绍后,就要说如何应用。专门给脚本加载过长的游戏使用。
RGE:在 main RGE.init (生成主窗口)的游戏,在最前放进脚本页。
VX/XP:先要给 Game.exe 去掉 ShowWindow(反汇编),然后在最前放进脚本页,以及自己在 main 调用ShowWindow。ps2:XP 请有心人帮助弄范例(而且尤其关注 XP 编码(转换))。
ps3:请放置 Splash.bmp!
在每一个加载阶段也可以切换窗口文字(内容),例如脚本页:
Splash (启动画面脚本) | 操作:Splash.redraw("正在就加载精灵类") |
| ▼ Sprite | 。。。。。。(精灵类父类) | | 操作:Splash.redraw("正在就加载游戏物件") |
| ▼ 游戏物件 | 。。。。。。(游戏物件) |
| 操作:Splash.release(结束启动画面) | mian |
2.脚本
- #==============================================================================
- # ■ Splash by YiJL
- #------------------------------------------------------------------------------
- # 启动画面。
- #
- # - Splash.init
- # 初始化
- #
- # - Splash.redraw(str)
- # 改变显示文字
- #
- # - Splash.release
- # 释放窗口
- #
- #==============================================================================
- module Splash
- #--------------------------------------------------------------------------
- # ● Win32API
- #--------------------------------------------------------------------------
- M2W = Win32API.new("kernel32", "MultiByteToWideChar", "ilpipi" , "i")
- CreateWindowEx = Win32API.new("user32", "CreateWindowExW", "lpplllllllll", "l")
- ShowWindow = Win32API.new("user32", "ShowWindow", "ll", "l")
- LoadImage = Win32API.new("user32", "LoadImageW", "lpllll", "l")
- GetCurrentProcess = Win32API.new("kernel32", "GetCurrentProcess", "v", "l")
- SelectObject = Win32API.new("gdi32", "SelectObject", "ll", "l")
- DeleteObject = Win32API.new("gdi32", "DeleteObject", "l", "l")
- GetDC = Win32API.new("user32", "GetDC", "l", "l")
- ReleaseDC = Win32API.new("user32", "ReleaseDC", "ll", "l")
- DestroyWindow = Win32API.new("user32", "DestroyWindow", "l", "l")
- GetSystemMetrics = Win32API.new("user32", "GetSystemMetrics", "l", "l")
- TextOut = Win32API.new("gdi32", "TextOutW", "lllpl", "l")
- CreatePatternBrush = Win32API.new("gdi32", "CreatePatternBrush", "l", "l")
- CreateFont = Win32API.new("gdi32", "CreateFontW", "lllllllllllllp", "l")
- FillRect = Win32API.new("user32", "FillRect", "lpl", "l")
- SetBkMode = Win32API.new("gdi32", "SetBkMode", "ll", "l")
- Sleep = Win32API.new("kernel32", "Sleep", "l", "v")
- SetLWndAttri = Win32API.new("user32", "SetLayeredWindowAttributes", "llll", "l")
- PeekMessage = Win32API.new("user32", "PeekMessageW", "pllll", "l")
- #--------------------------------------------------------------------------
- # ● 常量
- #--------------------------------------------------------------------------
- BMPW = 600 # 位图长度
- BMPH = 360 # 位图高度
- BMPP = "Splash.bmp" # 位图路径
- FONT = "Microsoft YaHei" # 显示字体
- WAIT = 1 # 等待时间(s)
- TXTX = 30 # 字体显示 x 坐标
- TXTY = 210 # 字体显示 y 坐标
- FNTS = 24 # 字体大小
- #--------------------------------------------------------------------------
- # ● 初始化
- #--------------------------------------------------------------------------
- def self.init
- if @hSplashWnd.nil?
- hInstance = GetCurrentProcess.call
- @hSplashWnd = CreateWindowEx.call(0x80000, wchar("#32771"), wchar("Splash"),
- 0x80000000, (GetSystemMetrics.call(0) - BMPW) / 2,
- (GetSystemMetrics.call(1) - BMPH) / 2, BMPW, BMPH, 0, 0, hInstance, 0)
- ShowWindow.call(@hSplashWnd, 1)
- SetLWndAttri.call(@hSplashWnd, 0, 220, 2)
- hDC = GetDC.call(@hSplashWnd)
- @hBitmap = LoadImage.call(hInstance, wchar(BMPP), 0, BMPW, BMPH, 0x10)
- @hFont = CreateFont.call(FNTS, 0, 0, 0, 400, 0, 0, 0, 0, 0, 0, 0, 0, wchar(FONT))
- @hBrush = CreatePatternBrush.call(@hBitmap)
- FillRect.call(hDC, [0, 0, BMPW, BMPH].pack("l*"), @hBrush)
- SetBkMode.call(hDC, 1)
- SelectObject.call(hDC, @hFont)
- str = " "
- TextOut.call(hDC, TXTX, TXTY, wchar(str), str.split(//u).size)
- ReleaseDC.call(@hSplashWnd, hDC)
- msg = " " * 28
- time = Time.now
- while Time.now - time < WAIT
- # 防止无响应
- PeekMessage.call(msg, @hSplashWnd, 0, 0, 0)
- Sleep.call(500)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 重画
- #--------------------------------------------------------------------------
- def self.redraw(str)
- unless @hSplashWnd.nil?
- hDC = GetDC.call(@hSplashWnd)
- FillRect.call(hDC, [0, 0, BMPW, BMPH].pack("l*"), @hBrush)
- SetBkMode.call(hDC, 1)
- SelectObject.call(hDC, @hFont)
- TextOut.call(hDC, TXTX, TXTY, wchar(str), str.split(//u).size)
- ReleaseDC.call(@hSplashWnd, hDC)
- msg = " " * 28
- time = Time.now
- while Time.now - time < WAIT
- # 防止无响应
- PeekMessage.call(msg, @hSplashWnd, 0, 0, 0)
- Sleep.call(500)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def self.release
- unless @hSplashWnd.nil?
- DeleteObject.call(@hFont)
- DeleteObject.call(@hBitmap)
- DeleteObject.call(@hBrush)
- DestroyWindow.call(@hSplashWnd)
- hSplashWnd = nil
- end
- end
- #--------------------------------------------------------------------------
- # ● unicode 编码
- #--------------------------------------------------------------------------
- def self.wchar(str)
- length = M2W.call(65001, 0, str, -1, 0, 0) << 1
- buffer = " " * length
- M2W.call(65001, 0, str, -1, buffer, length)
- return buffer
- end
- end
- Splash.init
复制代码 3.范例
VX:
启动画面.zip
(948.11 KB, 下载次数: 2152)
(感谢月夜神音的编辑支援)
XP:waiting for 有心人中。。
|
评分
-
查看全部评分
|