Jump to content
  • Advertisement
Sign in to follow this  
Mizipzor

error LNK2019: unresolved external symbol

This topic is 4818 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I guess this is a pretty common question, tried searchin for it and got many hits. However, nothing helped. If I understand it correctly I get this error when I try to call a function that really doesnt exist. Im getting this error when Im running a sdl_primitives_test program. Downloaded a header with functions so I can draw primitives. Its the test/example thing so the code should be bad. sdl.lib and sdlmain.lib is already in the linkers command line. Im using Microsoft Visual C++ .NET. TestGfxPrimitives.c
/* 

 TestGfxPrimitives
 
 Test graphics primitive routines for accuracy (visual) and speed.
 
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#include "SDL.h"

#include "SDL_gfxPrimitives.h"

#define WIDTH	640
#define HEIGHT	480

#define NUM_RANDOM	512

/* Coordinates */
static Sint16 rx1[NUM_RANDOM], rx2[NUM_RANDOM], ry1[NUM_RANDOM], ry2[NUM_RANDOM];

/* Radii and offsets */
static Sint16 rr1[NUM_RANDOM], rr2[NUM_RANDOM];

/* Start and stop angles */
static Sint16 a1[NUM_RANDOM], a2[NUM_RANDOM];

/* RGB colors and alpha */
static char rr[NUM_RANDOM], rg[NUM_RANDOM], rb[NUM_RANDOM], ra[NUM_RANDOM];

/* Generate an array of random screen coordinates and RGBA values with an offset */

void InitRandomPoints()
{
 int i;
 float af;

 for (i=0; i<NUM_RANDOM; i++) {
  rx1=rand() % (WIDTH/2);
  rx2=WIDTH/2+rx1;
  ry1=60+(rand() % ((HEIGHT-80)/2));
  ry2=20+((HEIGHT-80)/2)+ry1;
  rr1=rand() % 32;
  rr2=rand() % 32;
  a1=rand() % 360;
  a2=rand() % 360;
  rr=rand() & 255;
  rg=rand() & 255;
  rb=rand() & 255;
  af=((float)rx1/(float)(WIDTH/2));
  ra=(int)(255.0*af);
 } 
}

#define BORDER	10

/* Set a clipping rectangle based on a rect with a border */

void SetClip (SDL_Surface *screen, int x1, int y1, int x2, int y2)
{ 
 SDL_Rect clip;
 clip.x = x1+BORDER;
 clip.y = y1+BORDER;
 clip.w = x2-x1-2*BORDER;
 clip.h = y2-y1-2*BORDER;
 SDL_SetClipRect(screen, &clip);
}

void SetClipNoBorder (SDL_Surface *screen, int x1, int y1, int x2, int y2)
{ 
 SDL_Rect clip;
 clip.x = x1;
 clip.y = y1;
 clip.w = x2-x1;
 clip.h = y2-y1;
 SDL_SetClipRect(screen, &clip);
}

void ClearScreen(SDL_Surface *screen, char *title)
{
 int x,y;
 float stepx, stepy, fx, fy, fxy;
 char titletext[256];
 Uint32 color;

 /* Setup clear color color */
 if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
  color=SDL_MapRGBA(screen->format, 0,0,0,0);
 } else {
  color=SDL_MapRGBA(screen->format, 0,0,0,0);
 }

 /* Clear the screen */
 SetClipNoBorder (screen,0,0,WIDTH-1,HEIGHT-1);
 SDL_FillRect (screen, NULL, color);

 /* Draw the colored area */
 stepx=1.0/(WIDTH/2);
 stepy=1.0/((HEIGHT-80)/2);
 fx=0.0;
 for (x=WIDTH/2; x<WIDTH; x++) {
  fy=0.0;
  for (y=(HEIGHT-40)/2+60; y<HEIGHT; y++) {
   fxy=1.0-fx*fy;
   pixelRGBA(screen,x,y,(int)(128.0*fx*fx),(int)(128.0*fxy*fxy),(int)(128.0*fy*fy),255);
   fy += stepy;
  }
  fx += stepx;
 }
 /* Segment and titles */
 hlineRGBA(screen, 0, WIDTH, 20-1, 255,255,255,255);
 hlineRGBA(screen, 0, WIDTH, 60-1, 255,255,255,255);
 hlineRGBA(screen, 0, WIDTH, (HEIGHT-40)/2+40+1, 255,255,255,255); 
 hlineRGBA(screen, 0, WIDTH, (HEIGHT-40)/2+60-1, 255,255,255,255); 
 vlineRGBA(screen, WIDTH/2, 20, HEIGHT, 255,255,255,255);
 strncpy(titletext,"Current Primitive: ",256);
 strncat(titletext,title,256);
 strncat(titletext,"  -  Click for continue. Key to Quit.",256);
 stringRGBA (screen, WIDTH/2-4*strlen(titletext),10-4,titletext,255,255,255,255);
 strncpy(titletext,"A=255 on Black",256);
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),50-4,titletext,255,255,255,255);
 strncpy(titletext,"A=0-254 on Black",256);
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),50-4,titletext,255,255,255,255);
 strncpy(titletext,"A=255, Color Test",256);
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),(HEIGHT-40)/2+50-4,titletext,255,255,255,255);
 strncpy(titletext,"A=0-254 on Color",256);
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),(HEIGHT-40)/2+50-4,titletext,255,255,255,255);
}

/* ======== Test and Benchmark routines ======= */

void TestPixel(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  pixelRGBA(screen, rx1, ry1, rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  pixelRGBA(screen, rx2, ry1, rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  pixelRGBA(screen, rx2, ry2, rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  pixelRGBA(screen, rx1, ry2, r, g, b, 255);
 }
}

void BenchmarkPixel(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];

 /* Draw A=255 */
 repeat=200;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   pixelRGBA(screen, rx1, ry1, rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=100;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   pixelRGBA(screen, rx2, ry1, rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}

void TestHline(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i += 2) {
  hlineRGBA(screen, rx1, rx1[i+1], ry1[i+1], rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i += 2) {
  hlineRGBA(screen, rx2, rx2[i+1], ry1[i+1], rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<NUM_RANDOM; i += 2) {
  hlineRGBA(screen, rx2, rx2[i+1], ry2[i+1], rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<NUM_RANDOM; i += 2) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  hlineRGBA(screen, rx1, rx1+rr1, ry2[i+1], r, g, b, 255);
 }
}

void BenchmarkHline(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];
 
 /* Draw A=255 */
 repeat=200;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   hlineRGBA(screen, rx1, rx1[i+1], ry1[i+1], rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=100;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   hlineRGBA(screen, rx2, rx2[i+1], ry1[i+1], rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);

}

void TestVline(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i += 2) {
  vlineRGBA(screen, rx1, ry1, ry1[i+1], rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i += 2) {
  vlineRGBA(screen, rx2, ry1, ry1[i+1], rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<NUM_RANDOM; i += 2) {
  vlineRGBA(screen, rx2, ry2, ry2[i+1], rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<NUM_RANDOM; i += 2) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  vlineRGBA(screen, rx1, ry2, ry2+rr1, r, g, b, 255);
 }
}

void BenchmarkVline(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];
 
 /* Draw A=255 */
 repeat=200;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   vlineRGBA(screen, rx1, ry1, ry1[i+1], rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=100;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   vlineRGBA(screen, rx2, ry1, ry1[i+1], rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);

}

void TestRectangle(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i += 2) {
  rectangleRGBA(screen, rx1, ry1, rx1[i+1], ry1[i+1], rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i += 2) {
  rectangleRGBA(screen, rx2, ry1, rx2[i+1], ry1[i+1], rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<NUM_RANDOM; i += 2) {
  rectangleRGBA(screen, rx2, ry2, rx2[i+1], ry2[i+1], rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<NUM_RANDOM; i += 2) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  rectangleRGBA(screen, rx1, ry2, rx1+rr1, ry2+rr2, r, g, b, 255);
 }
}

void BenchmarkRectangle(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];
 
 /* Draw A=255 */
 repeat=200;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i += 2) {
   rectangleRGBA(screen, rx1, ry1, rx1[i+1], ry1[i+1], rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=10;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i += 2) {
   rectangleRGBA(screen, rx2, ry1, rx2[i+1], ry1[i+1], rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);

}

void TestBoxTwo(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();

 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  boxRGBA(screen, rx1, ry1, rx1+1, ry1+1, rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  boxRGBA(screen, rx2, ry1, rx2+1, ry1+1, rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  boxRGBA(screen, rx2, ry2, rx2+1, ry2+1, rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  boxRGBA(screen, rx1, ry2, rx1+1, ry2+1, r, g, b, 255);
 }
}

void BenchmarkBoxTwo(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];
 
 /* Draw A=255 */
 repeat=50;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   boxRGBA(screen, rx1, ry1, rx1+1, ry1+1, rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=50;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   boxRGBA(screen, rx2, ry1, rx2+1, ry1+1, rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);

}

void TestBox(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i += 2) {
  boxRGBA(screen, rx1, ry1, rx1[i+1], ry1[i+1], rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i += 2) {
  boxRGBA(screen, rx2, ry1, rx2[i+1], ry1[i+1], rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<NUM_RANDOM; i += 2) {
  boxRGBA(screen, rx2, ry2, rx2[i+1], ry2[i+1], rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<NUM_RANDOM; i += 2) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  boxRGBA(screen, rx1, ry2, rx1+rr1, ry2+rr2, r, g, b, 255);
 }
}

void BenchmarkBox(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];
 
 /* Draw A=255 */
 repeat=10;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i += 2) {
   boxRGBA(screen, rx1, ry1, rx1[i+1], ry1[i+1], rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=1;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i += 2) {
   boxRGBA(screen, rx2, ry1, rx2[i+1], ry1[i+1], rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);

}

void TestLine(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i += 2) {
  lineRGBA(screen, rx1, ry1, rx1[i+1], ry1[i+1], rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i += 2) {
  lineRGBA(screen, rx2, ry1, rx2[i+1], ry1[i+1], rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<NUM_RANDOM; i += 2) {
  lineRGBA(screen, rx2, ry2, rx2[i+1], ry2[i+1], rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<NUM_RANDOM; i += 2) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  lineRGBA(screen, rx1, ry2, rx1+rr1, ry2+rr2, r, g, b, 255);
 }
}

void BenchmarkLine(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];
 
 /* Draw A=255 */
 repeat=100;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i += 2) {
   lineRGBA(screen, rx1, ry1, rx1[i+1], ry1[i+1], rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=5;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i += 2) {
   lineRGBA(screen, rx2, ry1, rx2[i+1], ry1[i+1], rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);

}


void TestAALine(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i += 2) {
  aalineRGBA(screen, rx1, ry1, rx1[i+1], ry1[i+1], rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i += 2) {
  aalineRGBA(screen, rx2, ry1, rx2[i+1], ry1[i+1], rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<NUM_RANDOM; i += 2) {
  aalineRGBA(screen, rx2, ry2, rx2[i+1], ry2[i+1], rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<NUM_RANDOM; i += 2) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  aalineRGBA(screen, rx1, ry2, rx1+rr1, ry2+rr2, r, g, b, 255);
 }
}

void BenchmarkAALine(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];
 
 /* Draw A=255 */
 repeat=5;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i += 2) {
   aalineRGBA(screen, rx1, ry1, rx1[i+1], ry1[i+1], rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=5;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i += 2) {
   aalineRGBA(screen, rx2, ry1, rx2[i+1], ry1[i+1], rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);

}

void TestCircle(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  circleRGBA(screen, rx1, ry1, rr1, rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  circleRGBA(screen, rx2, ry1, rr1, rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  circleRGBA(screen, rx2, ry2, rr1, rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  circleRGBA(screen, rx1, ry2, rr1, r, g, b, 255);
 }
}

void BenchmarkCircle(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];
 
 /* Draw A=255 */
 repeat=20;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   circleRGBA(screen, rx1, ry1, rr1, rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=5;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   circleRGBA(screen, rx2, ry1, rr1, rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}

void TestAACircle(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  aacircleRGBA(screen, rx1, ry1, rr1, rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  aacircleRGBA(screen, rx2, ry1, rr1, rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  aacircleRGBA(screen, rx2, ry2, rr1, rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  aacircleRGBA(screen, rx1, ry2, rr1, r, g, b, 255);
 }
}

void BenchmarkAACircle(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];
 
 /* Draw A=255 */
 repeat=20;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   aacircleRGBA(screen, rx1, ry1, rr1, rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=5;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   aacircleRGBA(screen, rx2, ry1, rr1, rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}

void TestFilledCircle(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  filledCircleRGBA(screen, rx1, ry1, rr1, rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  filledCircleRGBA(screen, rx2, ry1, rr1, rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  filledCircleRGBA(screen, rx2, ry2, rr1, rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  filledCircleRGBA(screen, rx1, ry2, rr1, r, g, b, 255);
 }
}

void BenchmarkFilledCircle(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];
 
 /* Draw A=255 */
 repeat=20;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   filledCircleRGBA(screen, rx1, ry1, rr1, rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=5;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   filledCircleRGBA(screen, rx2, ry1, rr1, rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}

void TestEllipse(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  ellipseRGBA(screen, rx1, ry1, rr1, rr2, rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  ellipseRGBA(screen, rx2, ry1, rr1, rr2, rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  ellipseRGBA(screen, rx2, ry2, rr1, rr2, rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  ellipseRGBA(screen, rx1, ry2, rr1, rr2, r, g, b, 255);
 }
}

void BenchmarkEllipse(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];
 
 /* Draw A=255 */
 repeat=20;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   ellipseRGBA(screen, rx1, ry1, rr1, rr2, rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=5;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   ellipseRGBA(screen, rx2, ry1, rr1, rr2, rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}

void TestAAEllipse(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  aaellipseRGBA(screen, rx1, ry1, rr1, rr2, rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  aaellipseRGBA(screen, rx2, ry1, rr1, rr2, rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  aaellipseRGBA(screen, rx2, ry2, rr1, rr2, rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  aaellipseRGBA(screen, rx1, ry2, rr1, rr2, r, g, b, 255);
 }
}

void BenchmarkAAEllipse(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];
 
 /* Draw A=255 */
 repeat=20;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   ellipseRGBA(screen, rx1, ry1, rr1, rr2, rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=5;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   aaellipseRGBA(screen, rx2, ry1, rr1, rr2, rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}

void TestFilledEllipse(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  filledEllipseRGBA(screen, rx1, ry1, rr1, rr2, rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  filledEllipseRGBA(screen, rx2, ry1, rr1, rr2, rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  filledEllipseRGBA(screen, rx2, ry2, rr1, rr2, rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  filledEllipseRGBA(screen, rx1, ry2, rr1, rr2, r, g, b, 255);
 }
}

void BenchmarkFilledEllipse(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];
 
 /* Draw A=255 */
 repeat=20;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   filledEllipseRGBA(screen, rx1, ry1, rr1, rr2, rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=5;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   filledEllipseRGBA(screen, rx2, ry1, rr1, rr2, rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}

void TestPie(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  pieRGBA(screen, rx1, ry1, rr1, a1, a2, rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  pieRGBA(screen, rx2, ry1, rr1, a1, a2, rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  pieRGBA(screen, rx2, ry2, rr1, a1, a2, rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  pieRGBA(screen, rx1, ry2, rr1, a1, a2, r, g, b, 255);
 }
}

void BenchmarkPie(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];
 
 /* Draw A=255 */
 repeat=20;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   pieRGBA(screen, rx1, ry1, rr1, a1, a2, rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=5;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   pieRGBA(screen, rx2, ry1, rr1, a1, a2, rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}

void TestFilledPie(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  filledPieRGBA(screen, rx1, ry1, rr1, a1, a2, rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<NUM_RANDOM; i++) {
  filledPieRGBA(screen, rx2, ry1, rr1, a1, a2, rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  filledPieRGBA(screen, rx2, ry2, rr1, a1, a2, rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<NUM_RANDOM; i++) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  filledPieRGBA(screen, rx1, ry2, rr1, a1, a2, r, g, b, 255);
 }
}

void BenchmarkFilledPie(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];
 
 /* Draw A=255 */
 repeat=20;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   filledPieRGBA(screen, rx1, ry1, rr1, a1, a2, rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=5;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i++) {
   filledPieRGBA(screen, rx2, ry1, rr1, a1, a2, rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}

void TestPolygon(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<(NUM_RANDOM-3); i += 3) {
  polygonRGBA(screen, &rx1, &ry1, 3, rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<(NUM_RANDOM-3); i += 3) {
  polygonRGBA(screen, &rx2, &ry1, 3, rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<(NUM_RANDOM-3); i += 3) {
  polygonRGBA(screen, &rx2, &ry2, 3, rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<(NUM_RANDOM-3); i += 3) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  rx1[i+1]=rx1+rr1;
  rx1[i+2]=rx1;
  ry2[i+1]=ry2;
  ry2[i+2]=ry2+rr2;
  polygonRGBA(screen, &rx1, &ry2, 3, r, g, b, 255);
 }
}

void BenchmarkPolygon(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];

 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 repeat=50;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i += 3) {
   polygonRGBA(screen, &rx1, &ry1, 3, rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM-3)/3)*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=10;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i += 3) {
   polygonRGBA(screen, &rx2, &ry1, 3, rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM-3)/3)*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}

void TestAAPolygon(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<(NUM_RANDOM-3); i += 3) {
  aapolygonRGBA(screen, &rx1, &ry1, 3, rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<(NUM_RANDOM-3); i += 3) {
  aapolygonRGBA(screen, &rx2, &ry1, 3, rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<(NUM_RANDOM-3); i += 3) {
  aapolygonRGBA(screen, &rx2, &ry2, 3, rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<(NUM_RANDOM-3); i += 3) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  rx1[i+1]=rx1+rr1;
  rx1[i+2]=rx1;
  ry2[i+1]=ry2;
  ry2[i+2]=ry2+rr2;
  aapolygonRGBA(screen, &rx1, &ry2, 3, r, g, b, 255);
 }
}

void BenchmarkAAPolygon(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];

 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 repeat=5;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i += 3) {
   aapolygonRGBA(screen, &rx1, &ry1, 3, rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM-3)/3)*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=2;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i += 3) {
   aapolygonRGBA(screen, &rx2, &ry1, 3, rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM-3)/3)*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}


void TestFilledPolygon(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<(NUM_RANDOM-3); i += 3) {
  filledPolygonRGBA(screen, &rx1, &ry1, 3, rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<(NUM_RANDOM-3); i += 3) {
  filledPolygonRGBA(screen, &rx2, &ry1, 3, rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<(NUM_RANDOM-3); i += 3) {
  filledPolygonRGBA(screen, &rx2, &ry2, 3, rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<(NUM_RANDOM-3); i += 3) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  rx1[i+1]=rx1+rr1;
  rx1[i+2]=rx1;
  ry2[i+1]=ry2;
  ry2[i+2]=ry2+rr2;
  filledPolygonRGBA(screen, &rx1, &ry2, 3, r, g, b, 255);
 }
}

void BenchmarkFilledPolygon(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];

 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 repeat=20;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i += 3) {
   filledPolygonRGBA(screen, &rx1, &ry1, 3, rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM-3)/3)*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=5;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i += 3) {
   filledPolygonRGBA(screen, &rx2, &ry1, 3, rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM-3)/3)*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}

void TestBezier(SDL_Surface *screen)
{
 int i;
 char r,g,b;
 
 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 for (i=0; i<(NUM_RANDOM-3); i += 3) {
  bezierRGBA(screen, &rx1, &ry1, 3, 100, rr, rg, rb, 255);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 for (i=0; i<(NUM_RANDOM-3); i += 3) {
  bezierRGBA(screen, &rx2, &ry1, 3, 100, rr, rg, rb, ra);
 }

 /* Draw A=various */
 SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
 for (i=0; i<(NUM_RANDOM-3); i += 3) {
  bezierRGBA(screen, &rx2, &ry2, 3, 100, rr, rg, rb, ra);
 }

 /* Draw Colortest */
 SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
 for (i=0; i<(NUM_RANDOM-3); i += 3) {
  if (rx1 < (WIDTH/6))  {
   r=255; g=0; b=0; 
  } else if (rx1 < (WIDTH/3) ) {
   r=0; g=255; b=0; 
  } else {
   r=0; g=0; b=255; 
  }
  rx1[i+1]=rx1+rr1;
  rx1[i+2]=rx1;
  ry2[i+1]=ry2;
  ry2[i+2]=ry2+rr2;
  bezierRGBA(screen, &rx1, &ry2, 3, 100, r, g, b, 255);
 }
}

void BenchmarkBezier(SDL_Surface *screen)
{
 int i,j;
 int repeat;
 Uint32 time1, time2;
 char titletext[256];

 /* Create random points */
 srand(time(NULL));
 InitRandomPoints();
 
 /* Draw A=255 */
 repeat=20;
 SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i += 3) {
   bezierRGBA(screen, &rx1, &ry1, 3, 100, rr, rg, rb, 255);
  }
 }
 time2=SDL_GetTicks();
 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM-3)/3)*repeat)/(float)(time2-time1));
 stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
 
 /* Draw A=various */
 repeat=10;
 SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
 time1=SDL_GetTicks();
 for (j=0; j<repeat; j++) {
  for (i=0; i<NUM_RANDOM; i += 3) {
   bezierRGBA(screen, &rx2, &ry1, 3, 100, rr, rg, rb, ra);
  }
 }
 time2=SDL_GetTicks();

 /* Results */
 SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
 sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM-3)/3)*repeat)/(float)(time2-time1));
 stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}

/* ======== Main Program ======= */

int main(int argc, char *argv[])
{
	const SDL_VideoInfo *info;
	SDL_Surface *screen;
	Uint8  video_bpp;
	Uint32 videoflags;
	int done;
	SDL_Event event;
	int oldprim, curprim;
        
	/* Initialize SDL */
	if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
		fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
		exit(1);
	}
	atexit(SDL_Quit);

	/* Alpha blending doesn't work well at 8-bit color */
	info = SDL_GetVideoInfo();
	if ( info->vfmt->BitsPerPixel > 8 ) {
		video_bpp = info->vfmt->BitsPerPixel;
	} else {
		video_bpp = 16;
	}
	videoflags = SDL_SWSURFACE | SDL_SRCALPHA | SDL_RESIZABLE;
	while ( argc > 1 ) {
		--argc;
		if ( strcmp(argv[argc-1], "-bpp") == 0 ) {
			video_bpp = atoi(argv[argc]);
			--argc;
		} else
		if ( strcmp(argv[argc], "-hw") == 0 ) {
			videoflags |= SDL_HWSURFACE;
		} else
		if ( strcmp(argv[argc], "-warp") == 0 ) {
			videoflags |= SDL_HWPALETTE;
		} else
		if ( strcmp(argv[argc], "-fullscreen") == 0 ) {
			videoflags |= SDL_FULLSCREEN;
		} else {
			fprintf(stderr, 
			"Usage: %s [-bpp N] [-warp] [-hw] [-fullscreen]\n",
								argv[0]);
			exit(1);
		}
	}

	/* Set 640x480 video mode */
	if ( (screen=SDL_SetVideoMode(WIDTH,HEIGHT,video_bpp,videoflags)) == NULL ) {
		fprintf(stderr, "Couldn't set %ix%i video mode: %s\n",WIDTH,HEIGHT,SDL_GetError());
		exit(2);
	}


	
	/* Use alpha blending */
	SDL_SetAlpha(screen, SDL_SRCALPHA, 0);
	
	/* Set title for window */
 	SDL_WM_SetCaption("TestGfxPrimitives","TestGfxPrimitives");
 	
	/* Wait for a keystroke */
	done = 0;
	oldprim = 0;
	curprim = 1;
	while ( !done ) {

		/* Draw on screen if primitive changes */
		if (curprim != oldprim) {
		
			ClearScreen(screen, "Titletext");

			/* Draw according to curprim setting */
			switch (curprim) {
			
			 /* Pixels */
			 case 1:
		 	  ClearScreen(screen, "Pixel");
			  TestPixel(screen);
			  BenchmarkPixel(screen);
 			  /* Next primitive */
	 		  oldprim=curprim; 
			  break;
			 
			 /* Horizontal Lines */
			 case 2:
		 	  ClearScreen(screen, "Hline");
			  TestHline(screen);
			  BenchmarkHline(screen);
 			  /* Next primitive */
	 		  oldprim=curprim; 
 			  break;
 			  
 			 /* Vertical Lines */
			 case 3:
		 	  ClearScreen(screen, "Vline");
			  TestVline(screen);
			  BenchmarkVline(screen);
 			  /* Next primitive */
	 		  oldprim=curprim; 
			  break;
			 
			 /* Rectangles */
			 case 4:
		 	  ClearScreen(screen, "Rectangle");
			  TestRectangle(screen);
			  BenchmarkRectangle(screen);
 			  /* Next primitive */
	 		  oldprim=curprim; 
			  break;

			 /* --- Box */
			 case 5:
		 	  ClearScreen(screen, "Box");
			  TestBox(screen);
			  BenchmarkBox(screen);
 			  /* Next primitive */ 			  
	 		  oldprim=curprim; 
			  break;

			 /* --- 2x2 Box */
			 case 6:
		 	  ClearScreen(screen, "2x2 Box");
			  TestBoxTwo(screen);
			  BenchmarkBoxTwo(screen);
 			  /* Next primitive */ 			  
	 		  oldprim=curprim; 
			  break;
			  
			 /* --- Lines */
			 case 7:
		 	  ClearScreen(screen, "Line");
			  TestLine(screen);
			  BenchmarkLine(screen);
 			  /* Next primitive */
	 		  oldprim=curprim; 
			  break;

			 /* --- AA Line */
			 case 8:
		 	  ClearScreen(screen, "Anti-Aliased Line");
			  TestAALine(screen);
			  BenchmarkAALine(screen);
 			  /* Next primitive */
	 		  oldprim=curprim; 
			  break;
			  
			 /* --- Circle */
			 case 9:
		 	  ClearScreen(screen, "Circle");
			  TestCircle(screen);
			  BenchmarkCircle(screen);			 
 			  /* Next primitive */
	 		  oldprim=curprim; 
			  break;

			 /* --- AA Circle */
			 case 10:
		 	  ClearScreen(screen, "AA Circle");
			  TestAACircle(screen);
			  BenchmarkAACircle(screen);			 
 			  /* Next primitive */
	 		  oldprim=curprim; 
			  break;
			  
			 /* --- Filled Circle */
			 case 11:
		 	  ClearScreen(screen, "Filled Circle");
			  TestFilledCircle(screen);
			  BenchmarkFilledCircle(screen);
 			  /* Next primitive */
	 		  oldprim=curprim; 
			  break;

			 /* --- Ellipse */
			 case 12:
		 	  ClearScreen(screen, "Ellipse");
			  TestEllipse(screen);
			  BenchmarkEllipse(screen);
 			  /* Next primitive */
	 		  oldprim=curprim; 
			  break;

			 /* --- AA Ellipse */
			 case 13:
		 	  ClearScreen(screen, "AA Ellipse");
			  TestAAEllipse(screen);
			  BenchmarkAAEllipse(screen);
 			  /* Next primitive */
	 		  oldprim=curprim; 
			  break;

			 /* --- Filled Ellipse */
			 case 14:
		 	  ClearScreen(screen, "Filled Ellipse");
			  TestFilledEllipse(screen);
			  BenchmarkFilledEllipse(screen);
 			  /* Next primitive */ 			  
	 		  oldprim=curprim; 
			  break;

			 /* --- Pie */
			 case 15:
		 	  ClearScreen(screen, "Pie");
			  TestPie(screen);
			  BenchmarkPie(screen);
 			  /* Next primitive */ 			  
	 		  oldprim=curprim; 
			  break;

			 /* --- Filled Pie */
			 case 16:
		 	  ClearScreen(screen, "Filled Pie");
			  TestFilledPie(screen);
			  BenchmarkFilledPie(screen);
 			  /* Next primitive */ 			  
	 		  oldprim=curprim; 
			  break;

			 /* --- Polygon */
			 case 17:
		 	  ClearScreen(screen, "Polygon");
			  TestPolygon(screen);
			  BenchmarkPolygon(screen);
 			  /* Next primitive */ 			  
	 		  oldprim=curprim; 
			  break;
			 
			 /* --- AA-Polygon */
			 case 18:
		 	  ClearScreen(screen, "AA-Polygon");
			  TestAAPolygon(screen);
			  BenchmarkAAPolygon(screen);
 			  /* Next primitive */ 			  
	 		  oldprim=curprim; 
			  break;
			 
			 /* ---- Filled Polygon */ 
			 case 19:
		 	  ClearScreen(screen, "Filled Polygon");
			  TestFilledPolygon(screen);
			  BenchmarkFilledPolygon(screen);
 			  /* Next primitive */ 			  
	 		  oldprim=curprim; 
			  break;

			 /* ---- Bezier Curve */ 
			 case 20:
		 	  ClearScreen(screen, "Bezier Curve");
			  TestBezier(screen);
			  BenchmarkBezier(screen);
 			  /* Next primitive */ 			  
	 		  oldprim=curprim; 
			  break;
			  
			 /* --- Reset */ 
			 default:
			  oldprim=0;
			  curprim=1;
			  break;
			}
			
			/* Show */
			SDL_UpdateRect(screen, 0, 0, 0, 0);
		}
		
		/* Slow down polling */
		SDL_Delay(100);
		
		/* Check for events */
		while ( SDL_PollEvent(&event) ) {
			switch (event.type) {
				case SDL_MOUSEBUTTONDOWN:
					if ( event.button.button == 1 ) {
						/* Switch to next graphics */
						curprim++;
					}
					break;
				case SDL_KEYDOWN:
					/* Any keypress quits the app... */
				case SDL_QUIT:
					done = 1;
					break;
				default:
					break;
			}
		}
	}

	return(0);
}

Compiler output:
------ Build started: Project: Temp2, Configuration: Debug Win32 ------

Compiling...
TestGfxPrimitives.c
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(103) : warning C4305: '=' : truncation from 'double' to 'float'
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(104) : warning C4305: '=' : truncation from 'double' to 'float'
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(109) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(124) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(126) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(128) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(130) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(132) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(143) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(198) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(214) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(223) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(278) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(294) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(304) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(359) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(375) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(385) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(440) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(456) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(466) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(521) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(537) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(547) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(602) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(618) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(628) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(683) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(699) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(710) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(765) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(781) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(791) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(846) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(862) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(871) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(926) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(942) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(951) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1006) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1022) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1031) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1086) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1102) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1111) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1166) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1182) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1191) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1246) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1262) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1271) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1326) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1342) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1351) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1406) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1422) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1431) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1478) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1494) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1510) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1519) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1566) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1582) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1598) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1608) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1655) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1671) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1687) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1696) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1743) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1759) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1775) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
Linking...
msvcrt.lib(MSVCR71.dll) : error LNK2005: _exit already defined in LIBCD.lib(crt0dat.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _strncpy already defined in LIBCD.lib(strncpy.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _fprintf already defined in LIBCD.lib(fprintf.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _fclose already defined in LIBCD.lib(fclose.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: __isctype already defined in LIBCD.lib(isctype.obj)
LIBCD.lib(crt0init.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__stringRGBA referenced in function _ClearScreen
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__vlineRGBA referenced in function _ClearScreen
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__hlineRGBA referenced in function _ClearScreen
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__pixelRGBA referenced in function _ClearScreen
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__rectangleRGBA referenced in function _TestRectangle
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__boxRGBA referenced in function _TestBoxTwo
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__lineRGBA referenced in function _TestLine
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__aalineRGBA referenced in function _TestAALine
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__circleRGBA referenced in function _TestCircle
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__aacircleRGBA referenced in function _TestAACircle
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__filledCircleRGBA referenced in function _TestFilledCircle
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__ellipseRGBA referenced in function _TestEllipse
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__aaellipseRGBA referenced in function _TestAAEllipse
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__filledEllipseRGBA referenced in function _TestFilledEllipse
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__pieRGBA referenced in function _TestPie
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__filledPieRGBA referenced in function _TestFilledPie
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__polygonRGBA referenced in function _TestPolygon
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__aapolygonRGBA referenced in function _TestAAPolygon
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__filledPolygonRGBA referenced in function _TestFilledPolygon
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__bezierRGBA referenced in function _TestBezier
Debug/Temp2.exe : fatal error LNK1120: 20 unresolved externals

Build log was saved at "file://d:\Documents\Cpp\Temp2\Debug\BuildLog.htm"
Temp2 - 26 error(s), 73 warning(s)


---------------------- Done ----------------------

    Build: 0 succeeded, 1 failed, 0 skipped



Share this post


Link to post
Share on other sites
Advertisement
It looks to me as though you havn't told the linker where to look for the libraries. You have the right headers but the implementation isn't found. So check the settings of the solution. If you have never done this before just say and i will check back with the instructions on setting the library.

Hope the helps,

ace

Share this post


Link to post
Share on other sites
I unzipped all the headers and .c files related to the sgl primitives stuff into a folder. Then I added that folder in Tools -> Options -> Projects -> VC++ Directories -> Include. And I cant find any .lib files in the zipped file I downloaded so it shouldnt be something like that that Ive forgotten.

Share this post


Link to post
Share on other sites
Mizipzor,

Well, the first 5 linker errors are occuring because you are linking against two different runtime libraries. Don't add the msvcrt.lib, just change the runtime type under project->properties->Code generation, and check out the runtime.

The others are functions that the compiler can't find definitions for, so make sure that you have all the source files included/functions at least stubbed/right library files included. Google should help you out with that.

-brad

Share this post


Link to post
Share on other sites
Ok Ive changed it to a multithreaded debug application now. The errors Im getting now are these:


------ Build started: Project: Temp2, Configuration: Debug Win32 ------

Compiling...
TestGfxPrimitives.c
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(102) : warning C4305: '=' : truncation from 'double' to 'float'
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(103) : warning C4305: '=' : truncation from 'double' to 'float'
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(108) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(123) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(125) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(127) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(129) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(131) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(142) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(197) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(213) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(222) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(277) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(293) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(303) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(358) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(374) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(384) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(439) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(455) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(465) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(520) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(536) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(546) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(601) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(617) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(627) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(682) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(698) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(709) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(764) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(780) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(790) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(845) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(861) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(870) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(925) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(941) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(950) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1005) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1021) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1030) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1085) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1101) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1110) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1165) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1181) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1190) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1245) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1261) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1270) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1325) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1341) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1350) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1405) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1421) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1430) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1477) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1493) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1509) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1518) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1565) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1581) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1597) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1607) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1654) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1670) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1686) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1695) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1742) : warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1758) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
d:\Documents\CPP\SDL_gfx-2.0.13\Test\TestGfxPrimitives.c(1774) : warning C4267: 'function' : conversion from 'size_t' to 'Sint16', possible loss of data
Linking...
msvcrt.lib(MSVCR71.dll) : error LNK2005: _exit already defined in LIBCMTD.lib(crt0dat.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _strncpy already defined in LIBCMTD.lib(strncpy.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _fprintf already defined in LIBCMTD.lib(fprintf.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _fclose already defined in LIBCMTD.lib(fclose.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: __isctype already defined in LIBCMTD.lib(isctype.obj)
LIBCMTD.lib(crt0init.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__stringRGBA referenced in function _ClearScreen
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__vlineRGBA referenced in function _ClearScreen
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__hlineRGBA referenced in function _ClearScreen
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__pixelRGBA referenced in function _ClearScreen
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__rectangleRGBA referenced in function _TestRectangle
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__boxRGBA referenced in function _TestBoxTwo
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__lineRGBA referenced in function _TestLine
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__aalineRGBA referenced in function _TestAALine
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__circleRGBA referenced in function _TestCircle
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__aacircleRGBA referenced in function _TestAACircle
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__filledCircleRGBA referenced in function _TestFilledCircle
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__ellipseRGBA referenced in function _TestEllipse
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__aaellipseRGBA referenced in function _TestAAEllipse
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__filledEllipseRGBA referenced in function _TestFilledEllipse
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__pieRGBA referenced in function _TestPie
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__filledPieRGBA referenced in function _TestFilledPie
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__polygonRGBA referenced in function _TestPolygon
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__aapolygonRGBA referenced in function _TestAAPolygon
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__filledPolygonRGBA referenced in function _TestFilledPolygon
TestGfxPrimitives.obj : error LNK2019: unresolved external symbol __imp__bezierRGBA referenced in function _TestBezier
Debug/Temp2.exe : fatal error LNK1120: 20 unresolved externals

Build log was saved at "file://d:\Documents\Cpp\Temp2\Debug\BuildLog.htm"
Temp2 - 26 error(s), 73 warning(s)


---------------------- Done ----------------------

Build: 0 succeeded, 1 failed, 0 skipped





Dont know if there is any real change though. And I dont know if Im linking to the SDL.dll, Im still quite an beginner with c++. But Ive added SDL.lib and SDLmain.lib in the linker command line if thats the thing that refers to the dll file somehow. When I did some SDL tutorials I learnt that I should place the SDL.dll in the windows/system32 folder.

This confuses me though:


msvcrt.lib(MSVCR71.dll) : error LNK2005: _exit already defined in LIBCMTD.lib(crt0dat.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _strncpy already defined in LIBCMTD.lib(strncpy.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _fprintf already defined in LIBCMTD.lib(fprintf.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _fclose already defined in LIBCMTD.lib(fclose.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: __isctype already defined in LIBCMTD.lib(isctype.obj)
LIBCMTD.lib(crt0init.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library


I cant recall Ive added that .lib file somewhere, how do I take it away? Assuming I dont need it.

Share this post


Link to post
Share on other sites
What libraries are you linking against? You can find this out by going to the project settings->Linker->Input. This should help clarify what is going on and why your getting those errors.

-brad

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!