線で書いてあったのはサンプルであったのですが太さを調節したく四角形で書くことにしました。
しかし描画した時四角形の形が歪になってしまうのですが式が良く出来ていないみたいです。
#include "DxLib.h"
#include <math.h>
#define PI 3.14159265
#define MIN_ANGLE (PI/3*3)
#define MAX_ANGLE (PI/3*6)
//#define BUNKATU 10
void meter_graph(int BUNKATU){
int i;
double ang=MIN_ANGLE;
for(i=0;i<=BUNKATU;i++){
DrawLine(300+100*cos(ang),260+100*sin(ang),300+80*cos(ang),260+80*sin(ang),GetColor(255,0,0));
ang+=(MAX_ANGLE-MIN_ANGLE)/BUNKATU;
}
}
void sikaku(int BUNKATU){
int i;
double ang=MIN_ANGLE;
int x=70, y=70;
int cx=70, cy=150;
int Color=GetColor(255,0,0);
for(i=0;i<=BUNKATU;i++){
int x1=(int)(cos(ang)*(x-cx)+sin(ang)*(cy-y)+cx);
int y1=(int)(cos(ang)*(y-cy)+sin(ang)*(x-cx)+cy);
int x2=(int)(cos(ang)*(x-cx-5)+sin(ang)*(cy-y)+cx);
int y2=(int)(cos(ang)*(y-cy)+sin(ang)*(x-cx-5)+cy);
int x3=(int)(cos(ang)*(x-cx-5)+sin(ang)*(cy-y-10)+cx);
int y3=(int)(cos(ang)*(y-cy-10)+sin(ang)*(x-cx-5)+cy);
int x4=(int)(cos(ang)*(x-cx)+sin(ang)*(cy-y-10)+cx);
int y4=(int)(cos(ang)*(y-cy-10)+sin(ang)*(x-cx)+cy);
DrawQuadrangle(
x1, y1,
x2, y2,
x3, y3,
x4, y4,
Color,
true
);
ang+=(MAX_ANGLE-MIN_ANGLE)/BUNKATU;
}
}
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow ){
if(ChangeWindowMode(TRUE) != DX_CHANGESCREEN_OK || DxLib_Init() == -1 ) return -1;//
SetDrawScreen( DX_SCREEN_BACK );
SetFontSize(36);
while(!ProcessMessage() && !ClearDrawScreen()){
meter_graph(10);
sikaku(10);
ScreenFlip();
}
DxLib_End();
return 0;
}