TC20开发工具

  • r7_994469
    了解作者
  • 935.3KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-05 03:52
    上传日期
TC20开发工具
Turbo C.rar
内容介绍
/* GRAPHICS DEMO FOR TURBO C 2.0 Copyright (c) 1987,88 Borland International. All rights reserved. From the command line, use: tcc bgidemo graphics.lib */ #ifdef __TINY__ #error BGIDEMO will not run in the tiny model. #endif #include <dos.h> #include <math.h> #include <conio.h> #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <graphics.h> #define ESC 0x1b /* Define the escape key */ #define TRUE 1 /* Define some handy constants */ #define FALSE 0 /* Define some handy constants */ #define PI 3.14159 /* Define a value for PI */ #define ON 1 /* Define some handy constants */ #define OFF 0 /* Define some handy constants */ char *Fonts[] = { "DefaultFont", "TriplexFont", "SmallFont", "SansSerifFont", "GothicFont" }; char *LineStyles[] = { "SolidLn", "DottedLn", "CenterLn", "DashedLn", "UserBitLn" }; char *FillStyles[] = { "EmptyFill", "SolidFill", "LineFill", "LtSlashFill", "SlashFill", "BkSlashFill", "LtBkSlashFill", "HatchFill", "XHatchFill", "InterleaveFill", "WideDotFill", "CloseDotFill" }; char *TextDirect[] = { "HorizDir", "VertDir" }; char *HorizJust[] = { "LeftText", "CenterText", "RightText" }; char *VertJust[] = { "BottomText", "CenterText", "TopText" }; struct PTS { int x, y; }; /* Structure to hold vertex points */ int GraphDriver; /* The Graphics device driver */ int GraphMode; /* The Graphics mode value */ double AspectRatio; /* Aspect ratio of a pixel on the screen*/ int MaxX, MaxY; /* The maximum resolution of the screen */ int MaxColors; /* The maximum # of colors available */ int ErrorCode; /* Reports any graphics errors */ struct palettetype palette; /* Used to read palette info */ /* */ /* Function prototypes */ /* */ void Initialize(void); void ReportStatus(void); void TextDump(void); void Bar3DDemo(void); void RandomBars(void); void TextDemo(void); void ColorDemo(void); void ArcDemo(void); void CircleDemo(void); void PieDemo(void); void BarDemo(void); void LineRelDemo(void); void PutPixelDemo(void); void PutImageDemo(void); void LineToDemo(void); void LineStyleDemo(void); void CRTModeDemo(void); void UserLineStyleDemo(void); void FillStyleDemo(void); void FillPatternDemo(void); void PaletteDemo(void); void PolyDemo(void); void SayGoodbye(void); void Pause(void); void MainWindow(char *header); void StatusLine(char *msg); void DrawBorder(void); void changetextstyle(int font, int direction, int charsize); int gprintf(int *xloc, int *yloc, char *fmt, ... ); /* */ /* Begin main function */ /* */ int main() { Initialize(); /* Set system into Graphics mode */ ReportStatus(); /* Report results of the initialization */ ColorDemo(); /* Begin actual demonstration */ if( GraphDriver==EGA || GraphDriver==EGALO || GraphDriver==VGA ) PaletteDemo(); PutPixelDemo(); PutImageDemo(); Bar3DDemo(); BarDemo(); RandomBars(); ArcDemo(); CircleDemo(); PieDemo(); LineRelDemo(); LineToDemo(); LineStyleDemo(); UserLineStyleDemo(); TextDump(); TextDemo(); CRTModeDemo(); FillStyleDemo(); FillPatternDemo(); PolyDemo(); SayGoodbye(); /* Give user the closing screen */ closegraph(); /* Return the system to text mode */ return(0); } /* */ /* INITIALIZE: Initializes the graphics system and reports */ /* any errors which occured. */ /* */ void Initialize(void) { int xasp, yasp; /* Used to read the aspect ratio*/ GraphDriver = DETECT; /* Request auto-detection */ initgraph( &GraphDriver, &GraphMode, "" ); ErrorCode = graphresult(); /* Read result of initialization*/ if( ErrorCode != grOk ){ /* Error occured during init */ printf(" Graphics System Error: %s\n", grapherrormsg( ErrorCode ) ); exit( 1 ); } getpalette( &palette ); /* Read the palette from board */ MaxColors = getmaxcolor() + 1; /* Read maximum number of colors*/ MaxX = getmaxx(); MaxY = getmaxy(); /* Read size of screen */ getaspectratio( &xasp, &yasp ); /* read the hardware aspect */ AspectRatio = (double)xasp / (double)yasp; /* Get correction factor */ } /* */ /* REPORTSTATUS: Report the current configuration of the system */ /* after the auto-detect initialization. */ /* */ void ReportStatus(void) { struct viewporttype viewinfo; /* Params for inquiry procedures*/ struct linesettingstype lineinfo; struct fillsettingstype fillinfo; struct textsettingstype textinfo; struct palettetype palette; char *driver, *mode; /* Strings for driver and mode */ int x, y; getviewsettings( &viewinfo ); getlinesettings( &lineinfo ); getfillsettings( &fillinfo ); gettextsettings( &textinfo ); getpalette( &palette ); x = 10; y = 4; MainWindow( "Status report after InitGraph" ); settextjustify( LEFT_TEXT, TOP_TEXT ); driver = getdrivername(); mode = getmodename(GraphMode); /* get current setting */ gprintf( &x, &y, "Graphics device : %-20s (%d)", driver, GraphDriver ); gprintf( &x, &y, "Graphics mode : %-20s (%d)", mode, GraphMode ); gprintf( &x, &y, "Screen resolution : ( 0, 0, %d, %d )", getmaxx(), getmaxy() ); gprintf( &x, &y, "Current view port : ( %d, %d, %d, %d )", viewinfo.left, viewinfo.top, viewinfo.right, viewinfo.bottom ); gprintf( &x, &y, "Clipping : %s", viewinfo.clip ? "ON" : "OFF" ); gprintf( &x, &y, "Current position : ( %d, %d )", getx(), gety() ); gprintf( &x, &y, "Colors available : %d", MaxColors ); gprintf( &x, &y, "Current color : %d", getcolor() ); gprintf( &x, &y, "Line style : %s", LineStyles[ lineinfo.linestyle ] ); gprintf( &x, &y, "Line thickness : %d", lineinfo.thickness ); gprintf( &x, &y, "Current fill style : %s", FillStyles[ fillinfo.pattern ] ); gprintf( &x, &y, "Current fill color : %d", fillinfo.color ); gprintf( &x, &y, "Current font : %s", Fonts[ textinfo.font ] ); gprintf( &x, &y, "Text direction : %s", TextDirect[ textinfo.direction ] ); gprintf( &x, &y, "Character size : %d", textinfo.charsize ); gprintf( &x, &y, "Horizontal justify : %s", HorizJust[ textinfo.horiz ] ); gprintf( &x, &y, "Vertical justify : %s", VertJust[ textinfo.vert ] ); Pause(); /* Pause for user to read screen*/ } /* */ /* TEXTDUMP: Display the all the characters in each of the */ /* available fonts. */ /* */ void TextDump() { static int CGASizes[] = { 1, 3, 7, 3, 3 }; static int NormSizes[] = { 1, 4, 7, 4, 4 }; char buffer[80]; int font, ch, wwidth, lwidth, size; struct viewporttype vp; for( font=0 ; font<5 ; ++font ){ /* For each available font */ sprintf( buffer, "%s Character Set", Fonts[font] ); MainWindow( buffer ); /* Display fontname as banner */ getviewsettings( &vp ); /* read current viewport */ settextjustify( LEFT_TEXT, TOP_TEXT ); moveto( 2, 3 ); buffer[1] = '\0'; /* Terminate string */ wwidth = vp.right - vp.left; /* Determine the window width */ lwidth = textwidth( "H" ); /* Get average letter width */ if( font == DEFAULT_FONT ){ changetextstyle( font, HORIZ_DIR, 1 ); ch = 0; while( ch < 256 ){ /* For each possible character */ buffer[0] = ch; /* Put character into a string */ outtext( buffer ); /* send string to screen */ if( (getx() + lwidth) > wwidth ) moveto( 2, gety() + textheight("H") + 3 ); ++ch; /* Goto the next character */ } } else{ size = (MaxY < 200) ? CGASizes[font] : NormSizes[font]; changetextstyle( font, HORIZ_DIR, size ); ch = '!';
评论
    相关推荐
    • RKNANO开发工具
      很好用的RKNANO开发工具,可以对原来的固件进行二次开发
    • pic开发工具
      PIC 开发工具-----------------------------------------
    • 开发工具
      开发工具 sentinel-dashboard-1.8.2.jar
    • 闪屏开发工具
      闪屏工具,在现有工具基础上开发,加入了时间控制功能,并简化调用语句,只需要SplashObject.GetSplash(8000)一句即可完成,8000为闪屏时间,另外,相关图片放在Resources文件夹里,改下名称替换即可
    • 苹果开发工具
      一个OC开发工具,希望大家共享,我在网上找了好久才找到
    • 串口开发工具
      串口开发工具,包含串口监控和虚拟串口添加软件,串口开发必备
    • opc开发工具
      opc开发工具,首先安装OPC_2.0_Core_Components-Setup驱动(压缩包内含)
    • duilib开发工具
      收集的我感觉比较好用的duilib开发工具,觉得很实用就分享出来
    • 开发工具
      开发工具
    • wap开发工具
      wap手机网页开发工具包,里面有3个wap开发工具。可以可视化开发。 wap手机网页开发工具包,里面有3个wap开发工具。可以可视化开发。