Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
71
Task/Draw-a-clock/Seed7/draw-a-clock.seed7
Normal file
71
Task/Draw-a-clock/Seed7/draw-a-clock.seed7
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
$ include "seed7_05.s7i";
|
||||
include "float.s7i";
|
||||
include "math.s7i";
|
||||
include "draw.s7i";
|
||||
include "keybd.s7i";
|
||||
include "time.s7i";
|
||||
include "duration.s7i";
|
||||
|
||||
const integer: WINDOW_WIDTH is 200;
|
||||
const integer: WINDOW_HEIGHT is 200;
|
||||
const color: BACKGROUND is White;
|
||||
const color: FOREGROUND is Black;
|
||||
const color: CLOCKCOLOR is Aqua;
|
||||
|
||||
const proc: main is func
|
||||
local
|
||||
var char: command is ' ';
|
||||
var time: start_time is time.value;
|
||||
var float: alpha is 0.0;
|
||||
var integer: x is 0;
|
||||
begin
|
||||
screen(WINDOW_WIDTH, WINDOW_HEIGHT);
|
||||
clear(curr_win, BACKGROUND);
|
||||
KEYBOARD := GRAPH_KEYBOARD;
|
||||
command := busy_getc(KEYBOARD);
|
||||
while command <> 'q' do
|
||||
start_time := truncToSecond(time(NOW));
|
||||
clear(curr_win, BACKGROUND);
|
||||
fcircle(100, 100, 95, CLOCKCOLOR);
|
||||
circle(100, 100, 95, FOREGROUND);
|
||||
for x range 0 to 60 do
|
||||
alpha := flt(x-15) * PI / 30.0;
|
||||
if x mod 5 = 0 then
|
||||
lineTo(100 + round(cos(alpha)*95.0),
|
||||
100 + round(sin(alpha)*95.0),
|
||||
100 + round(cos(alpha)*85.0),
|
||||
100 + round(sin(alpha)*85.0), FOREGROUND);
|
||||
else
|
||||
lineTo(100 + round(cos(alpha)*95.0),
|
||||
100 + round(sin(alpha)*95.0),
|
||||
100 + round(cos(alpha)*92.0),
|
||||
100 + round(sin(alpha)*92.0), FOREGROUND);
|
||||
end if;
|
||||
end for;
|
||||
alpha := flt(start_time.second-15) * PI / 30.0;
|
||||
lineTo(100, 100, 100 + round(cos(alpha)*85.0), 100 + round(sin(alpha)*85.0), FOREGROUND);
|
||||
alpha := flt(start_time.minute-15) * PI / 30.0;
|
||||
lineTo(100 + round(cos(alpha-PI/2.0)*5.0),
|
||||
100 + round(sin(alpha-PI/2.0)*5.0),
|
||||
100 + round(cos(alpha)*75.0),
|
||||
100 + round(sin(alpha)*75.0), FOREGROUND);
|
||||
lineTo(100 + round(cos(alpha+PI/2.0)*5.0),
|
||||
100 + round(sin(alpha+PI/2.0)*5.0),
|
||||
100 + round(cos(alpha)*75.0),
|
||||
100 + round(sin(alpha)*75.0), FOREGROUND);
|
||||
alpha := (flt(start_time.hour)+flt(start_time.minute)/60.0-3.0) * PI / 6.0;
|
||||
lineTo(100 + round(cos(alpha-PI/2.0)*7.0),
|
||||
100 + round(sin(alpha-PI/2.0)*7.0),
|
||||
100 + round(cos(alpha)*50.0),
|
||||
100 + round(sin(alpha)*50.0), FOREGROUND);
|
||||
lineTo(100 + round(cos(alpha+PI/2.0)*7.0),
|
||||
100 + round(sin(alpha+PI/2.0)*7.0),
|
||||
100 + round(cos(alpha)*50.0),
|
||||
100 + round(sin(alpha)*50.0), FOREGROUND);
|
||||
fcircle(100, 100, 7, CLOCKCOLOR);
|
||||
circle(100, 100, 7, FOREGROUND);
|
||||
DRAW_FLUSH;
|
||||
await(start_time + 1 . SECONDS);
|
||||
command := busy_getc(KEYBOARD);
|
||||
end while;
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue