@@ -20,115 +20,64 @@ bool IsPushedOrHolded(int joystickIndex, Altseed2::JoystickButton btn, int count
2020 }
2121}
2222
23- // TODO
24- TEST (Joystick, SetLight) {
25- auto config = Altseed2TestConfig (Altseed2::CoreModules::Joystick);
26- EXPECT_TRUE (config != nullptr );
23+ // TEST(Joystick, SetLight) {
24+ // auto config = Altseed2TestConfig(Altseed2::CoreModules::Joystick);
25+ // EXPECT_TRUE(config != nullptr);
2726
28- EXPECT_TRUE (Altseed2::Core::Initialize (u" Joystick ButtonState" , 640 , 480 , config));
27+ // EXPECT_TRUE(Altseed2::Core::Initialize(u"Joystick ButtonState", 640, 480, config));
2928
30- float time = 0 .0f ;
29+ // float time = 0.0f;
3130
32- while (Altseed2::Core::GetInstance ()->DoEvent ()) {
33- int joystickIndex = 0 ;
31+ // while (Altseed2::Core::GetInstance()->DoEvent()) {
32+ // int joystickIndex = 0;
3433
35- float t = 0 .5f * std::sin (time) + 0 .5f ;
34+ // float t = 0.5f * std::sin(time) + 0.5f;
3635
37- int lightNumber = t * 15 ;
38- Altseed2::Joystick::GetInstance ()->SetLight (joystickIndex, lightNumber);
36+ // int lightNumber = t * 15;
37+ // Altseed2::Joystick::GetInstance()->SetLight(joystickIndex, lightNumber);
3938
40- time += Altseed2::Core::GetInstance ()->GetDeltaSecond ();
39+ // time += Altseed2::Core::GetInstance()->GetDeltaSecond();
4140
42- if (time > 10 .0f ) {
43- break ;
44- }
45- }
46- }
41+ // if (time > 10.0f) {
42+ // break;
43+ // }
44+ // }
4745
48- // TODO
49- TEST (Joystick, Vibrate) {
50- auto config = Altseed2TestConfig (Altseed2::CoreModules::Joystick);
51- EXPECT_TRUE (config != nullptr );
46+ // Altseed2::Core::Terminate();
47+ // }
5248
53- EXPECT_TRUE (Altseed2::Core::Initialize (u" Joystick ButtonState" , 640 , 480 , config));
49+ // TEST(Joystick, Vibrate) {
50+ // auto config = Altseed2TestConfig(Altseed2::CoreModules::Joystick);
51+ // EXPECT_TRUE(config != nullptr);
5452
55- float time = 0 . 0f ;
53+ // EXPECT_TRUE(Altseed2::Core::Initialize(u"Joystick ButtonState", 640, 480, config)) ;
5654
57- while (Altseed2::Core::GetInstance ()->DoEvent ()) {
58- int joystickIndex = 0 ;
59- float frequency = 150 .0f ;
60- float amplitude = 0 .8f ;
55+ // float time = 0.0f;
6156
62- float t = 0 .5f * std::sin (time) + 0 .5f ;
57+ // while (Altseed2::Core::GetInstance()->DoEvent()) {
58+ // int joystickIndex = 0;
59+ // float frequency = 150.0f;
60+ // float amplitude = 0.8f;
6361
64- if (time < 5 .0f ) {
65- amplitude *= t;
66- } else {
67- frequency *= t;
68- }
62+ // float t = 0.5f * std::sin(time) + 0.5f;
6963
70- Altseed2::Joystick::GetInstance ()->Vibrate (joystickIndex, frequency, amplitude);
64+ // if (time < 5.0f) {
65+ // amplitude *= t;
66+ // } else {
67+ // frequency *= t;
68+ // }
7169
72- time += Altseed2::Core ::GetInstance ()->GetDeltaSecond ( );
70+ // Altseed2::Joystick ::GetInstance()->Vibrate(joystickIndex, frequency, amplitude );
7371
74- if (time > 10 .0f ) {
75- break ;
76- }
77- }
72+ // time += Altseed2::Core::GetInstance()->GetDeltaSecond();
7873
79- // while (Altseed2::Core::GetInstance()->DoEvent()) {
80- // if (!vibrated && Altseed2::Joystick::GetInstance()->GetButtonStateByType(joystickIndex, Altseed2::JoystickButton::RightDown) == Altseed2::ButtonState::Push) {
81- // Altseed2::Joystick::GetInstance()->Vibrate(joystickIndex, frequency, amplitude);
82- // start = std::chrono::system_clock::now();
83- // vibrated = true;
84- // }
85-
86- // if (IsPushedOrHolded(joystickIndex, Altseed2::JoystickButton::RightRight, count)) {
87- // frequency += 10.0f;
88- // std::cout << "freq: " << frequency << std::endl;
89- // }
90-
91- // if (IsPushedOrHolded(joystickIndex, Altseed2::JoystickButton::RightDown, count)) {
92- // frequency -= 10.0f;
93- // std::cout << "freq: " << frequency << std::endl;
94- // }
95-
96- // if (IsPushedOrHolded(joystickIndex, Altseed2::JoystickButton::RightUp, count)) {
97- // amplitude += 0.05f;
98- // std::cout << "amp : " << amplitude << std::endl;
99- // }
100-
101- // if (IsPushedOrHolded(joystickIndex, Altseed2::JoystickButton::RightLeft, count)) {
102- // amplitude -= 0.05f;
103- // std::cout << "amp : " << amplitude << std::endl;
104- // }
105-
106- // if (IsPushedOrHolded(joystickIndex, Altseed2::JoystickButton::RightBumper, count)) {
107- // vibrate_time += 10.0f;
108- // std::cout << "time: " << vibrate_time << std::endl;
109- // }
110-
111- // if (IsPushedOrHolded(joystickIndex, Altseed2::JoystickButton::LeftBumper, count)) {
112- // vibrate_time -= 10.0f;
113- // std::cout << "time: " << vibrate_time << std::endl;
114- // }
115-
116- // if (vibrated && std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() >= vibrate_time) {
117- // Altseed2::Joystick::GetInstance()->Vibrate(joystickIndex, 100.0f, 0);
118- // vibrated = false;
119- // }
120-
121- // end = std::chrono::system_clock::now();
122- // count++;
123-
124- // time += Altseed2::Core::GetInstance()->GetDeltaSecond();
125- // if (time > 10.0f) {
126- // break;
127- // }
128- // }
74+ // if (time > 10.0f) {
75+ // break;
76+ // }
77+ // }
12978
130- Altseed2::Core::Terminate ();
131- }
79+ // Altseed2::Core::Terminate();
80+ // }
13281
13382void printJoystickInformation () {
13483 for (int i = 0 ; i < 16 ; i++) {
0 commit comments