📄 clock.c
字号:
#define byte unsigned char
#define word unsigned short
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include "metawndo.h" /* master MetaWINDOW include file */
rect sR,R;
void Waiting(int a);
void clockP(void)
{
void quit(void);
int ScrnXmax,ScrnYmax,x,y,dx,dy,i,pat;
int maxclr;
// long count;
double clockAngle;
mwEvent waitEvent;
ScreenRect(&sR);
RasterOp(zREPz);
ScrnXmax = sR.Xmax;
ScrnYmax = sR.Ymax;
dx = (ScrnXmax)/2; dy=(ScrnYmax)/2;
maxclr = (int) QueryColors();
PenColor(maxclr);
BackColor(0);
EraseRect(&sR);
pat = 7;
clockAngle = 0.0;
for (i = 0; i < 32; i++)
{
BackColor(4*i);
PenSize(4,4);
PenDash(pat);
PenPattern(pat);
MoveTo(dx, dy);
x = dx + (int)((float)dy * cos(clockAngle));
y = dy + (int)((float)dy * sin(clockAngle));
LineTo(x, y);
clockAngle = clockAngle + .196;
pat--;
if (pat < 0) pat = 7;
}
BackColor(0);
MoveTo( dx,ScrnYmax - 10 );
DrawString( "On/Off Dashes" );
#ifndef CYCLE
MoveTo( 0,sR.Ymax - 20 );
DrawString( "Press 'x' to exit" );
MoveTo( 0,sR.Ymax - 10 );
DrawString( "any other key to continue" );
while(!KeyEvent(1, &waitEvent));
if((waitEvent.eventChar == 'x') || (waitEvent.eventChar == 'X')) quit();
#else
#ifdef _MNT_
KeyEvent(0, &waitEvent);
if((waitEvent.eventChar == 'x') || (waitEvent.eventChar == 'X')) quit();
#endif
Waiting(150);
#endif
DashStyle(dashDouble);
pat = 7;
clockAngle = 0.0;
for (i = 32; i < 64; i++)
{
BackColor(4*i);
PenSize(4,4);
PenDash(pat);
PenPattern(pat);
MoveTo(dx, dy);
x = dx + (int)((float)dy * cos(clockAngle));
y = dy + (int)((float)dy * sin(clockAngle));
LineTo(x, y);
clockAngle = clockAngle + .196;
pat--;
if (pat < 0) pat = 7;
}
BackColor(0);
MoveTo( dx,ScrnYmax - 10 );
DrawString( "Double Dashes" );
#ifndef CYCLE
MoveTo( 0,sR.Ymax - 20 );
DrawString( "Press 'x' to exit" );
MoveTo( 0,sR.Ymax - 10 );
DrawString( "any other key to continue" );
while(!KeyEvent(1, &waitEvent));
if((waitEvent.eventChar == 'x') || (waitEvent.eventChar == 'X')) quit();
#else
#ifdef _MNT_
KeyEvent(0, &waitEvent);
if((waitEvent.eventChar == 'x') || (waitEvent.eventChar == 'X')) quit();
#endif
Waiting(150);
#endif
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -