XP 스크립트

Near Fantastica씨의 마우스 스크립트입니다.  일부 스크립트에서 이 것을 필요로 합니다.  물론 다른 마우스 입력 스크립트와 혼용불가입니다. 


#==============================================================================
# ** Mouse Input Module
#------------------------------------------------------------------------------
# Near Fantastica
# Version 5
# 01.03.06
#------------------------------------------------------------------------------
# This module defines mouse input
#==============================================================================

#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log("Mouse Input", "Near Fantastica", 5, "01.03.06")

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state("Mouse Input") == true

module Mouse
  @position
  GSM = Win32API.new('user32', 'GetSystemMetrics', 'i', 'i')
  Cursor_Pos= Win32API.new('user32', 'GetCursorPos', 'p', 'i')
  Scr2cli = Win32API.new('user32', 'ScreenToClient', %w(l p), 'i')
  Client_rect = Win32API.new('user32', 'GetClientRect', %w(l p), 'i')
  Readini = Win32API.new('kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l')
  Findwindow = Win32API.new('user32', 'FindWindowA', %w(p p), 'l')
  #-------------------------------------------------------------------------- 
  def Mouse.grid
    return nil if @pos == nil
    offsetx = $game_map.display_x / 4
    offsety = $game_map.display_y / 4
    x = (@pos[0] + offsetx) / 32
    y = (@pos[1] + offsety) / 32
    return [x, y]
  end
  #-------------------------------------------------------------------------- 
  def Mouse.position
    return @pos == nil ? [0, 0] : @pos
  end
  #-------------------------------------------------------------------------- 
  def Mouse.global_pos
    pos = [0, 0].pack('ll')
    if Cursor_Pos.call(pos) != 0
      return pos.unpack('ll')
    else
      return nil
    end
  end
  #-------------------------------------------------------------------------- 
  def Mouse.pos
    x, y = Mouse.screen_to_client(*Mouse.global_pos)
    width, height = Mouse.client_size
    begin
      if (x >= 0 and y >= 0 and x < width and y < height)
        return x, y
      else
        return nil
      end
    rescue
      return nil
    end
  end
  #-------------------------------------------------------------------------- 
  def Mouse.update
    @pos = Mouse.pos
  end
  #-------------------------------------------------------------------------- 
  def Mouse.screen_to_client(x, y)
    return nil unless x and y
    pos = [x, y].pack('ll')
    if Scr2cli.call(Mouse.hwnd, pos) != 0
      return pos.unpack('ll')
    else
      return nil
    end
  end
  #-------------------------------------------------------------------------- 
  def Mouse.hwnd
    game_name = "" * 256
    Readini.call('Game','Title','',game_name,255,".\Game.ini")
    game_name.delete!("")
    return Findwindow.call('RGSS Player',game_name)
  end
  #-------------------------------------------------------------------------- 
  def Mouse.client_size
    rect = [0, 0, 0, 0].pack('l4')
    Client_rect.call(Mouse.hwnd, rect)
    right, bottom = rect.unpack('l4')[2..3]
    return right, bottom
  end
end

#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end

Who's 백호

?

이상혁입니다.

http://elab.kr

Comment '2'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6159
801 이동 및 탈것 텔레포트 마나소비량 수정하기 3 지존!! 2010.07.22 1563
800 메뉴 새로운 메뉴 15 file 또라에몽 2010.07.17 5305
799 메뉴 메이플스토리처럼 메뉴를^^ 57 file 딸기님 2010.07.13 7142
798 기타 데이터베이스 자체 제한 해체 XP Ver. 13 THE풀잎 2010.07.04 2171
797 이동 및 탈것 8방향이동, Shift키 누르면 대쉬 63 WinHouse 2010.06.12 4025
796 [자작]게임내에서 필요한 파일 체크하기 / 디버깅 막기 17 file JACKY 2010.06.11 2509
795 메시지 말풍선 표시 스크립트 48 file insertend 2010.06.06 5161
794 타이틀/게임오버 타이틀을 아오오니처럼 만들어보자! 43 file Tassy 2010.06.02 5428
793 전투 [RTAB]HP/SH/EXP 게이지바 ver 1.00 44 file 환상 러브텔 2010.05.22 5339
792 기타 endroll 주석 번역 6 file insertend 2010.05.15 1638
791 타이틀/게임오버 [펌]색다른 게임오버 스크립트 14 file 또라에몽 2010.05.09 4265
790 이동 및 탈것 새로운 픽셀 이동 스크립트 27 file 케나이 2010.04.10 3496
789 전투 srpg용 스크립트라는데 4 세죠 2010.03.26 3524
788 온라인 게임화면을 전체화면으로 하기 27 file 이씨 2010.03.09 4053
787 전투 ABS_v3액션 알피지 46 file 알피지GM 2010.03.07 5806
786 저장 렉없은 자동 세이브 15 알피지GM 2010.03.07 2328
785 파티 KGC-대규모파티 25 rgnrk001 2010.03.01 3773
784 이동 및 탈것 아하! 그렇구나의 3D 신기술 체험 3 14 아하!잘봤어요. 2010.02.28 4258
783 이동 및 탈것 아하! 그렇구나의 3D 신기술 체험 2 23 아하!잘봤어요. 2010.02.28 3815
782 이동 및 탈것 아하! 그렇구나의 3D 신기술 체험 30 아하!잘봤어요. 2010.02.28 4772
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ... 52 Next
/ 52