Skip to content

Commit

Permalink
Merge branch 'master' into feat_support_repeat_music_playback
Browse files Browse the repository at this point in the history
  • Loading branch information
yixy-only authored Apr 30, 2024
2 parents 092a6a3 + b78a205 commit 80f1f2a
Show file tree
Hide file tree
Showing 17 changed files with 691 additions and 196 deletions.
4 changes: 1 addition & 3 deletions demo/egeball.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,7 @@ int main() {
fps f;
ege_enable_aa( true );

for (

; is_run(); delay_fps( 120 ) ) {
for (; is_run(); delay_fps(120)) {
aniobj.updateobj(); // Update object positions
cleardevice();
aniobj.drawobj(); // Draw objects
Expand Down
65 changes: 32 additions & 33 deletions demo/egeclock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,44 +50,43 @@ void draw()
sprintf(str, "%d", num);
ege::outtextxy((int)p.x, (int)p.y, str);
}

time_t t_now;
time(&t_now);
tm* t = localtime(&t_now);
ege::setcolor(EGEARGB(0xff, 0x0, 0x0, 0xff));
ege::setlinewidth(10.0f);
{
float h = float(t->tm_hour + t->tm_min / 60.0);
char str[8];
ege::ege_point p = getpos(center, float(h * pi2 / 12), r * 0.5f);
ege::ege_line(p.x, p.y, center.x, center.y);
}
ege::setcolor(EGEARGB(0xff, 0xff, 0x0, 0xff));
ege::setlinewidth(5.0f);
{
float m = float(t->tm_min + t->tm_sec / 60.0);
char str[8];
ege::ege_point p = getpos(center, float(m * pi2 / 60), r * 0.9f);
ege::ege_line(p.x, p.y, center.x, center.y);
}
ege::setcolor(EGEARGB(0xff, 0xff, 0xff, 0));
ege::setfillcolor(EGEARGB(0xff, 0xff, 0xff, 0));
ege::setlinewidth(1.0f);
{
float s = float(t->tm_sec);
char str[8];
ege::ege_point p = getpos(center, float(s * pi2 / 60), r * 1.0f);
ege::ege_line(p.x, p.y, center.x, center.y);
ege::ege_fillellipse(center.x - r * 0.05f, center.y - r * 0.05f,
r * 0.1f, r * 0.1f);
}
{
char str[32];
sprintf(str, "%d/%02d/%02d %2d:%02d:%02d",
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);
ege::setcolor(EGERGB(0xff, 0xff, 0));
ege::outtextxy((int)center.x, (int)(center.y + r * 1.4f), str);
}

char str[32];
ege::ege_point p;

float h = float(t->tm_hour + t->tm_min / 60.0);
p = getpos(center, float(h * pi2 / 12), r * 0.5f);
ege::ege_line(p.x, p.y, center.x, center.y);

ege::setcolor(EGEARGB(0xff, 0xff, 0x0, 0xff));
ege::setlinewidth(5.0f);

float m = float(t->tm_min + t->tm_sec / 60.0);
p = getpos(center, float(m * pi2 / 60), r * 0.9f);
ege::ege_line(p.x, p.y, center.x, center.y);

ege::setcolor(EGEARGB(0xff, 0xff, 0xff, 0));
ege::setfillcolor(EGEARGB(0xff, 0xff, 0xff, 0));
ege::setlinewidth(1.0f);

float s = float(t->tm_sec);
p = getpos(center, float(s * pi2 / 60), r * 1.0f);
ege::ege_line(p.x, p.y, center.x, center.y);
ege::ege_fillellipse(center.x - r * 0.05f, center.y - r * 0.05f,
r * 0.1f, r * 0.1f);

sprintf(str, "%d/%02d/%02d %2d:%02d:%02d",
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);
ege::setcolor(EGERGB(0xff, 0xff, 0));
ege::outtextxy((int)center.x, (int)(center.y + r * 1.4f), str);

}

/**
Expand Down
Loading

0 comments on commit 80f1f2a

Please sign in to comment.