⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dashes.c

📁 nucleus 文件系统,内核和彩色图形系统,在小系统上非常好用
💻 C
字号:
/*             dashes     11/5/99                         */
/**********************************************************/
#define byte unsigned char
#define word unsigned short

#include <stdio.h>
#include <stdlib.h>
//#include <conio.h>
#include "metawndo.h"      /* master MetaWINDOW include file */

void Waiting(int a);

void dashtest()
{
void quit(void);
    rect  scrnSize;
   int      ScrnXmax,ScrnYmax,dx,dy;
	mwEvent waitEvent;
    point Pts[9];
	dashRcd newDash = {2,0,0};
	byte newDashes[] = {14,21};
   
    ScreenRect( &scrnSize);
    BackColor(Black);
    PenNormal();
    EraseRect( &scrnSize);

   ScrnXmax = scrnSize.Xmax;
   ScrnYmax = scrnSize.Ymax;
   dx = (ScrnXmax+1)/4; dy=(ScrnYmax+1)/4;

   Pts[0].X = dx;
   Pts[0].Y = (dy << 1) + (dy >> 1);
   Pts[1].X = Pts[0].X;
   Pts[1].Y = Pts[0].Y - dy;
   Pts[2].X = Pts[1].X + dx;
   Pts[2].Y = Pts[1].Y - dy;
   Pts[3].X = Pts[2].X + dx;
   Pts[3].Y = Pts[2].Y;
   Pts[4].X = Pts[3].X - dx;
   Pts[4].Y = Pts[3].Y + dy;
   Pts[5].X = Pts[4].X;
   Pts[5].Y = Pts[4].Y + dy;
   Pts[6].X = Pts[5].X + dx;
   Pts[6].Y = Pts[5].Y + dy;
   Pts[7].X = Pts[6].X - dx;
   Pts[7].Y = Pts[6].Y;
   Pts[8].X = Pts[7].X - dx;
   Pts[8].Y = Pts[7].Y - dy;

    PolyLine(9, Pts);
	MoveTo(Pts[2].X, Pts[2].Y - 10);
	DrawText("Thin PolyLine", 0, 128);
#ifndef CYCLE
	MoveTo( 0,scrnSize.Ymax - 20 );
	DrawString( "Press 'x' to exit" );
	MoveTo( 0,scrnSize.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

    PenShape(shapeOval);
	PenCap(capRound);
	PenJoin(joinRound);
    PenSize(10, 10);
    PolyLine(9, Pts);
	MoveTo(Pts[2].X, Pts[2].Y - 10);
	DrawText("Thick Oval PolyLine", 0, 128);
#ifndef CYCLE
	MoveTo( 0,scrnSize.Ymax - 20 );
	DrawString( "Press 'x' to exit" );
	MoveTo( 0,scrnSize.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

    PenShape(shapeRect);
	PenJoin(joinBevel);
    PolyLine(9, Pts);
	MoveTo(Pts[2].X, Pts[2].Y - 10);
	DrawText("Thick Square PolyLine", 0, 128);
#ifndef CYCLE
	MoveTo( 0,scrnSize.Ymax - 20 );
	DrawString( "Press 'x' to exit" );
	MoveTo( 0,scrnSize.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

    EraseRect( &scrnSize);
	newDash.dashList = newDashes;
	DefineDash(3, &newDash);
    PenDash(3);
	PenOffset(7);
    PolyLine(9, Pts);
	MoveTo(Pts[2].X, Pts[2].Y - 10);
	DrawText("Thick Dashed PolyLine", 0, 128);
	DefineDash(3, 0);
#ifndef CYCLE
	MoveTo( 0,scrnSize.Ymax - 20 );
	DrawString( "Press 'x' to exit" );
	MoveTo( 0,scrnSize.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

	PenNormal();

  return;      
}

/* End of File - CHAP2_1.C */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -