1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <meta name="keywords" content="Simple Directmedia Layer SDL2.0">
7 <link rel="top" href="index.html" title="
\83z
\81[
\83\80">
8 <link rel="parent" href="ApiByCategory.html" title="1
\82Â
\8fã">
9 <title>
\97Í
\8ao
\83t
\83B
\81[
\83h
\83o
\83b
\83N</title>
12 <a href="index.html">
\96Ú
\8e\9f</a> - <a href="ApiByCategory.html">API(
\8b@
\94\
\95Ê)</a> -
\97Í
\8ao
\83t
\83B
\81[
\83h
\83o
\83b
\83N
14 <h1>
\97Í
\8ao
\83t
\83B
\81[
\83h
\83o
\83b
\83N</h1>
15 \83C
\83\93\83N
\83\8b\81[
\83h
\83t
\83@
\83C
\83\8b: <a href="https://github.com/libsdl-org/SDL/blob/main/include/SDL_haptic.h">SDL_haptic.h</a>
18 SDL
\83n
\83v
\83e
\83B
\83b
\83N
\83T
\83u
\83V
\83X
\83e
\83\80\82Í
\83n
\83v
\83e
\83B
\83b
\83N
\83f
\83o
\83C
\83X(
\97Í
\8ao
\91\95\92u)
\82ð
\88µ
\82¤.
21 \8aî
\96{
\93I
\82È
\8eg
\82¢
\95û
\82Í
\8e\9f\82Ì
\92Ê
\82è
\82Å
\82 \82é.
23 <li>
\83T
\83u
\83V
\83X
\83e
\83\80(SDL_INIT_HAPTIC)
\82ð
\8f\89\8aú
\89»
\82·
\82é
24 <li>
\83n
\83v
\83e
\83B
\83b
\83N
\83f
\83o
\83C
\83X
\82ð
\8aJ
\82
26 <li><a href="SDL_HapticOpen.html">SDL_HapticOpen()</a>
\82Å
\94Ô
\8d\86\82ð
\8ew
\92è
\82µ
\82Ä
\8aJ
\82
27 <li><a href="SDL_HapticOpenFromJoystick.html">SDL_HapticOpenFromJoystick()</a>
\82Å
\83W
\83\87\83C
\83X
\83e
\83B
\83b
\83N
\82©
\82ç
\8aJ
\82
29 <li>
\8cø
\89Ê(<a href="SDL_HapticEffect.html">SDL_HapticEffect</a>)
\82ð
\90¶
\90¬
\82·
\82é
30 <li>
\8cø
\89Ê
\82ð<a href="SDL_HapticNewEffect.html">SDL_HapticNewEffect()</a>
\82Å
\83A
\83b
\83v
\83\8d\81[
\83h
\82·
\82é
31 <li>
\8cø
\89Ê
\82ð<a href="SDL_HapticRunEffect.html">SDL_HapticRunEffect()</a>
\82Å
\8dÄ
\90¶
\82·
\82é
32 <li>(
\94C
\88Ó)
\8cø
\89Ê
\82ð<a href="SDL_HapticDestroyEffect.html">SDL_HapticDestroyEffect()</a>
\82Å
\89ð
\95ú
\82·
\82é
33 <li>
\83n
\83v
\83e
\83B
\83b
\83N
\83f
\83o
\83C
\83X
\82ð<a href="SDL_HapticClose.html">SDL_HapticClose()</a>
\82Å
\95Â
\82¶
\82é
36 <h2>
\83T
\83\93\83v
\83\8b\83R
\81[
\83h</h2>
37 <h3>
\90U
\93®
\82³
\82¹
\82é
\8aÈ
\92P
\82È
\97á</h3>
43 //
\83f
\83o
\83C
\83X
\82ð
\8aJ
\82
44 haptic = SDL_HapticOpen( 0 );
48 //
\92P
\8f\83\82È
\90U
\93®
\82Å
\8f\89\8aú
\89»
\82·
\82é
49 if (SDL_HapticRumbleInit( haptic ) != 0)
52 // 50%
\82Ì
\8b
\82³
\82Å2
\95b
\8aÔ
\8dÄ
\90¶
\82·
\82é
53 if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0)
58 SDL_HapticClose( haptic );
62 <h3>
\8a®
\91S
\82È
\83R
\81[
\83h</h3>
66 int test_haptic( SDL_Joystick * joystick ) {
68 SDL_HapticEffect effect;
71 //
\83f
\83o
\83C
\83X
\82ð
\8aJ
\82
72 haptic = SDL_HapticOpenFromJoystick( joystick );
73 if (haptic == NULL) return -1; //
\83W
\83\87\83C
\83X
\83e
\83B
\83b
\83N
\82É
\83n
\83v
\83e
\83B
\83b
\83N
\82ª
\82È
\82¢
75 //
\83T
\83C
\83\93\94g
\82ª
\89Â
\94\
\82©
\92²
\82×
\82é
76 if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) {
77 SDL_HapticClose(haptic); //
\83T
\83C
\83\93\8cø
\89Ê
\82ª
\82È
\82¢
81 //
\8cø
\89Ê
\82ð
\90¶
\90¬
\82·
\82é
82 SDL_memset( &effect, 0, sizeof(SDL_HapticEffect) ); //
\88À
\91S
\82Ì
\82½
\82ß
\83f
\83t
\83H
\83\8b\83g
\82ð0
\82É
\82·
\82é
83 effect.type = SDL_HAPTIC_SINE;
84 effect.periodic.direction.type = SDL_HAPTIC_POLAR; //
\8bÉ
\8dÀ
\95W
\8cn
85 effect.periodic.direction.dir[0] = 18000; //
\8cø
\89Ê
\82Í
\93ì
\82©
\82ç
\97\88\82é
86 effect.periodic.period = 1000; // 1000
\83~
\83\8a\95b
87 effect.periodic.magnitude = 20000; // 20000/32767
\82Ì
\8b
\82³
88 effect.periodic.length = 5000; // 5
\95b
\8aÔ
89 effect.periodic.attack_length = 1000; // 1
\95b
\8aÔ
\82Å
\8dÅ
\91å
\82É
\92B
\82·
\82é
90 effect.periodic.fade_length = 1000; // 1
\95b
\8aÔ
\82Å
\92â
\8e~
\82·
\82é
92 //
\8cø
\89Ê
\82ð
\83A
\83b
\83v
\83\8d\81[
\83h
\82·
\82é
93 effect_id = SDL_HapticNewEffect( haptic, &effect );
95 //
\8cø
\89Ê
\82ð
\83e
\83X
\83g
\82·
\82é
96 SDL_HapticRunEffect( haptic, effect_id, 1 );
97 SDL_Delay( 5000); //
\8cø
\89Ê
\82ª
\8fI
\82í
\82é
\82Ü
\82Å
\91Ò
\82Â
99 //
\8cø
\89Ê
\82ð
\94j
\8aü
\82·
\82é.
\82±
\82ê
\82Í
\83f
\83o
\83C
\83X
\82ð
\95Â
\82¶
\82Ä
\82à
\8ds
\82í
\82ê
\82é
100 SDL_HapticDestroyEffect( haptic, effect_id );
102 //
\83f
\83o
\83C
\83X
\82ð
\95Â
\82¶
\82é
103 SDL_HapticClose(haptic);
105 return 0; //
\90¬
\8c÷
111 \82±
\82ÌEdgar Simo Serra
\82Ìblog
\82É
\82³
\82ç
\82È
\82é
\8fî
\95ñ
\82ª
\82 \82é: <a href="http://bobbens.dyndns.org/journal/2010/sdl_haptic/">SDL Haptic In Depth</a> (<a href="https://web.archive.org/web/20130728040700/http://bobbens.dyndns.org/journal/2010/sdl_haptic/">
\83A
\81[
\83J
\83C
\83u</a>)
113 <h2>
\8d\
\91¢
\91Ì</h2>
115 <li><a href="SDL_HapticCondition.html">SDL_HapticCondition</a></li>
116 <li><a href="SDL_HapticConstant.html">SDL_HapticConstant</a></li>
117 <li><a href="SDL_HapticCustom.html">SDL_HapticCustom</a></li>
118 <li><a href="SDL_HapticDirection.html">SDL_HapticDirection</a></li>
119 <li><a href="SDL_HapticEffect.html">SDL_HapticEffect</a></li>
120 <li><a href="SDL_HapticLeftRight.html">SDL_HapticLeftRight</a></li>
121 <li><a href="SDL_HapticPeriodic.html">SDL_HapticPeriodic</a></li>
122 <li><a href="SDL_HapticRamp.html">SDL_HapticRamp</a></li>
126 <li><a href="SDL_HapticClose.html">SDL_HapticClose</a></li>
127 <li><a href="SDL_HapticDestroyEffect.html">SDL_HapticDestroyEffect</a></li>
128 <li><a href="SDL_HapticEffectSupported.html">SDL_HapticEffectSupported</a></li>
129 <li><a href="SDL_HapticGetEffectStatus.html">SDL_HapticGetEffectStatus</a></li>
130 <li><a href="SDL_HapticIndex.html">SDL_HapticIndex</a></li>
131 <li><a href="SDL_HapticName.html">SDL_HapticName</a></li>
132 <li><a href="SDL_HapticNewEffect.html">SDL_HapticNewEffect</a></li>
133 <li><a href="SDL_HapticNumAxes.html">SDL_HapticNumAxes</a></li>
134 <li><a href="SDL_HapticNumEffects.html">SDL_HapticNumEffects</a></li>
135 <li><a href="SDL_HapticNumEffectsPlaying.html">SDL_HapticNumEffectsPlaying</a></li>
136 <li><a href="SDL_HapticOpen.html">SDL_HapticOpen</a></li>
137 <li><a href="SDL_HapticOpenFromJoystick.html">SDL_HapticOpenFromJoystick</a></li>
138 <li><a href="SDL_HapticOpenFromMouse.html">SDL_HapticOpenFromMouse</a></li>
139 <li><a href="SDL_HapticOpened.html">SDL_HapticOpened</a></li>
140 <li><a href="SDL_HapticPause.html">SDL_HapticPause</a></li>
141 <li><a href="SDL_HapticQuery.html">SDL_HapticQuery</a></li>
142 <li><a href="SDL_HapticRumbleInit.html">SDL_HapticRumbleInit</a></li>
143 <li><a href="SDL_HapticRumblePlay.html">SDL_HapticRumblePlay</a></li>
144 <li><a href="SDL_HapticRumbleStop.html">SDL_HapticRumbleStop</a></li>
145 <li><a href="SDL_HapticRumbleSupported.html">SDL_HapticRumbleSupported</a></li>
146 <li><a href="SDL_HapticRunEffect.html">SDL_HapticRunEffect</a></li>
147 <li><a href="SDL_HapticSetAutocenter.html">SDL_HapticSetAutocenter</a></li>
148 <li><a href="SDL_HapticSetGain.html">SDL_HapticSetGain</a></li>
149 <li><a href="SDL_HapticStopAll.html">SDL_HapticStopAll</a></li>
150 <li><a href="SDL_HapticStopEffect.html">SDL_HapticStopEffect</a></li>
151 <li><a href="SDL_HapticUnpause.html">SDL_HapticUnpause</a></li>
152 <li><a href="SDL_HapticUpdateEffect.html">SDL_HapticUpdateEffect</a></li>
153 <li><a href="SDL_JoystickIsHaptic.html">SDL_JoystickIsHaptic</a></li>
154 <li><a href="SDL_MouseIsHaptic.html">SDL_MouseIsHaptic</a></li>
155 <li><a href="SDL_NumHaptics.html">SDL_NumHaptics</a></li>
157 <h2>SDL Wiki
\82Ö
\82Ì
\83\8a\83\93\83N</h2>
158 <a href="https://wiki.libsdl.org/CategoryForceFeedback">Force Feedback Support - SDL Wiki</a>