搜索附件  

特效窗体外观.rar

 

给我们的游戏加点料--图片窗体:
我们见过的窗体一般是一个四四方方的,很有规矩的。
现在网游以及很多软件的窗口外观都不是规规矩矩的,让人感觉很有个性,
如果我们也能将RMXP中的窗口做成富有个性的外观,那不是一件很有趣的事吗,
其实这个窗体就是--图片窗体,可能大家还不太明白我说的是什么,那先上张图吧:

这是一款网游的登陆界面


这种窗体看上去多有趣啊,因此本人也仿造这个窗口,给我们的RMXP的窗口也加点料吧
这是我做好的效果图:

注意到上面的3个数字吗
你可以用鼠标试着点点,本人改变的是scene_title

主要的核心脚本:
  1. #--------------------------------------------------------------------------# ● 特效窗体# 制作者  小飞侠_shoed#---------------------------------------------------------------------------module Screen  #背景图,与窗口的大小相同  MASK_WIDTH = 459  MASK_HEIGHT = 329    IMAGE_BITMAP = 0  LR_LOADFROMFILE = 0x0010  LR_CREATEDIBSECTION = 0x2000  VBBLACK = 0x0  VBWHITE = 0xffffff  RGN_AND = 1  RGN_OR = 2  RGN_XOR = 3    GWL_STYLE      = (-16)             #窗口样式  GWL_WNDPROC    = (-4)  WS_POPUP       = 0x80000000   #弹出式窗口  WS_MAXIMIZEBOX = 0x00010000  WS_MINIMIZEBOX = 0x00020000  WS_CAPTION     = 0x00C00000  WS_BORDER      = 0x00800000  WS_DLGFRAME    = 0x00400000    WM_SYSCOMMAND = 0x0112  SC_MINIMIZE = 0xF020  WM_CLOSE = 0x0010    @readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'  @findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'   @getWindowRect=Win32API.new 'user32', 'GetWindowRect', %w(l p), 'l'  @loadImage=Win32API.new 'user32', 'LoadImageA', %w(l p l l l l), 'l'      @createCompatibleDC=Win32API.new 'gdi32', 'CreateCompatibleDC', %w(l), 'l'    #@createCompatibleBitmap=Win32API.new 'gdi32', 'CreateCompatibleBitmap', %w(l l l), 'l'  #@stretchBlt=Win32API.new 'gdi32', 'StretchBlt', %w(l l l l l l l l l l l), 'l'  @selectObject=Win32API.new 'gdi32', 'SelectObject', %w(l l), 'l'  @getPixel=Win32API.new 'gdi32', 'GetPixel', %w(l l l), 'l'    @createRectRgn=Win32API.new 'gdi32', 'CreateRectRgn', %w(l l l l), 'l'  @setWindowRgn=Win32API.new 'user32', 'SetWindowRgn', %w(l l i), 'l'  @combineRgn=Win32API.new 'gdi32', 'CombineRgn', %w(l l l l), 'l'    @deleteDC=Win32API.new 'gdi32', 'DeleteDC', %w(l), 'l'  @deleteObject=Win32API.new 'gdi32', 'DeleteObject', %w(l), 'l'  @getWindowLong=Win32API.new 'user32', 'GetWindowLongA', %w(l l), 'l'  @setWindowLong=Win32API.new 'user32', 'SetWindowLongA', %w(l l l), 'l'  @moveWindow=Win32API.new 'user32', 'MoveWindow', %w(l l l l l l), 'l'  #@defWindowProc=Win32API.new 'user32', 'DefWindowProcA', %w(l l l l), 'l'  #@callWindowProc=Win32API.new 'user32', 'CallWindowProcA', %w(l l l l l), 'l'    @getCursorPos = Win32API.new("user32", "GetCursorPos", 'p', 'i')  @screenToClient = Win32API.new("user32", "ScreenToClient", 'ip', 'i')  @getKeyState = Win32API.new("user32", "GetKeyState", 'i', 'i')    @sendMessage = Win32API.new("user32", "SendMessageA", 'l l l l', 'l')    module_function    def shape_window    @hwnd=handel        #原始窗口    rect=" "*16    @getWindowRect.call(@hwnd,rect)    left,top,right,bottom=rect.unpack("llll")    @x=left    @y=top    @width=right-left    @height=bottom-top            lStyle = @getWindowLong.call(@hwnd, GWL_STYLE)    lStyle = lStyle & ~WS_CAPTION        #@setWindowLong.call(@hwnd, GWL_WNDPROC, WindowProc)    @setWindowLong.call(@hwnd, GWL_STYLE, lStyle)            @moveWindow.call(@hwnd, @x,@y,MASK_WIDTH,MASK_HEIGHT,1);            hBitmap = @loadImage.call(0, ".\\Graphics\\Pictures\\window.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)    backDC = @createCompatibleDC.call(0)    @selectObject.call(backDC, hBitmap)        hRgn  = @createRectRgn.call(0, 0, MASK_WIDTH, MASK_HEIGHT)       for j in 0...MASK_HEIGHT      for i in 0...MASK_WIDTH        #主要是加快程序的速度,图片不是白色的大概区域        if j>=80 and j=15 and i 10000) then x = 0 end       if (y < 0) or (y > 10000) then y = 0 end       if x > 640 then x = 640 end       if y > 480 then y = 480 end       return x, y     else       return 0, 0     end   else     return 0, 0   end end  def mouse_press?    left_down = @getKeyState.call(0x01)    return left_down[7]  end    def min_window    @sendMessage.call(@hwnd,WM_SYSCOMMAND,SC_MINIMIZE,0)  end    def close_window    @sendMessage.call(@hwnd,WM_CLOSE,0,0)  end     # find the game window...  def handel    game_name = "\0" * 256    @readini.call('Game','Title','',game_name,255,".\\Game.ini")    game_name.delete!("\0")    return @findwindow.call('RGSS Player',game_name)  end    #def WindowProc  #  #endend复制代码
复制代码


我的图片都存在pictures中

工程:


             本帖来自P1论坛作者shoed,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=207649  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。

QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

GMT+8, 2024-9-21 16:46 , Processed in 0.037106 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

返回顶部