回答編集履歴
3
微修正
test
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
// escapeキーが押されるまで繰り返す
|
14
14
|
while( ProcessMessage() == 0 && CheckHitKey(KEY_INPUT_ESCAPE) == 0 ) {
|
15
15
|
++step;
|
16
|
-
float theta = step * (2*3.
|
16
|
+
float theta = step * (2*3.1416f/60); // 一回あたり 2π/60[rad]
|
17
17
|
int x = static_cast<int>(cosf(theta) * 100); // 使ってません
|
18
18
|
int y = static_cast<int>(sinf(theta) * 100);
|
19
19
|
ClearDrawScreen(); // 画面クリア
|
2
微修正
test
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
int x = static_cast<int>(cosf(theta) * 100); // 使ってません
|
18
18
|
int y = static_cast<int>(sinf(theta) * 100);
|
19
19
|
ClearDrawScreen(); // 画面クリア
|
20
|
-
|
20
|
+
DrawCircle(150, y+150, 50, GetColor(255,255,255), 0); // マル描いて
|
21
21
|
ScreenFlip(); // 表示
|
22
22
|
}
|
23
23
|
DxLib_End() ;
|
1
追記
test
CHANGED
@@ -1 +1,27 @@
|
|
1
1
|
60回で一回りなら 2π/60 では?
|
2
|
+
|
3
|
+
DxLibで書いてみた:
|
4
|
+
```C++
|
5
|
+
#include <cmath>
|
6
|
+
#include "DxLib.h"
|
7
|
+
|
8
|
+
int WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int) {
|
9
|
+
int step = 0;
|
10
|
+
|
11
|
+
if( DxLib_Init() == -1 ) { return -1; } // エラーが起きたら直ちに終了
|
12
|
+
SetDrawScreen( DX_SCREEN_BACK );
|
13
|
+
// escapeキーが押されるまで繰り返す
|
14
|
+
while( ProcessMessage() == 0 && CheckHitKey(KEY_INPUT_ESCAPE) == 0 ) {
|
15
|
+
++step;
|
16
|
+
float theta = step * (2*3.2426f/60); // 一回あたり 2π/60[rad]
|
17
|
+
int x = static_cast<int>(cosf(theta) * 100); // 使ってません
|
18
|
+
int y = static_cast<int>(sinf(theta) * 100);
|
19
|
+
ClearDrawScreen(); // 画面クリア
|
20
|
+
DrawCircle(150, y+150, 50, GetColor(255,255,255), 0); // マル描いて
|
21
|
+
ScreenFlip(); // 表示
|
22
|
+
}
|
23
|
+
DxLib_End() ;
|
24
|
+
return 0 ;
|
25
|
+
}
|
26
|
+
```
|
27
|
+
|