0
ユーザーが大砲からボールを撃つゲームを開発すると考えられています。そのためには、大砲(矩形)を回転させて別の角度から撮影する必要があります。手伝っていただけませんか?x11/Cで矩形を回転させる方法
乾杯!
typedef struct _Cannon {
\t \t int x, y, w, h;
}Cannon;
typedef struct _Ball{
\t int itx, ity; //size
\t float ix, iy; //position
\t float vx, vy; //velocity
\t float gr; \t //gravity
}Ball;
Cannon cannon = {60, 400, 114, 33};
Ball ball = {
\t 0,0,
\t cannon.x+cannon.w*0.8,cannon.y+cannon.h/5,
\t 17.0, 0,
\t 0.3
\t };
XSetForeground(XApp->getDisplay(), GCAtr->getGC(),
GCAtr->getColor(2));
XFillRectangle(XApp->getDisplay(), XApp->getWindow(), GCAtr->getGC(),cannon.x,cannon.y,cannon.w,cannon.h);
void calculate()
{
\t double dt;
\t dt = XApp->getDifTime();
\t
\t //Calculates the position of the ball
\t ball.vy += ball.gr * dt;
\t ball.iy += ball.vy * dt;
\t ball.ix += ball.vx * dt;
}