Input
μ€ν¬λ¦½νΈ μλν°μ μμ¬(Matrials) μΉμ μλμ μλ‘μ΄ μ€ν¬λ¦½νΈ μΉΈμ μμ±νκ³ , μ€ν¬λ¦½νΈ λ³Έλ¬Έμ 볡μ¬νμ¬ μΆκ° μ½μ ν΄μ£ΌμκΈ° λ°λλλ€. μ€ν¬λ¦½νΈλ Main μμ μμ΄μΌ ν©λλ€.
- μ μ²΄ν€ μ λ ₯ μ§μ
- λ§μ°μ€ ν¬μΈν° νμ
- λ§μ°μ€ μ λ ₯
- μ€λ§νΈ λ¬΄λΈ κΈ°λ₯ (μλ μ΄λ)
- λ§μ°μ€ ν λ‘ μ€ν¬λ‘€ λ€μ΄ κ°λ₯
- λͺ©μ μ§ μ’ν νμ κΈ°λ₯
- μ λμ½λ μ²λ¦¬
νΉμ ν€κ° λλ¦° μνμΈμ§ 체ν¬ν©λλ€. μΈμ κ°μ λ¬Έμμ΄, μ¬λ³Ό, κ°μ ν€ μ½λ κ° μ€ νλλ₯Ό λ°μ΅λλ€. μλ₯Ό λ€λ©΄, μΈμ κ°μ 'A'λ₯Ό λκΈ°λ©΄ ν΄λΉ κ°μ ν€μ½λ κ° 65λ₯Ό 체ν¬ν©λλ€.
p "]" if Input.press?("]")
p "[" if Input.press?("[")
p ";" if Input.press?(";")
p '"' if Input.press?('"')
p ">" if Input.press?(">")
p "<" if Input.press?("<")
p "?" if Input.press?("?")
p "\\" if Input.press?("\\")
p "-" if Input.press?("-")
p "+" if Input.press?("+")
p "~" if Input.press?("~")
κ°μ ν€ μ½λ κ°μ μ«μ κ°μΌλ‘ μ§μ μ λ ₯νλ λ°©λ²λ μμ΅λλ€. ν€ μ½λ 221 μ μν ']' μ κ°μ΅λλ€.
p "]" if Input.trigger?(221)
μ¬λ³Όμ μ¬μ©ν κ²½μ°, λ€μ μ½λμ²λΌ μ¬μ©νλ©΄ λ©λλ€. 보μλ κ²μ²λΌ, μ¬λ³Όμ΄λΌλ 건 μ½λ‘ (:) λ¬Έμλ‘ μμν©λλ€.
p "backspace" if Input.press?(:VK_BACK)
λͺ¨λ κ°μ ν€ μ½λ κ°μ 164 νμ μ°Έκ³ νμΈμ.
Input.trigger?(Symbol)
Input.repeat?(Symbol)
Input.release?(Symbol)
Input.press?(Symbol)
Input.trigger?(String)
Input.repeat?(String)
Input.release?(String)
Input.press?(String)
Input.mouse_trigger?(0)
Input.mouse_trigger?(1)
Input.mouse_trigger?(2)
Input.mouse_release?(0)
Input.mouse_release?(1)
Input.mouse_release?(2)
Input.mouse_press?(0)
Input.mouse_press?(1)
Input.mouse_press?(2)
Input.mouse_x
Input.mouse_y
TouchInput.x
TouchInput.y
TouchInput.z # λ§μ°μ€ ν ; μμ(+)λ©΄ ν μ μλ‘ μ¬λ¦¬λ μ€. μμ(-)λ©΄ ν μ μλλ‘ λ΄λ¦¬λ μ€. κΈ°λ³Έ μνλ 0;
TouchInput.wheel # λ§μ°μ€ ν ; μμ(+)λ©΄ ν μ μλ‘ μ¬λ¦¬λ μ€. μμ(-)λ©΄ ν μ μλλ‘ λ΄λ¦¬λ μ€. κΈ°λ³Έ μνλ 0;
TouchInput.trigger?(:LEFT)
TouchInput.trigger?(:RIGHT)
TouchInput.trigger?(:MIDDLE)
TouchInput.press?(:LEFT)
TouchInput.press?(:RIGHT)
TouchInput.press?(:MIDDLE)
TouchInput.release?(:LEFT)
TouchInput.release?(:RIGHT)
TouchInput.release?(:MIDDLE)
λ³Έ μ€ν¬λ¦½νΈλ λ°λλΌ μνμ RPG Maker VX Aceμμ μ¬μ©νκΈ° μ ν©ν©λλ€. νμ§λ§ λ³Έ μ€ν¬λ¦½νΈλ Windows νλ«νΌ μ©μ΄κΈ° λλ¬Έμ μλμ°μ¦μμλ§ λμκ°λ©°, Ruby/SDL
κΈ°λ°μ λ€μ½ νλ μ΄μ΄
λ MKXP
μμ λμκ°λλ‘ μ€κ³λμ§ μμμ΅λλ€. λν λλΆλΆμ μ
λ ₯ μ€ν¬λ¦½νΈκ° λ§μ°μ€ μΌμͺ½ λ²νΌμ ν΄λ¦ν λ λ§μΉ κ²°μ ν€λ₯Ό λλ₯Έ κ²μ²λΌ μ·¨κΈμ νλλ°μ. μ΄ μ€ν¬λ¦½νΈλ ν΄λΉ μ€ν¬λ¦½νΈλ€μ²λΌ fake ν€λ₯Ό μ½μ
νλ μμΌλ‘ λμνμ§ μμ΅λλ€.
λ§μ°μ€ μ
λ ₯κ³Ό ν€λ³΄λ μ
λ ₯μ μ νν ꡬλΆλμ΄μΌ ν©λλ€. μλ₯Ό λ€λ©΄, Window_Selectable
μ λΆλͺ¨λ‘ κ°μ§κ³ μμ§ μμ Window
μμλ λ§μ°μ€ μΌμͺ½ λ²νΌ ν΄λ¦ μ¬λΆλ₯Ό κ²μ¬νκ³ μ ν λ TouchInput.trigger?(:LEFT)
λ TouchInput.press?(:LEFT)
λ±μ λ©μλλ₯Ό μ΄μ©νμ¬ μ§μ 체ν¬νμ¬μΌ ν©λλ€.
λν νκΈ μ λ ₯μ κ²½μ°, μ΄κ²μ νκΈ μ λ ₯ μ€ν¬λ¦½νΈκ° μλκΈ° λλ¬Έμ νκΈ μ λ ₯ μ€ν¬λ¦½νΈκ° ν¬ν¨λμ΄μμ§ μμ΅λλ€. νκΈ μ λ ₯μ κ²½μ°, λ³λμ μ λμ¨μ νμλ‘ ν©λλ€. νκΈ μ λ ₯μ κ²½μ°, DLLμ ν΅ν΄ Windowsκ° μ‘°ν©ν΄μ£Όλ νκΈ λ¬Έμλ₯Ό κ°μ Έμ€λ λ°©μμ μ¬μ©ν©λλ€.
Github RAW : RS_HangulNameInputProcessing.rb
DLL : RSEditHost.dll
μ΄λ κ² κ΅¬νν μ΄μ λ μμ΄, μ€κ΅μ΄, μΌλ³Έμ΄, μλμ΄ λ± μ¬λ¬κ°μ§ μΈμ΄λ₯Ό μ λ ₯ν μ μκ² νκΈ° μν¨μ΄λ©° νκΈ μ‘°ν©μ κ²½μ° λ§μ μΌμ΄μ€λ₯Ό νμλ‘ νλ©° κ½€ 볡μ‘ν©λλ€. κ°μΈμ μΌλ‘ ꡬνν΄λ³΄κΈ°λ νμ§λ§ νΉ λμ³ λ²λ¦° λ²κ·Έλ‘ μΈν΄ μ€μ κ²μμμ μ¬μ©νμ§ μμΌλ©° μ¬μ© μ νμ§ μ νλ‘ μ΄μ΄μ§ μ μκΈ° λλ¬Έμ λλ€.
μ€ν¬λ¦½νΈ : RS_Input.rb
Windowsμμ λ§μ°μ€μ Wheel κ°μ κ°μ Έ μ€λ €λ©΄, μ°½μ μμ±ν λ λ±λ‘λ μλμ° νλ‘μμ ν¨μλ₯Ό μλΈ ν΄λμ±νμ¬ ν κ°μ ν΄λΉνλ λ©μμ§λ₯Ό μ²λ¦¬ν΄μ κ°μ ΈμμΌ ν©λλ€. μ΄λ¬ν μμ μ λ³λμ DLL μμ΄λ μνν μλ μμΌλ 루λΉλ‘ ꡬννλ©΄ μ¬κ°ν μλ μ ν λ¬Έμ κ° μμ΅λλ€. λ°λΌμ λ§μ°μ€ ν κ°μ λ³λμ DLLμμ μ²λ¦¬ν©λλ€.
DLL (λ§μ°μ€ ν μ¬μ©) : RS- InputCore.dll
μΈμ¦ λ°μ§ μμ DLL νμΌμ κ²½μ°, μ μ± μ½λλ‘ μ€μ§νμ¬ λ°±μ μ΄ μμ νλ κ²½μ°κ° μ’ μ’ μμ΅λλ€. μΈμ¦μκ° λΉμΈκΈ° λλ¬Έμ λ³λλ‘ μΈμ¦μλ μμ΅λλ€. μ§μ λΉλν΄μ μ¬μ©νμλ €λ©΄ μλ λ§ν¬μ μλ λͺ¨λ νμΌμ λ°μ ν, Visual Studio 2015 μ΄μμμ RS-InputCore.sln νμΌμ μ€ννμ¬ Release λͺ¨λλ‘ λΉλλ₯Ό ν΄μ£ΌμκΈ° λ°λλλ€.
DLL μμ€ : λ§ν¬
λ§μ°μ€ ν κ° νλμ λ€μκ³Ό κ°μ΄ C++λ‘ μμ±λ μ½λμ΄λ©° μ½λκ° DLLλ‘ λΉλλκ³ , μ΅μ’
μ μΌλ‘ Input::RSGetWheelDelta.call
μ ν΅ν΄ κ°μ Έμ€κ² λ©λλ€.
LRESULT CALLBACK SuperProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_LBUTTONDOWN:
SetFocus(g_hRGSSPlayer);
break;
case WM_MOUSEWHEEL:
g_nWheelDelta = (SHORT(HIWORD(wParam)) > 0) ? 1 : -1;
break;
}
return CallWindowProc(OldProc, hWnd, uMsg, wParam, lParam);
}
λ§μ°μ€ ν μ μ¬μ©νκ³ μΆμ§ μμ κ²½μ°μ λν΄μλ μ νκΆμ΄ μμ΅λλ€. ν μ²λ¦¬λ₯Ό μ¬μ©νκ³ μΆμ§ μλ€λ©΄ λ³λλ‘ μ€ν¬λ¦½νΈλ₯Ό μμ νμ μΌ ν©λλ€.
# v1.0.0 (2018.10.29) - First Release.
# v1.0.1 (2018.10.29) :
# - Fixed the bug that causes an error when clicking the right button of the mouse.
# - Added the TouchInput feature that is the same as RPG Maker MV.
# - Fixed the issue that did not play the cursor sound when selecting the button using mouse
# v1.0.2 (2018.11.11)
# - Added the feature such as a path finding in RPG Maker MV
# - Added the destination sprite such as RPG Maker MV
# v1.0.3 (2019.01.20) :
# - Added the feature that can use the mouse wheel in the Save and Load scenes.
# v1.0.4 (2019.01.21) :
# - In the selectable window, Added the feature that can use the mouse wheel.
# v1.0.5 (2019.02.02) :
# - Added feature that can use the mouse left button in the Window_DebugRight
# v1.0.6 (2019.03.25) :
# - Added the repeat? method into Input class.
# v1.0.7 (2019.11.13) :
# - λ§μ°μ€ μΌμͺ½ ν΄λ¦μΌλ‘ λΉνμ μ νμΉν μ μμλ λ¬Έμ λ₯Ό μμ νμμ΅λλ€.
# - λͺ©μ μ§ μ€νλΌμ΄νΈλ₯Ό νλ©΄μμ κ°μΆ μ μλ κΈ°λ₯μ μΆκ°νμμ΅λλ€.
# - λΉνμ νμΉ ν, λ§μ°μ€ μλ μ΄λ μ ν μΉΈλ§ μμ§μ΄κ³ λ©μΆλ νμμ μμ νμμ΅λλ€.
# - TouchInput.updateλ₯Ό μΆκ°νμμ΅λλ€.
μμ μ μΈ κ²μ λ° λΉμμ μ μΈ κ²μμμ λͺ¨λ 무λ£λ‘ μ΄μ© κ°λ₯ν©λλ€.
λ¨, ν¬λ λ§μ λ¬λμλΉ
λλ biud436
μ κΈ°μ
ν΄μΌ ν©λλ€.
Lectures on Game Programming - λ§ν¬