update linux templates

This commit is contained in:
Roy Qu 2023-08-12 22:27:25 +08:00
parent d86f98b0ee
commit 4b8883062b
3 changed files with 28 additions and 27 deletions

View File

@ -11,7 +11,7 @@ void updateRadius(int baseL, int outerL, int pointL, int *pBaseR, int *pOuterR,
totalL+=pointL; totalL+=pointL;
else else
totalL+=outerL; totalL+=outerL;
int totalR = 420; int totalR = 340;
int remainder = totalR % totalL; int remainder = totalR % totalL;
if (remainder!=0) { if (remainder!=0) {
if (remainder < totalL / 2) { if (remainder < totalL / 2) {
@ -31,21 +31,21 @@ int main() {
int outerL=13; int outerL=13;
int pointL=3; int pointL=3;
int baseR,outerR,pointR; int baseR,outerR,pointR;
int cx=450,cy=450; int cx=350,cy=350;
int speed = 1; int speed = 1;
Color trackColor = BLUE; Color trackColor = BLUE;
updateRadius(baseL, outerL, pointL, &baseR, &outerR, & pointR); updateRadius(baseL, outerL, pointL, &baseR, &outerR, & pointR);
InitWindow(1300,900,"Epitrochoid"); InitWindow(1000,700,"Epitrochoid");
SetTraceLogLevel(LOG_WARNING); SetTraceLogLevel(LOG_WARNING);
SetTargetFPS(60); SetTargetFPS(60);
GuiSetStyle(DEFAULT,TEXT_SIZE,20); GuiSetStyle(DEFAULT,TEXT_SIZE,20);
Image trackImage=GenImageColor(900,900,WHITE); Image trackImage=GenImageColor(700,700,WHITE);
//border //border
ImageFillRectangleEx(&trackImage,0,0,900,900,LIGHTGRAY); ImageFillRectangleEx(&trackImage,0,0,700,700,LIGHTGRAY);
ImageFillRectangleEx(&trackImage,5,5,890,890,WHITE); ImageFillRectangleEx(&trackImage,5,5,690,690,WHITE);
Image circlesImage = GenImageColor(900,900,BLANK); Image circlesImage = GenImageColor(700,700,BLANK);
float r=0; float r=0;
int lastx,lasty; int lastx,lasty;
lasty=cy; lasty=cy;
@ -57,9 +57,9 @@ int main() {
int newBaseL = GuiSliderBar((Rectangle){ 70, 60, 200, 30 },"Base",TextFormat("%i", (int)baseL), baseL, 1, 50); int newBaseL = GuiSliderBar((Rectangle){ 70, 60, 200, 30 },"Base",TextFormat("%i", (int)baseL), baseL, 1, 50);
int newPointL = GuiSliderBar((Rectangle){ 70, 100, 200, 30 },"Point",TextFormat("%i", (int)pointL), pointL, 1, 50); int newPointL = GuiSliderBar((Rectangle){ 70, 100, 200, 30 },"Point",TextFormat("%i", (int)pointL), pointL, 1, 50);
speed = GuiSliderBar((Rectangle){ 70, 150, 200, 30 },"Speed",TextFormat("%i", (int)speed), speed, 1, 50); speed = GuiSliderBar((Rectangle){ 70, 150, 200, 30 },"Speed",TextFormat("%i", (int)speed), speed, 1, 50);
GuiLabel((Rectangle){ 20, 220, 80, 30 },TextFormat("Color: 0x%X%X%X ",(int)(trackColor.r), (int)(trackColor.g),(int)(trackColor.b))); GuiLabel((Rectangle){ 20, 220, 80, 30 },TextFormat("Color: 0x%02X%02X%02X ",(int)(trackColor.r), (int)(trackColor.g),(int)(trackColor.b)));
trackColor= GuiColorPicker((Rectangle){ 50, 250, 196, 192 }, NULL, trackColor); trackColor= GuiColorPicker((Rectangle){ 50, 250, 196, 192 }, NULL, trackColor);
int doClear = GuiButton((Rectangle){ 120, 700, 80, 30 },"Clear"); int doClear = GuiButton((Rectangle){ 120, 500, 80, 30 },"Clear");
if (newOuterL!=outerL || newBaseL!=baseL || newPointL!=pointL) { if (newOuterL!=outerL || newBaseL!=baseL || newPointL!=pointL) {
if (newOuterL!=outerL) if (newOuterL!=outerL)
pointL=newOuterL; pointL=newOuterL;
@ -72,12 +72,12 @@ int main() {
lastx=cx+(baseR+outerR-pointR); lastx=cx+(baseR+outerR-pointR);
r=0; r=0;
ImageClearBackground(&trackImage,WHITE); ImageClearBackground(&trackImage,WHITE);
ImageFillRectangleEx(&trackImage,0,0,900,900,LIGHTGRAY); ImageFillRectangleEx(&trackImage,0,0,700,700,LIGHTGRAY);
ImageFillRectangleEx(&trackImage,5,5,890,890,WHITE); ImageFillRectangleEx(&trackImage,5,5,690,690,WHITE);
} else if (doClear) { } else if (doClear) {
ImageClearBackground(&trackImage,WHITE); ImageClearBackground(&trackImage,WHITE);
ImageFillRectangleEx(&trackImage,0,0,900,900,LIGHTGRAY); ImageFillRectangleEx(&trackImage,0,0,700,700,LIGHTGRAY);
ImageFillRectangleEx(&trackImage,5,5,890,890,WHITE); ImageFillRectangleEx(&trackImage,5,5,690,690,WHITE);
} }
//update datas //update datas
r+=0.01; r+=0.01;

View File

@ -11,6 +11,7 @@ Category[zh_CN]=游戏
[Unit0] [Unit0]
CName=main.c CName=main.c
C=epitrochoid_c.txt C=epitrochoid_c.txt
C[zh_CN]=epitrochoid_zh_CN.c
[Project] [Project]
UnitCount=1 UnitCount=1

View File

@ -17,7 +17,7 @@ void updateRadius(int baseL, int innerL,int pointL, int *pBaseR, int *pInnerR, i
if (pointL>innerL) if (pointL>innerL)
totalL = baseL-innerL+pointL; totalL = baseL-innerL+pointL;
} }
int totalR = 420; int totalR = 320;
int remainder = totalR % totalL; int remainder = totalR % totalL;
if (remainder!=0) { if (remainder!=0) {
if (remainder < totalL / 2) { if (remainder < totalL / 2) {
@ -37,21 +37,21 @@ int main() {
int innerL=3; int innerL=3;
int pointL=6; int pointL=6;
int baseR,innerR,pointR; int baseR,innerR,pointR;
int cx=450,cy=450; int cx=350,cy=350;
int speed = 1; int speed = 1;
Color trackColor = BLUE; Color trackColor = BLUE;
updateRadius(baseL, innerL, pointL, &baseR, &innerR, &pointR); updateRadius(baseL, innerL, pointL, &baseR, &innerR, &pointR);
InitWindow(1300,900,"Hypotrochoid"); InitWindow(1100,700,"Hypotrochoid");
SetTraceLogLevel(LOG_WARNING); SetTraceLogLevel(LOG_WARNING);
SetTargetFPS(60); SetTargetFPS(60);
GuiSetStyle(DEFAULT,TEXT_SIZE,20); GuiSetStyle(DEFAULT,TEXT_SIZE,20);
Image trackImage=GenImageColor(900,900,WHITE); Image trackImage=GenImageColor(700,700,WHITE);
//border //border
ImageFillRectangleEx(&trackImage,0,0,900,900,LIGHTGRAY); ImageFillRectangleEx(&trackImage,0,0,700,700,LIGHTGRAY);
ImageFillRectangleEx(&trackImage,5,5,890,890,WHITE); ImageFillRectangleEx(&trackImage,5,5,690,690,WHITE);
Image circlesImage = GenImageColor(900,900,BLANK); Image circlesImage = GenImageColor(700,700,BLANK);
float r=0; float r=0;
int lastx,lasty; int lastx,lasty;
bool skip=true; bool skip=true;
@ -64,9 +64,9 @@ int main() {
int newBaseL = GuiSliderBar((Rectangle){ 70, 60, 200, 30 },"Base",TextFormat("%i", (int)baseL), baseL, 1, 50); int newBaseL = GuiSliderBar((Rectangle){ 70, 60, 200, 30 },"Base",TextFormat("%i", (int)baseL), baseL, 1, 50);
int newPointL = GuiSliderBar((Rectangle){ 70, 100, 200, 30 },"Point",TextFormat("%i", (int)pointL), pointL, 1, 50); int newPointL = GuiSliderBar((Rectangle){ 70, 100, 200, 30 },"Point",TextFormat("%i", (int)pointL), pointL, 1, 50);
speed = GuiSliderBar((Rectangle){ 70, 150, 200, 30 },"Speed",TextFormat("%i", (int)speed), speed, 1, 50); speed = GuiSliderBar((Rectangle){ 70, 150, 200, 30 },"Speed",TextFormat("%i", (int)speed), speed, 1, 50);
GuiLabel((Rectangle){ 20, 220, 80, 30 },TextFormat("Color: 0x%X%X%X ",(int)(trackColor.r), (int)(trackColor.g),(int)(trackColor.b))); GuiLabel((Rectangle){ 20, 220, 200, 30 },TextFormat("Color: 0x%02X%02X%02X ",(int)(trackColor.r), (int)(trackColor.g),(int)(trackColor.b)));
trackColor= GuiColorPicker((Rectangle){ 50, 250, 196, 192 }, NULL, trackColor); trackColor= GuiColorPicker((Rectangle){ 50, 250, 196, 192 }, NULL, trackColor);
int doClear = GuiButton((Rectangle){ 120, 700, 80, 30 },"Clear"); int doClear = GuiButton((Rectangle){ 120, 500, 80, 30 },"Clear");
if (newInnerL!=innerL || newBaseL!=baseL || newPointL!=pointL) { if (newInnerL!=innerL || newBaseL!=baseL || newPointL!=pointL) {
if (newInnerL!=innerL) if (newInnerL!=innerL)
pointL=newInnerL; pointL=newInnerL;
@ -78,12 +78,12 @@ int main() {
r=0; r=0;
skip=true; skip=true;
ImageClearBackground(&trackImage,WHITE); ImageClearBackground(&trackImage,WHITE);
ImageFillRectangleEx(&trackImage,0,0,900,900,LIGHTGRAY); ImageFillRectangleEx(&trackImage,0,0,700,700,LIGHTGRAY);
ImageFillRectangleEx(&trackImage,5,5,890,890,WHITE); ImageFillRectangleEx(&trackImage,5,5,690,690,WHITE);
} else if (doClear) { } else if (doClear) {
ImageClearBackground(&trackImage,WHITE); ImageClearBackground(&trackImage,WHITE);
ImageFillRectangleEx(&trackImage,0,0,900,900,LIGHTGRAY); ImageFillRectangleEx(&trackImage,0,0,700,700,LIGHTGRAY);
ImageFillRectangleEx(&trackImage,5,5,890,890,WHITE); ImageFillRectangleEx(&trackImage,5,5,690,690,WHITE);
} }
//update datas //update datas
float innerCX=cx+ (baseR-innerR)*cos(r); float innerCX=cx+ (baseR-innerR)*cos(r);