예제 #1
0
void worm::render_flip(BITMAP* where, int frame, int _x, int _y)
{
  int r,g,c,R,G,B,i;
  float h1,s1,v1,h,s,v;
  for (i=0;i<skin->img[frame]->w;i++)
  {
    for (r=0;r<skin->img[frame]->h;r++)
    {
      g=getpixel(skin->img[frame],i,r);
      c=getpixel(mask->img[frame],i,r);
      if(g!=makecol(255,0,255))
      {
        if(c!=makecol(255,0,255))
        {
          c=color;
          rgb_to_hsv(getr(c), getg(c), getb(c), &h1, &s1, &v1);
          
          R = getr(g);
          G = getg(g);
          B = getb(g);
          
          rgb_to_hsv(R, G, B, &h, &s, &v);
          h = h1;
          s = s1;
          v -= (1-v1)/1.4;
          if (v<0)v=0;
          
          hsv_to_rgb(h,s,v, &R, &G, &B);
          g = makecol(R,G,B);
          putpixel(where,_x+skin->img[frame]->w-1-i,_y+r,g);
        }else putpixel(where,_x+skin->img[frame]->w-1-i,_y+r,g);
      };
    };
  };
};
예제 #2
0
void draw_button(BITMAP *bmp, int x, int y, int w, int h, int col, const char *txt, bool selected, bool disabled)
{
	int col1 = makecol( minf(255,getr(col)*1.3f), minf(255,getg(col)*1.3f), minf(255,getb(col)*1.3f) );
	int col2 = makecol( getr(col)*0.7f, getg(col)*0.7f, getb(col)*0.7f );
	int col3 = makecol( minf(255,getr(col)*1.7f), minf(255,getg(col)*1.7f), minf(255,getb(col)*1.7f) );

	if(disabled)
	{
		col1 = makecol(130,130,130);
		col2 = makecol(50,50,50);
		col3 = makecol(170,170,170);
		col = makecol(100,100,100);
	}
	else if(selected)
	{
		rect(bmp, x-2,y-2, x+w+3,y+h+3, makecol(210,210,0));
		rect(bmp, x-1,y-1, x+w+2,y+h+2, makecol(255,255,0));
		col3 = makecol(255,255,255);
	}
	
	rectfill(bmp, x,y, x+w,y+h, col);
	line(bmp, x,y, x+w,y, col1);
	line(bmp, x+w,y, x+w,y+h, col1);
	line(bmp, x,y+1, x+w,y+1, col1);
	line(bmp, x+w+1,y, x+w+1,y+h, col1);	
	
	line(bmp, x,y+h, x+w,y+h, col2);
	line(bmp, x,y, x,y+h, col2);	
	line(bmp, x,y+h+1, x+w,y+h+1, col2);
	line(bmp, x+1,y, x+1,y+h, col2);

	textout_ex(bmp, font2, txt, x + (w/2) - (text_length(font2,txt)/2), y + (h/2) - (text_height(font2)/2), col3, -1);
}
예제 #3
0
/*
 * Interpolate between two colors
 * Pass 0.0-1.0 for 100% color1 -> 100% color2
 */ 
int aWgtInterpolateColor(float ratio, int color1, int color2)
{
	int r1 = getr(color1);
	int g1 = getg(color1);
	int b1 = getb(color1);
	int r = +(int)(r1 + ((getr(color2) - r1) * ratio));
	int g = +(int)(g1 + ((getg(color2) - g1) * ratio));
	int b = +(int)(b1 + ((getb(color2) - b1) * ratio));

	return makecol(r, g, b);
}
예제 #4
0
int blend_color(int from, int to, double t)
{
  int r = getr(from) + static_cast<int>((getr(to) - getr(from)) * t);
  int g = getg(from) + static_cast<int>((getg(to) - getg(from)) * t);
  int b = getb(from) + static_cast<int>((getb(to) - getb(from)) * t);
  int a = geta(from) + static_cast<int>((geta(to) - geta(from)) * t);
  return makeacol(MID(0, r, 255),
		  MID(0, g, 255),
		  MID(0, b, 255),
		  MID(0, a, 255));
}
예제 #5
0
void main()
{
	int color[4], myset[4], pix, d;
	BITMAP * caixa;
	allegro_init();
	install_keyboard();
	set_color_depth(32);
 
	set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
 

	myset[0] = 130;
	myset[1] = 195;
	myset[2] = 195;
	caixa = load_bitmap( "Default.bmp", NULL);
	for (int y = 0; y < caixa->h; y++)
         for (int x = 0; x < caixa->w; x++)
		{
			d = 0;
			pix = getpixel(caixa, x, y);
			color[0] = getr(pix);
			color[1] = getg(pix);
			color[2] = getb(pix);
			for (int i = 0; i<3; i++)
				d+=(color[i]-myset[i])*(color[i]-myset[i]);
			if (d<100)
			  putpixel(caixa, x, y, 0);
		}

	draw_sprite(screen, caixa, 0, 0);

	while(!key[KEY_ESC])    
        rest(50);
}
예제 #6
0
/*
 * Make a color brighter
 */
int aWgtHighlight(int color)
{
	int r = MIN(255, getr(color) + frameHighlightAmount);
	int g = MIN(255, getg(color) + frameHighlightAmount);
	int b = MIN(255, getb(color) + frameHighlightAmount);
	return makecol(r, g, b);
}
예제 #7
0
/*
 * Make a color darker
 */
int aWgtDarken(int color)
{
	int r = MAX(0, getr(color) - frameDarkenAmount);
	int g = MAX(0, getg(color) - frameDarkenAmount);
	int b = MAX(0, getb(color) - frameDarkenAmount);
	return makecol(r, g, b);
}
예제 #8
0
파일: dpchk.c 프로젝트: Ahmah2009/golang
static char*
getquoted(void)
{
	int c;
	Rune r;
	Fmt fmt;

	c = getnsc();
	if(c != '"')
		return nil;
	fmtstrinit(&fmt);
	for(;;) {
		r = getr();
		if(r == '\n') {
			free(fmtstrflush(&fmt));
			return nil;
		}
		if(r == '"')
			break;
		fmtrune(&fmt, r);
	}
	free(lastfmt);
	lastfmt = fmtstrflush(&fmt);
	return strdup(lastfmt);
}
예제 #9
0
파일: qphaccel.c 프로젝트: Yurand/tw-light
/* photon_clear_to_color:
 *  Accelerated screen clear routine.
 */
static void photon_clear_to_color(BITMAP *bmp, int color)
{
   struct Ph_rect dest_rect = {
      { bmp->cl + bmp->x_ofs,
        bmp->ct + bmp->y_ofs },
      { bmp->x_ofs + bmp->cr,
        bmp->y_ofs + bmp->cb }
   };

   struct BITMAP *parent;

   /* find parent */
   parent = bmp;
   while (parent->id & BMP_ID_SUB)
      parent = (BITMAP *)parent->extra;

   /* set fill color */
   /* if (bmp->vtable->color_depth == 8)
      PgSetFillColor(color);
   else */
      PgSetFillColor(PgRGB(getr(color), getg(color), getb(color)));
      
   PhDCSetCurrent(BMP_EXTRA(parent)->context);
   PgDrawRect(&dest_rect, Pg_DRAW_FILL);

   if (parent == pseudo_screen)
      ph_update_window(&dest_rect);
   else
      PgFlush();
}
void CrayonLine(BITMAP* bmp, Vector start, Vector end, int colour, float wobble, float amplitude, int inner_radius, int outer_radius, float hardness)
{
    Vector line_tangent = end - start;
    if (rand()%2 == 0) // If the normal is a randomised then it should result in the lines starting off on different direction wobbles
        crayon_line_normal = Vector(-line_tangent.Y(), line_tangent.X());
    else
        crayon_line_normal = Vector(line_tangent.Y(), -line_tangent.X());

    crayon_line_normal *= (1/crayon_line_normal.Mag());
    prev_crayon_x = start.XInt();
    prev_crayon_y = start.YInt();
    crayon_line_wobble = wobble;
    crayon_line_wobble_amplitude = amplitude;
    crayon_line_inner_radius = inner_radius;
    crayon_line_outer_radius = outer_radius;

    int fg_r = getr(colour), fg_g = getg(colour), fg_b = getb(colour);
    int bg_r = (256 - fg_r)*hardness + fg_r, bg_g = (256 - fg_g)*hardness + fg_g, bg_b = (256 - fg_b)*hardness + fg_b;

    crayon_fade_colour = makecol(bg_r, bg_g, bg_b);

    points_down_line = 0;
    do_line(bmp, start.XInt(), start.YInt(), end.XInt(), end.YInt(), colour, CrayonBackLine);
    points_down_line = 0;
    prev_crayon_x = start.XInt();
    prev_crayon_y = start.YInt();
    do_line(bmp, start.XInt(), start.YInt(), end.XInt(), end.YInt(), colour, CrayonFrontLine);
}
예제 #11
0
void RotatingLaser::calculate()
{
	STACKTRACE;
	if ( !(mother && mother->exists()) ) {
		state = 0;
		mother = 0;

		return;
	}

	relangle += laser_turn_rate * frame_time;
	relative_angle = relangle;
	rel_pos = rotate(relpos, relangle);

	angle = normalize(mother->angle + mother->turn_step + relangle, PI2);
	//	pos = mother->pos + rotate(relpos, angle+relangle-PI/2);
	//	vel = mother->vel;

	double a = 1.0 - double(frame) / frame_count;
	length = default_length * a;

	int r, g, b;
	r = getr(default_color);
	g = getg(default_color);
	b = getb(default_color);
	r *= iround(a);
	b *= iround(a);
	color = makecol(r,g,b);

	Laser::calculate();
}
예제 #12
0
void PremultipleChannels()
{
    for (int i = 0; i < skin.iWidth * skin.iHeight; i++)
        skin.colBits[i] = rgba(	getr(skin.colBits[i])*geta(skin.colBits[i])/255,
                                getg(skin.colBits[i])*geta(skin.colBits[i])/255,
                                getb(skin.colBits[i])*geta(skin.colBits[i])/255,
                                geta(skin.colBits[i]));
}
예제 #13
0
int to_system(Color color)
{
  if (is_transparent(color))
    return -1;
  else
    return makecol(getr(color),
                   getg(color),
                   getb(color));
}
예제 #14
0
BITMAP* Resource::getBitmap(const std::string &filename, unsigned int color)
{
	std::string key = filename + toString(color);

	if (mBitmaps.find(key) == mBitmaps.end())
    {
	    BITMAP* bitmap = load_bitmap(getRealFilename(filename).c_str(), NULL);
		
		if (bitmap == NULL) 
		{
			throw std::string("Unable to load: ") + getRealFilename(filename);
		}

		unsigned int colorR = getr(color);
		unsigned int colorG = getg(color);
		unsigned int colorB = getb(color);
		unsigned int magicPink = makecol(255, 0, 255);

		for(int y = 0; y < bitmap->h; ++y) {
			for(int x = 0; x < bitmap->w; ++x) {
				unsigned int c = getpixel(bitmap, x, y);
				if(c != magicPink) {
					unsigned int r = getr(c);
					unsigned int g = getg(c);
					unsigned int b = getb(c);

					r = (colorR * r) / 255;
					g = (colorG * g) / 255;
					b = (colorB * b) / 255;
					c = makecol(r, g, b);

					putpixel(bitmap, x, y, c);
				}
			}
		}



        mBitmaps[key] = bitmap;
    }

    return mBitmaps[key];
}
예제 #15
0
void foreground_set_color_from_rgb  ( guint color )
{
   foreground_color.red   = getr(color);
   foreground_color.red   <<= 8;
   foreground_color.green = getg(color);
   foreground_color.green <<= 8;
   foreground_color.blue  = getb(color);
   foreground_color.blue  <<= 8;
   foreground_show ();
   /*g_debug("%s %d", __FILE__, __LINE__);*/
}
예제 #16
0
파일: font-ttf.c 프로젝트: tsmolar/emufe
void fnt_ttf_draw_bitmap_blend( FT_Bitmap* fbitmap, BITMAP *b, FT_Int x, FT_Int y, int color) {
   
   // Simple render
   
   FT_Int  i, j, p, q;
   FT_Int  x_max = x + fbitmap->width;
   FT_Int  y_max = y + fbitmap->rows;
   int pix;
   int bmc, bmr, bmg, bmb;
//   int bgr, bgg, bgb, fac;
   int pnr, png, pnb, opr, opg, opb, opc;
   
   pnr=getr(color);
   png=getg(color);
   pnb=getb(color);
   
   for ( i = x, p = 0; i < x_max; i++, p++ ) {
      for ( j = y, q = 0; j < y_max; j++, q++ ) {
//	 if ( i >= WIDTH || j >= HEIGHT )
//	   continue;

	 bmc=getpixel(b,i,j);
	 bmr=getr(bmc);	 bmg=getg(bmc);	 bmb=getb(bmc);
	 
	 pix = fbitmap->buffer[q * fbitmap->width + p];

	 if(pix>0) {
	    opr=fnt_blendfunc(bmr,pnr,pix);
	    opg=fnt_blendfunc(bmg,png,pix);
	    opb=fnt_blendfunc(bmb,pnb,pix);
	    
	    opc=makecol(opr,opg,opb);
	    putpixel(b,i,j,opc);
	 }
      }	
   }   
//#ifdef USESDL
////   if(b==screen)
//     SDL_UpdateRect(b,x,y,x_max-x,y_max-y);
//#endif
}
예제 #17
0
void Tanque::MovaDireita(BITMAP *db)
{   

//aqui a mesma coisa ... so qe nao funciona nao  pq nao tem o maldito if ;;
   int r =  getr(getpixel(db, col+velocidade, lin));
   int g =  getg(getpixel(db, col+velocidade, lin));
   int b =  getb(getpixel(db, col+velocidade, lin));
    // Verifica colisão com lateral
   col+=velocidade;
   if ( col >= (SCREEN_W - img->w + 4) )
      col = SCREEN_W - img->w + 4; 
}
예제 #18
0
void Tanque::MovaCima(BITMAP *db)
	{
   // iden ...
   int r =  getr(getpixel(db, col-velocidade, lin));
   int g =  getg(getpixel(db, col-velocidade, lin));
   int b =  getb(getpixel(db, col-velocidade, lin));

   lin-=velocidade;
   //evia que o tanque saia  da tela por cima
   if ( lin <= 50 )
      lin = 50;
}
예제 #19
0
void ColorizeBitmap()
{
    if (!skin.colBits)
        return;

    GdiFlush();

    int w = skin.iWidth;
    int h = skin.iHeight;

    // we should swap B and R channels when working with win32 COLORREF
    float koef1r = (255 - getb(opt.colBg)) / 128.0;
    float koef1g = (255 - getg(opt.colBg)) / 128.0;
    float koef1b = (255 - getr(opt.colBg)) / 128.0;

    int br = - 255 + 2 * getb(opt.colBg);
    int bg = - 255 + 2 * getg(opt.colBg);
    int bb = - 255 + 2 * getr(opt.colBg);

    float koef2r = (getb(opt.colBg)) / 128.0;
    float koef2g = (getg(opt.colBg)) / 128.0;
    float koef2b = (getr(opt.colBg)) / 128.0;

    for (int i = 0; i < w * h; i++) {
        long alpha = geta(skin.colBits[i]);
        COLOR32 cl = alpha ? getr(skin.colBits[i])*255/alpha : 0;

        skin.colBits[i] = (cl > 128) ?
                          rgba(
                              PU_DIV255((koef1r * cl + br)*alpha),
                              PU_DIV255((koef1g * cl + bg)*alpha),
                              PU_DIV255((koef1b * cl + bb)*alpha),
                              alpha):
                          rgba(
                              PU_DIV255(koef2r * cl * alpha),
                              PU_DIV255(koef2g * cl * alpha),
                              PU_DIV255(koef2b * cl * alpha),
                              alpha);
    }
}
예제 #20
0
파일: misc.c 프로젝트: arvidfm/fiend
void make_pickup_message(char *string,BITMAP *pic,int time)
{
	int i,j;
	int color;
	int val;
	int r,g,b;

	if(pickup.buffer==NULL)
	{
		pickup.buffer = create_bitmap(480, 50);
	}
	
	clear_to_color(pickup.buffer, makecol(255,0,255));

	//text_mode(-1);
	textprintf_centre_ex(pickup.buffer, font_avalon->dat,241,1,makecol(0,0,0),-1,"%s",string);
	textprintf_centre_ex(pickup.buffer, font_avalon->dat,240,0,makecol(255,255,255),-1,"%s",string);
	
	pickup.ready = 1;
	
	pickup.alpha = PICKUP_MESSAGE_ALPHA;
	pickup.time = time;

	if(pic!=NULL)
	{
		if(pickup.pic!=NULL) destroy_bitmap(pickup.pic);
		
		pickup.pic = create_bitmap(pic->w,pic->h);
		clear_to_color(pickup.pic,makecol(255,0,255));
		
		for(i=0;i<pic->w;i++)
			for(j=0;j<pic->h;j++)
			{
				color = getpixel(pic,i,j);
				
				r = getr(color);g = getg(color);b = getb(color);
				if(color==MASK_COLOR_16)
				{
				}
				else
				{
					val = ((r+g+b)/3);
					putpixel(pickup.pic,i,j,makecol(val,val,val));
				}
			}
	}
	else
	{
		pickup.pic = NULL;
	}
}
예제 #21
0
void Tanque::MovaEsquerda(BITMAP *db)
{
     //o tanqu nao sai da agua pelo lado esquerdo ..
     

   int r =  getr(getpixel(db, col-velocidade, lin)); 
   int g =  getg(getpixel(db, col-velocidade, lin));
   int b =  getb(getpixel(db, col-velocidade, lin));
   //essas 3 ultimas linhas ficam verificando a cor do lado do tanque ,,
   //se nao for o azul, nao deixa o tanque andar mais 

   if (r != 131 || g != 255 || b != 255)
     col-=velocidade;
}
예제 #22
0
void Animation::saveFrame(BITMAP* bmp, int delay, PACKFILE* f) throw (WriteError)
{
	for (int y = 0; y < bmp->h; y++) {
		for (int x = 0; x < bmp->w; x++) {
			int p = getpixel(bmp, x, y);
			int r = getr(p);
			int g = getg(p);
			int b = getb(p);
			my_pack_putc(r, f);
			my_pack_putc(g, f);
			my_pack_putc(b, f);
		}
	}
	iputl(delay, f);
}
예제 #23
0
void randpoint (void)
{
	int i = 0;
	for(i = 0;i < POINT;i ++)
	{
		tempmap[i][0] = ((double)rand() % (2 * ACCURACY) - ACCURACY) / ACCURACY;
		tempmap[i][1] = ((double)rand() % (2 * ACCURACY) - ACCURACY) / ACCURACY;
		if(iscoincided(i))
		{
			i --;
			continue;
		}
		tempmap[i][2] = getr(i);
	}
}
예제 #24
0
void osd_get_pen(int pen,unsigned char *red, unsigned char *green, unsigned char *blue)
{
	if (video_depth != 8 && modifiable_palette == 0)
	{
		*red =   getr(pen);
		*green = getg(pen);
		*blue =  getb(pen);
	}
	else
	{
		*red =   current_palette[3*pen+0];
		*green = current_palette[3*pen+1];
		*blue =  current_palette[3*pen+2];
	}
}
예제 #25
0
    Color OpenLayerImage::getPixel(int x, int y)
    {
        if (mAllegroBitmap == NULL && mOpenLayerBitmap == NULL)
        {
            throw FCN_EXCEPTION("Trying to get a pixel from a non loaded image.");
        }

        if (mOpenLayerBitmap == NULL)
        {
            int color = getpixel(mAllegroBitmap, x, y);
            return Color(getr(color), getg(color), getb(color), 255);
        }
        
        return Color(mOpenLayerBitmap->GetPixelPacked(x, y));

    }
예제 #26
0
/*
==========================================================================
DIN_DrawBumpedFrame

Draws passed frames as peturbed by psuedo-bump map
==========================================================================
*/
static void DIN_DrawBumpedFrame( int frame , float lightX ,float lightY )
{
	int w=devIntroFrames[0]->w*4-1,  // ???? something to do with address mode... 
		h=devIntroFrames[0]->h-1,
	    r=0,g=0,b=0;
	
	int deltaX=0,deltaY=0,intensity=1;
	float normal=0; 

	for( int y=1;y<h;y++ )
	{
		for( int x=1;x<w;x++ )
		{
			// compute slope of vector at x,y using the data stored in bumpmap
			deltaX = devIntroFrames[ frame + DEV_INTRO_FRAMES ]->line[ y ][ x + 1 ] - 
				     devIntroFrames[ frame + DEV_INTRO_FRAMES ]->line[ y ][ x ];
			
			deltaY = devIntroFrames[ frame + DEV_INTRO_FRAMES ]->line[ y + 1 ][ x ] - 
				     devIntroFrames[ frame + DEV_INTRO_FRAMES ]->line[ y ][ x ];

			// clamp delta values
			if( deltaX < 0 || deltaX > w || ((deltaX + (w/2)) > w))
			{
				deltaX = 1;
			}
			
			if( deltaY < 0 || deltaY > h || ((deltaY +(h/2)) > h ))
			{
				deltaY = 1;
			}	
			
			// using calculated normal, compute the intensity of the light using the lightmap
			intensity = devLightMap->line[ deltaY + (h/2) ][ deltaX + ( w/2 ) ];
			
			r = getr( devIntroFrames[ frame ]->line[ y ][ x ] );
			g = getg( devIntroFrames[ frame ]->line[ y ][ x ] );
			b = getb( devIntroFrames[ frame ]->line[ y ][ x ] );
			
			r += intensity;
			g += intensity;
			b += intensity;

			pageOne->line[ y + DEV_INTRO_Y_OFFSET*2][ x ] = makecol( r , g , b );
			//_putpixel16( pageOne , x , y , makecol( r , g ,b ) );
		}
	}
}
void cMouseDrawer::drawToolTipBackground() {
	cGameControlsContext * context = player->getGameControlsContext();

	int width = getWidthToolTip();
	int height = getHeightToolTip();

	int x = getDrawXToolTip(width);
	int y = getDrawYToolTip(height);

	int color = player->getMinimapColor();

	if (context->isMouseOverStructure()) {
		cAbstractStructure * theStructure = context->getStructurePointerWhereMouseHovers();

		color = theStructure->getPlayer()->getMinimapColor();

		// TODO: Think about this, it does not really look nice to me, rather see house color
//		// make grey when not our own
//		if (theStructure->getPlayer()->getId() != player->getId()) {
//			red = 64;
//			green = 64;
//			blue = 64;
//		}
	}

	int red = getr(color);
	int green = getg(color);
	int blue = getb(color);

	// tone down a bit
	cSimpleCalculator simpleCalculator;
	red = simpleCalculator.substractWithFloor(red, 64, 0);
	green = simpleCalculator.substractWithFloor(green, 64, 0);
	blue = simpleCalculator.substractWithFloor(blue, 64, 0);

	color = makecol(red, green, blue);

//	fblend_rect_trans(bmp_screen, x, y, width, height, makecol(0,0,0), 128);
	rect(bmp_screen, x, y, x+(width-1), y + (height-1), makecol(255,255,255));
	fblend_rect_trans(bmp_screen, x, y, width, height, color, 128);
	int shadowX = x + width;
	int shadowY = y + height;
	fblend_rect_trans(bmp_screen, x + 4, shadowY, (width - 4), 4, makecol(0,0,0), 128);
	fblend_rect_trans(bmp_screen, shadowX, y + 4, 4, height, makecol(0,0,0), 128);
}
예제 #28
0
void draw_window(BITMAP *bmp, int x, int y, int w, int h, int col)
{
	for(int yy=2; yy < h-2; yy++)
	{
		float bri = 1 - ((float)yy / (float)(h)) + 0.3f;
		int ccol = makecol( getr(col)*bri, getg(col)*bri, getb(col)*bri );

		for(int xx=2; xx < w-2; xx++)
		{
			if(xx % 2 == yy % 2 && xx+yy > 7)
			{
				putpixel(bmp, x+xx,y+yy, ccol);
			}
		}
	}

	draw_outline(bmp, x-1,y-1, w,h, makecol(230,230,230));
	draw_outline(bmp, x,y, w,h, makecol(200,200,200));
	draw_outline(bmp, x+1,y+1, w,h, makecol(128,128,128));
}
예제 #29
0
파일: kernel.c 프로젝트: imgtec/t-kernel
int start_kernel(int argc, char *argv[])
{
	int i;
	int rc;
	int reg[16];
	int cpsr;
	const int timer_irq = 49;

	cpsr = get_cpsr();
	cpsr &= ~(1<<6 | 1<<7); /* enable irq & fiq */
	cpsr = set_cpsr(cpsr);

	printk("starting kernel...\n");

	printk("starting timer1...\n");
	avic_init_irq((void *)0x80000000, 128);
	mxs_enable_fiq_functionality(1);

	icoll_unmask_irq(timer_irq);



	start_timer(0, 0, 0, 0);


	waitMsec(1000);

	printk("CPSR: [%08X]\n", getcpsr());
	getr(reg);

	for(i=0; i<16; i++){
		printk("register [%d]: [%X]\n", i, reg[i]);
	}
	printk("Hello World!\n");

	while(1) {
		printk("E");
		waitMsec(1000);
	}
	return 0;
}
예제 #30
0
TileType::TileType(BITMAP *tileBitmap, const char *tileName)
{
	bitmap = tileBitmap;
	name = (char*)malloc(ustrsizez(tileName));
	ustrcpy(name, tileName);
	int x, y;
	unsigned long r = 0, g = 0, b = 0;
	unsigned long pixels = tileBitmap->w * tileBitmap->h;

	// Calculate average color
	for (x = 0; x < tileBitmap->w; x++) {
		for (y = 0; y < tileBitmap->h; y++) {
			int c = getpixel(tileBitmap, x, y);
			r += getr(c);
			g += getg(c);
			b += getb(c);
		}
	}

	color = makecol(r / pixels, g / pixels, b / pixels);
}