Exemple #1
0
/*******************************************************************************
 Display_Str: Display String   Input: x, y , Color, Mode, String  
*******************************************************************************/
void Display_Str(unsigned short x0, unsigned short y0, unsigned short Color, unsigned char Mode, unsigned const char *s)
{ 
  signed short i, j, b; 
  Point_SCR(x0, y0);
  for (j=0; j<14;++j) { 
    Set_Pixel(Mode?Color:BLACK);
  }
  x0++;        
  while (*s!=0) {
    unsigned const short *scanline=Char_Dot+((*s-0x22)*8);
    for(i=0;i<8;++i){
      Point_SCR(x0+i, y0);
      if((*s==0x20)||(*s==0x21)) b=0x0000;
      else                       b=scanline[i];
      if((*s==0x21)&&(i==4)) break;
      for(j=0;j<14;++j){
        if (b&4) {
          Set_Pixel(Mode?BLACK:Color);
        } else {
          Set_Pixel(Mode?Color:BLACK);
        }
        b>>=1;
      }
    }
    if(*s==0x21) x0 +=4;       
    else  x0 += 8;             
    ++s;                           //next character
  }
}
Exemple #2
0
/*******************************************************************************
 Display_Logo: Display Logo   Input: X, Y 
*******************************************************************************/
void Display_Logo(unsigned short Dot_x, unsigned short Dot_y)
{ 
  unsigned short i, j, k, l, Color, b;

  Color = BLUE;
  k = 2;
  for (j=0; j < Logo_Dot[1]; j++) {
    for (i=0; i < Logo_Dot[0]; i++) {
      b = Logo_Dot[k];
      for (l = 0; l < 16; l++) {
        if (b & 1) {
          Point_SCR(Dot_x + i * 16 + l, Dot_y + Logo_Dot[1] - j);
          Set_Pixel(Color);
        }
        b =  b >> 1;
        if (b == 0) break;
      }
      k++;
    }
  }
  
  Color = WHITE;
  for (i=0; i<320; ++i)
  {
    Point_SCR(i, 0);
    Set_Pixel(Color);
    Point_SCR(i, 239);
    Set_Pixel(Color);
  }

  for (i=3; i<317; ++i)
  {
    Point_SCR(i, 3);
    Set_Pixel(Color);
    Point_SCR(i, 236);
    Set_Pixel(Color);
  }

  Point_SCR(0, 0);
  for (j=0; j<240; ++j) Set_Pixel(Color);
  Point_SCR(3, 3);
  for (j=3; j<237; ++j) Set_Pixel(Color);
  Point_SCR(316, 3);
  for (j=3; j<237; ++j) Set_Pixel(Color);
  Point_SCR(319, 0);
  for (j=0; j<240; ++j) Set_Pixel(Color);
}
Exemple #3
0
void fractale_julia(void){
	int x = 0, y = 0, i = 0, iMax = 50;
	double xMin, xMax, yMin, yMax, img_Largeur, img_Hauteur, zoom,  buffer;
	Uint32 couleur;
	struct Complexe c, z;
    xMin = -img_Largeur/(2*zoom);
	xMax = img_Largeur/(2*zoom);
	yMin =  -img_Hauteur/(2*zoom);
	yMax =  img_Hauteur/(2*zoom);


	zoom = 200;
	img_Largeur = 600;
	img_Hauteur = 600;

	c.reel = -0.0519;
	c.imaginaire = 0.688;

    SDL_Surface *ecran = Init_SDL();
     ecran = SDL_SetVideoMode(img_Largeur, img_Hauteur, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);


	for (x = 0; x < img_Largeur; x++) {
		for (y = 0; y < img_Hauteur; y++) {
			z.reel = x/zoom  + xMin;
			z.imaginaire = y/zoom  + yMin;
			i = 0;

				do {
					buffer = z.reel;
					z.reel = pow(z.reel, 2) - pow(z.imaginaire, 2) + c.reel;
					z.imaginaire = 2*buffer*z.imaginaire + c.imaginaire;
					i++;
			} while ((pow(z.reel, 2) + pow(z.imaginaire, 2)) < 4 && i < iMax);

			if (i == iMax)
				couleur = 0;
			else {
				couleur = i*iMax*100;
			}
			Set_Pixel(ecran, x,  y, couleur);

		}
		SDL_UpdateRect(ecran,0,0,0,0);
	}


pause();
atexit(SDL_Quit);
}
Exemple #4
0
/*******************************************************************************
 Clear Screen 
*******************************************************************************/
void Clear_Screen(unsigned short Color)						
{ 
  unsigned int i; 
  Point_SCR(0, 0);    //X_pos=0, Y_pos=0
  for(i=0;i<240*320;++i) Set_Pixel(Color);
}