Created
August 18, 2015 03:07
-
-
Save ssi-anik/a25ecd4ca52f81014936 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<graphics.h> | |
int driver = DETECT, mode, width, height; | |
void rotateObject(int inAngle); | |
int main(void){ | |
width = getmaxwidth() - 100; | |
height = getmaxheight() - 50; | |
int inAngle; | |
printf("what is your rotation angle?: "); | |
scanf("%d", &inAngle); | |
rotateObject(inAngle); | |
return 0; | |
} | |
void rotateObject(int inAngle){ | |
initgraph(&driver, &mode, ""); | |
char title[100]; | |
sprintf(title, "Rotating object in %d angle", inAngle); | |
initwindow(width, height, title); | |
int pie_center_x = 150, | |
pie_center_y = 200, | |
pie_start_angle = 90, | |
pie_end_angle = 225, | |
pie_radius = 100; | |
int rotated_pie_center_x = 500, | |
rotated_pie_center_y = 500, | |
rotated_pie_start_angle = 90 + inAngle, | |
rotated_pie_end_angle = 225 + inAngle, | |
rotated_pie_radius = 100; | |
char original[500]; | |
sprintf(original, "center :(%d, %d), start angle: %d, end angle: %d", pie_center_x, pie_center_y, pie_start_angle, pie_end_angle); | |
outtextxy(pie_center_x, pie_center_y, original); | |
pieslice(pie_center_x, pie_center_y, pie_start_angle, pie_end_angle, pie_radius); | |
char rotated[500]; | |
sprintf(rotated, "center :(%d, %d), start angle: %d, end angle: %d", rotated_pie_center_x, rotated_pie_center_y, rotated_pie_start_angle, rotated_pie_end_angle); | |
outtextxy(rotated_pie_center_x + 20, rotated_pie_center_y, rotated); | |
pieslice(rotated_pie_center_x, rotated_pie_center_y, rotated_pie_start_angle, rotated_pie_end_angle, rotated_pie_radius); | |
getch(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment