Тема: IDirect3DDevice9
Показать сообщение отдельно

  #2  
Старый 27.02.2024, 01:38
Smeruxa
Познавший АНТИЧАТ
Регистрация: 27.11.2020
Сообщений: 1,431
С нами: 2874035

Репутация: 183


По умолчанию

2) chatgpt

C++:





Код:
#include 
void
DrawCircle
(
LPDIRECT3DDEVICE9 m_pDevice
,
int
X
,
int
Y
,
int
radius
,
D3DCOLOR color
)
{
const
int
numSegments
=
32
;
// You can adjust this for smoother or more segmented circles
const
float
angleIncrement
=
2.0f
*
D3DX_PI
/
numSegments
;
std
::
vector

rects
;
for
(
int
i
=
0
;
i

(
radius
*
std
::
cos
(
angle
)
)
;
float
y1
=
Y
+
static_cast

(
radius
*
std
::
sin
(
angle
)
)
;
float
x2
=
X
+
static_cast

(
radius
*
std
::
cos
(
angle
+
angleIncrement
)
)
;
float
y2
=
Y
+
static_cast

(
radius
*
std
::
sin
(
angle
+
angleIncrement
)
)
;
D3DRECT rect
=
{
static_cast

(
x1
)
,
static_cast

(
y1
)
,
static_cast

(
x2
)
,
static_cast

(
y2
)
}
;
rects
.
push_back
(
rect
)
;
}
m_pDevice
->
Clear
(
rects
.
size
(
)
,
rects
.
data
(
)
,
D3DCLEAR_TARGET
,
color
,
0
,
0
)
;
}
HRESULT WINAPI
myEndScene
(
IDirect3DDevice9
*
m_pDevice
)
{
// Draw a circle centered at (250, 250) with a radius of 10 and red color
DrawCircle
(
m_pDevice
,
250
,
250
,
10
,
0xFFFF0000
)
;
return
oEndScene
(
m_pDevice
)
;
}
 
Ответить с цитированием