This commit is contained in:
Zengtudor 2024-09-05 23:22:18 +08:00
parent 81578e5e8c
commit 3bfce1e098
2 changed files with 11 additions and 4 deletions

View File

@ -13,7 +13,7 @@
#include <thread>
const float POINT_SIZE = 32.0f;
const unsigned int F_PER_SECOND = 120;
const unsigned int F_PER_SECOND = 144;
const float PI = 3.141592653589793238462643383279502884L;
typedef unsigned int u8;
@ -50,8 +50,15 @@ void render(){
static int state = -1;
state=(state+1)%F_PER_SECOND;
const float anglePerCircle = 10.0f;
static float circleSize = 0.0f;
if(state==0){
circleSize+=0.1f;
}
if(circleSize>1.0f){
circleSize=0.0f;
}
for (u8 i=0;i<u8(float(state)/120.0f*360.0f);i+=anglePerCircle) {
glVertex3f(std::cos(angleToRad(i)),std::sin(angleToRad(i)),0.0f);
glVertex3f(std::cos(angleToRad(i))*circleSize,std::sin(angleToRad(i))*circleSize,0.0f);
}
glEnd();
}

View File

@ -18,5 +18,5 @@ add_packages("glfw","glad","glm")
target("3Points")
add_files("src/c1/threePoints.cpp")
target("circle")
add_files("src/c1/circle.cpp")
target("circlePoints")
add_files("src/c1/circlePoints.cpp")