Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Author : 러닝은빛(biud436)
- # Date : 2015.05.10
- # Update : 2015.06.12
- module Message
- # 데이터 가져오기
- system = load_data("Data/System.rvdata2")
- Game_Title = system.game_title.to_s.clone
- system = nil
- # 게임 핸들 획득(ANSI)
- FindWindowA = Win32API.new('User32','FindWindowA','pp','l')
- # 메시지 함수
- GetMessage = Win32API.new('user32','GetMessage','plll','s')
- PeekMessage = Win32API.new('user32','PeekMessage','pllll','s')
- TranslateMessage = Win32API.new('user32','TranslateMessage','p','s')
- PM_REMOVE = 1
- PM_NOREMOVE = 0
- # 메시지 목록
- WM_KEYDOWN = 0x0100 #256
- WM_KEYUP = 0x0101 #257
- WM_CHAR = 0x0102 #258
- WM_MOUSEMOVE = 0x0200 # 512
- WM_LBUTTONDOWN = 0x0201 # 513
- # C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include\WinUser.h
- # 메시지 구조체
- MESSAGE = 1
- WPARAM = 2
- LPARAM = 3
- extend self
- # 윈도우 핸들
- def handle_a
- return FindWindowA.call("RGSS Player",Game_Title)
- end
- # 메시지 함수
- def result
- msg = [0,0,0,0,0].pack('lllll') + [0,0].pack('ll')
- GetMessage.call(msg,handle_a,0,0)
- TranslateMessage.call(msg)
- return msg
- end
- # 메시지 큐
- def msg_q
- return Message.result.unpack('llllll')
- end
- # 상위 16비트 추출
- def hiword(x)
- x >> 16
- end
- # 하위 16비트 추출
- def loword(x)
- x & 0xffff
- end
- # 메시지 처리
- def call_message
- case msg_q[MESSAGE]
- when WM_KEYDOWN
- return p "키를 눌렀습니다 : #{msg_q[WPARAM]}"
- when WM_KEYUP
- return p "키를 뗐습니다"
- when WM_MOUSEMOVE
- return p "마우스를 움직이고 있습니다"
- when WM_LBUTTONDOWN
- return p "왼쪽 마우스 버튼을 눌렀습니다"
- end
- end
- # 메시지 루프(프레임워크와 연결)
- def update
- return Message.call_message
- end
- end
- class Scene_Base
- #--------------------------------------------------------------------------
- # * Update Frame (Basic)
- #--------------------------------------------------------------------------
- def update_basic
- Graphics.update
- Input.update
- update_all_windows
- Message.update
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement