All pastes #476612 Raw Edit

Mirchiss

public cpp v1 · immutable
·published 2007-05-08 06:47 UTC
rendered paste body
#include <SDL/SDL.h>#include <windows.h>/* PLEASE NOTE: the program will require SDL.dll which is located in              dev-c++'s dll directory. You have to copy it to you			  program's home directory or the path. *//* The screen surface */SDL_Surface *screen = NULL;/* This function draws to the screen; replace this with your own code! */void Draw_poly (float X, float Y){    SDL_Rect rect;    Uint32 color;    int value = 150;    rect.x = X;    rect.y = Y;    rect.w = 1;    rect.h = 1;        //char Temp[100];    //sprintf(Temp,"X:%d Y:%d %:%d",rect.x,rect.y, (rect.y*100)/(480*100) );        //SDL_WM_SetCaption (Temp, NULL);        if( Y*1.33 > (X))    {         value = ((Y*1.33)-(X))/2;        if(value > 255) value = 255;                color = SDL_MapRGB (screen->format, value, value, 0);     }        if( Y*1.33 < (X))    {         value= ((X)-(Y*1.33))/2;        if(value > 255) value = 255;        color = SDL_MapRGB (screen->format, 0, 0, value);     }    SDL_FillRect (screen, &rect, color);}int main (int argc, char *argv[]){    int done;        int i=0, j=0;    /* Initialize SDL */    if (SDL_Init (SDL_INIT_VIDEO) < 0)    {    }    /* Set 640x480 16-bits video mode */    screen = SDL_SetVideoMode (800, 600, 24, SDL_SWSURFACE | SDL_DOUBLEBUF);    if (screen == NULL)    {    }        SDL_WM_SetCaption ("SDL MultiMedia Application", NULL);        SDL_Rect BG;    BG.h = 600;    BG.w = 800;    BG.y=0;    BG.x=0;        SDL_FillRect (screen, &BG , SDL_MapRGB (screen->format, 0, 0, 0));    done = 0;        while (!done)    {                //1024, 768        i=0;        while (i < 600 && !done)        {			j=0;            while (j < 800 && !done)			{               SDL_Event event;               /* Check for events */               while (SDL_PollEvent (&event))               {                  switch (event.type)                  {                      case SDL_KEYDOWN:                      break;                      case SDL_QUIT:                      done = 1;                      break;                      default:                      break;                  }               }                               Draw_poly( j, i);               j++;							}			i++;        }        SDL_Flip( screen);    }        return 0;}