Files
Borland-C/super/SUPER.C

115 lines
3.3 KiB
C

#include <dos.h>
#include <math.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <graphics.h>
#include <c:\super\mouse.h>
int GraphDriver; /* The Graphics device driver */
int GraphMode; /* The Graphics mode value */
int ErrorCode; /* Reports any graphics errors */
void Initialize(void);
void Report(void);
int gprintf(int xloc, int yloc, char *fmt, ... );
int huge detectVESA(void);
/* *** here we go *** */
int main()
{
Initialize(); /* Initialize Graphics mode */
for (int a=1;a<256;a++){
setfillstyle(1,a);
bar(0,0,getmaxx(),getmaxy());
gprintf (100,100,"%d",a);
//getch();
delay(2000);
}
Report(); /* Tell the world what we found */
MouseInit();
setcolor (124);
MShowCursor();
line (100,100,800,800);
setcolor(150);
// Pause(); /* Give em a change to see it */
getch();
MouseClose();
closegraph(); /* Go home */
return(0);
}
// ************************************************************************
// ************************************************************************
// FUNCIONES DEL PROGRAMA
// ************************************************************************// ************************************************************************// ************************************************************************
// ************************************************************************
int huge detectVESA(void)
{ return(2); }
/* Initialize the graphics system and report any errors occur. */
void Initialize(void)
{
GraphDriver = installuserdriver("bgi256v2",detectVESA);
if (grOk != graphresult() )
{
printf("Error installing VESA driver");
exit(1);
}
GraphDriver = DETECT;
initgraph( &GraphDriver, &GraphMode, "c:\\c\\bgi" );
ErrorCode = graphresult();
if (ErrorCode != grOk) /* Check if error occured */
{
printf(" Graphics System Error: %s\n",grapherrormsg(ErrorCode));
exit(1);
}
}
void Report(void)
{
char *driver, *mode;
driver = getdrivername();
mode = getmodename(GraphMode);
gprintf(10,10,"Graphics device : %-20s (%d)",driver,GraphDriver);
gprintf(10,20,"Graphics mode : %-20s (%d)",mode,GraphMode);
gprintf(10,30,"Screen resolution : %d x %d",getmaxx(),getmaxy());
gprintf(10,40,"Colors available : %d",getmaxcolor()+1);
}
/*GPRINTF: Used like PRINTF except the output is sent to the */
/*screen in graphics mode at the specified co-ordinate. */
int gprintf( int xloc, int yloc, char *fmt, ... )
{
va_list argptr; /* Argument list pointer */
char str[140]; /* Buffer to build sting into */
int cnt; /* Result of SPRINTF for return */
va_start( argptr, format ); /* Initialize va_ functions */
cnt = vsprintf( str, fmt, argptr ); /* prints string to buffer */
outtextxy( xloc, yloc, str ); /* Send string in graphics mode */
yloc += textheight( "H" ) + 2; /* Advance to next line */
va_end( argptr ); /* Close va_ functions */
return( cnt ); /* Return the conversion count */
}