void GUIListBox::Draw(SDL_Surface *dst){
  boxColor(dst,posX1,posY1,posX2,posY2,0xFFFFFFFF);
  if(showSelectionBox)boxColor(dst,selX1,selY1,selX2,selY2,0x6666FFFF);
  renderedText.Blit(dst,textX1,textY1,textX2-textX1,textY2-textY1,false,false,curOffX,curOffY);
  GUIDrawBorder(dst,posX1,posY1,posX2,posY2,0x404040FF,0x808080FF,0xFFFFFFFF,0,true);
  scroll.Draw(dst);
}
예제 #2
0
void GUIListBox::Draw(SDL_Surface *dst){
  boxColor(dst,posX1,posY1,posX2,posY2,0xFFFFFFFF);
  if(showSelectionBox)boxColor(dst,selX1,selY1,selX2,selY2,0x6699FFFF);
  renderedText.Blit(dst,textX1,textY1,textX2-textX1,textY2-textY1,false,false,curOffX,curOffY);
  rectangleColor(dst,posX1,posY1,posX2,posY2,BORDER);
  scroll.Draw(dst);
}
예제 #3
0
void GUIButton::Draw(SDL_Surface *dst){
  if(isPressed&&isHovered)boxColor(dst,posX1,posY1,posX2,posY2,CLICKABLE_DOWN);
  else boxColor(dst,posX1,posY1,posX2,posY2,CLICKABLE_UP);
  rectangleColor(dst,posX1,posY1,posX2,posY2,BORDER);
  renderedText.Blit(dst,posX1,posY1,posX2-posX1,posY2-posY1,true,true);
  if(isDisabled)boxColor(dst,posX1,posY1,posX2,posY2,0xFFFFFFA0);
}
void GUICheckBox::Draw(SDL_Surface *dst){
  if(isCircle){
    int rad = ((posX2-posX1<posY2-posY1)?(posX2-posX1):(posY2-posY1))-7;
    filledCircleColor(dst,(posX1+posX2)/2,(posY1+posY2)/2,rad,0xFFFFFFFF);
    arcColor(dst,(posX1+posX2)/2,(posY1+posY2)/2,rad,135,315,0x000000FF);
    arcColor(dst,(posX1+posX2)/2,(posY1+posY2)/2,rad+1,135,315,0x808080FF);
    arcColor(dst,(posX1+posX2)/2,(posY1+posY2)/2,rad,315,135,0xD4D0C8FF);
    arcColor(dst,(posX1+posX2)/2,(posY1+posY2)/2,rad+1,315,135,0xFFFFFFFF);
    if(isChecked)filledCircleColor(dst,(posX1+posX2)/2,(posY1+posY2)/2,rad-3,0x000000FF);
  }else{
    boxColor(dst,posX1,posY1,posX2,posY2,0xFFFFFFFF);
    GUIDrawBorder(dst,posX1,posY1,posX2,posY2,0x808080FF,0x404040FF,0xFFFFFFFF,0xD4D0C8FF);
    if(isChecked){
      int tickX=((posX2+posX1)/2)-2,tickY=((posY2+posY1)/2)-3; Uint32 clr=0x000000FF;
      boxColor(dst,tickX+1,tickY+4,tickX+3,tickY+5,clr);
      boxColor(dst,tickX+4,tickY+2,tickX+5,tickY+3,clr);
      vlineColor(dst,tickX,tickY+2,tickY+4,clr);
      vlineColor(dst,tickX+6,tickY,tickY+2,clr);
      pixelColor(dst,tickX+1,tickY+3,clr);
      pixelColor(dst,tickX+3,tickY+3,clr);
      pixelColor(dst,tickX+4,tickY+4,clr);
      pixelColor(dst,tickX+5,tickY+1,clr);
      pixelColor(dst,tickX+2,tickY+6,clr);
    }
  }
}
예제 #5
0
파일: window.c 프로젝트: you-chan/Game
/*****************************************************************
関数名 : Drawcommand
機能	: コマンド入力中の画面を表示する
引数	: なし
出力	: なし
*****************************************************************/
void DrawCommand()
{
	int i;
	Rect rect = {{0, 0, 0, 0}, {0, 0}};

	/* 選択中のコマンドの描画 */
	boxColor(gMainWindow, 0, 0, F_WIDTH, HEIGHT, 0x00000040);

	rect.src.x = 256;
	rect.src.y = 0;
	rect.src.w = 256;
	rect.src.h = HEIGHT;
	rect.dst.x = F_WIDTH;
	rect.dst.y = 0;
	SDL_BlitSurface(InfoWindow, &(rect.src), gMainWindow, &(rect.dst));

	rect.src.x = rect.src.y = 0;
	rect.src.w = 100;
	rect.src.h = 320;
	rect.dst.x = 2.5 * F_WIDTH /8;
	rect.dst.y = 5 * HEIGHT / 8 - 110;
	SDL_BlitSurface(ArrowWindow, &(rect.src), gMainWindow, &(rect.dst));
	rect.dst.x = F_WIDTH/8;
	SDL_BlitSurface(ArrowWindow, &(rect.src), gMainWindow, &(rect.dst));

	/*選択しているコマンドに枠を付ける*/
	boxColor(gMainWindow, F_WIDTH*(cState*1.5+1)/8-5, 5*HEIGHT/8-5, F_WIDTH*(cState*1.5+1)/8+C_SIZE+5, 5*HEIGHT/8+C_SIZE+5, 0xFF0000FF);

	rect.src.x = gCommand.dir * C_SIZE;
	rect.src.y = 0;
	rect.src.w = rect.src.h = C_SIZE;
	rect.dst.x = 1 * F_WIDTH /8;
	rect.dst.y = 5 * HEIGHT /8;
	SDL_BlitSurface(CommandWindow, &(rect.src), gMainWindow, &(rect.dst));
	rect.src.x = gCommand.gun * C_SIZE;
	rect.dst.x = 2.5 * F_WIDTH /8;
	SDL_BlitSurface(CommandWindow, &(rect.src), gMainWindow, &(rect.dst));
	rect.src.x = 0;
	rect.dst.x = 4 * F_WIDTH /8;
	SDL_BlitSurface(ChooseWindow, &(rect.src), gMainWindow, &(rect.dst));
	rect.src.x = 100;
	rect.dst.x = 5.5 * F_WIDTH /8;
	SDL_BlitSurface(ChooseWindow, &(rect.src), gMainWindow, &(rect.dst));

	/* 選択したコマンドの描画 */
	for(i=0; i<MAX_COMMAND; i++){
		if(gChara[0].command[i] != -1){
			rect.src.x = gChara[0].command[i] * C_SIZE;
			rect.src.y = 0;
			rect.src.w = rect.src.h = C_SIZE;
			if(gChara[0].commandnum <= 4)
				rect.dst.x = F_WIDTH / 4 + C_SIZE * i;
			else
				rect.dst.x = F_WIDTH / 4 + C_SIZE * i * 4 / gChara[0].commandnum;//MAX_COMMAND;
			rect.dst.y = HEIGHT / 8;
			SDL_BlitSurface(CommandWindow, &(rect.src), gMainWindow, &(rect.dst));
		}
	}
}
예제 #6
0
void GUIDropDown::Draw(SDL_Surface *dst){
  boxColor(dst,posX1,posY1,posX2,posY2,0xFFFFFFFF);
  rectangleColor(dst,posX1,posY1,posX2,posY2,BORDER);
  selectedText.Blit(dst,posX1+3,posY1+2,posX2-posX1-3,posY2-posY1-2,false,true);
  if(isPressed)boxColor(dst,arrX1,arrY1,arrX2,arrY2,CLICKABLE_DOWN);
  else boxColor(dst,arrX1,arrY1,arrX2,arrY2,CLICKABLE_UP);
  rectangleColor(dst,arrX1,arrY1,arrX2,arrY2,BORDER);
  filledTrigonColor(dst,triX1,triY1,triX2,triY2,triX3,triY3,0x00000080);
  if(listBox.doDraw&&!hasRegistered)listBox.Draw(dst);
}
void GUIDropDown::Draw(SDL_Surface *dst){
  boxColor(dst,posX1,posY1,posX2,posY2,0xFFFFFFFF);
  GUIDrawBorder(dst,posX1,posY1,posX2,posY2,0x404040FF,0x808080FF,0xFFFFFFFF,0,true);
  selectedText.Blit(dst,posX1+3,posY1+2,posX2-posX1-3,posY2-posY1-2,false,true);
  boxColor(dst,arrX1,arrY1,arrX2,arrY2,0xD4D0C8FF);
  if(isPressed)GUIDrawBorder(dst,arrX1,arrY1,arrX2,arrY2,0x404040FF,0x808080FF,0xFFFFFFFF,0,true);
  else GUIDrawBorder(dst,arrX1,arrY1,arrX2,arrY2,0xFFFFFFFF,0,0x404040FF,0x808080FF);
  filledTrigonColor(dst,triX1,triY1,triX2,triY2,triX3,triY3,0x00000080);
  if(listBox.doDraw&&!hasRegistered)listBox.Draw(dst);
}
void GUIButton::Draw(SDL_Surface *dst){
  boxColor(dst,posX1,posY1,posX2,posY2,0xD4D0C8FF);
  renderedText.Blit(dst,posX1,posY1,posX2-posX1,posY2-posY1,true,true);
  if(!isDisabled){
    if(isPressed&&isHovered)GUIDrawBorder(dst,posX1,posY1,posX2,posY2,0x404040FF,0x808080FF,0xFFFFFFFF,0,true);
    else GUIDrawBorder(dst,posX1,posY1,posX2,posY2,0xFFFFFFFF,0,0x404040FF,0x808080FF);
  }else{
    boxColor(dst,posX1,posY1,posX2,posY2,0xFFFFFFA0);
    //rectangleColor(dst,posX1,posY1,posX2,posY2,0x404040FF);
    GUIDrawBorder(dst,posX1,posY1,posX2,posY2,0xFFFFFFFF,0,0x404040FF,0x808080FF);
  }
}
예제 #9
0
파일: tfont.cpp 프로젝트: albinoz/raine
void TFont::surf_string(SDL_Surface *surf,int x, int y, const char *s, int color, int bgcolor, int w) {
  if (charWidth*strlen(s) > (unsigned)w) {
      int len = w/charWidth;
      char *dup = strdup(s);
      dup[len+1] = 0;
      boxColor(surf,x,y,charWidth*len+x-1,charHeight+y-1,bgcolor);
      surf_string_tr(surf,x,y,dup,color);
      free(dup);
  } else {
      boxColor(surf,x,y,charWidth*strlen(s)+x-1,charHeight+y-1,bgcolor);
      surf_string_tr(surf,x,y,s,color);
  }
}
예제 #10
0
void render_background()
{
	Uint32 color = BG_COLOR;	

	if (global.state == STATE_MENU)
	{
		boxColor(global.screen,0,0,WINDOW_WIDTH,WINDOW_HEIGHT,color);
	}
	else
	{
		boxColor(global.screen,0,0,WINDOW_WIDTH,WINDOW_HEIGHT,color);
		SDL_BlitSurface(waves[global.wave].bg,NULL,global.screen,NULL);
	}
}
예제 #11
0
void
draw (void)
{
	struct pathblock *pp;

	boxColor (screen, unit.x, unit.y, unit.x + unit.w,
			unit.y + unit.h, unit.color);
	for (pp = first_pathblock; pp; pp = pp->next) {
		boxColor (screen, pp->left, pp->top, pp->right, pp->bottom,
			  pp->color);
	}
	boxColor (screen, placeblock.left, placeblock.top, placeblock.right,
		  placeblock.bottom, placeblock.color);
}
예제 #12
0
void foldicon(int folded, int exposure_level, int x,
		int top, int height, int y,
		SDL_Surface *surface, style *st, int highlighted)
{
	// x is a left edge, y is a centre
	SDL_Surface *icon;
	int colour_index;
	
	if(folded)
		icon = st->collapsedicon;
	else
		icon = st->expandedicon;
	
	colour_index = folded ? st->foldcollapsedcolour : st->foldexpandedcolour;
	if(highlighted)
		colour_index = st->highlightcolour;
	
	if(!folded)
	{
		Uint32 pen;

		exposure_level++;
		if(exposure_level == 1)
			pen = colour->pens->item(st->foldexposed1colour);
		else if(exposure_level == 2)
			pen = colour->pens->item(st->foldexposed2colour);
		else
			pen = colour->pens->item(st->foldexposed3colour);
		/* boxColor(surface, x + 7, y, x + 13,
				y + (st->text_ascent - st->text_descent), pen); */
		boxColor(surface, x + 7, y, x + 13, top + height - 1, pen);
	}
	if(icon == NULL)
	{
		boxColor(surface, x, y - 10, x + 20, y + 10,
				colour->pens->item(colour_index));
		rectangleColor(surface, x, y - 10, x + 20, y + 10, colour->black_pen);
		filledTrigonColor(surface, x + 3, y - 6, x + 17, y - 6,
				x + 10, y + 6, colour->white_pen);
		aatrigonColor(surface, x + 3, y - 6, x + 17, y - 6,
				x + 10, y + 6, colour->black_pen);
	}
	else
	{
		SDL_Rect dst;
		dst.x = x + 10 - (icon->w / 2);
		dst.y = y - (icon->h / 2);
		SDL_BlitSurface(icon, NULL, surface, &dst);
	}
}
예제 #13
0
void GUITextBox::Draw(SDL_Surface *dst){
  boxColor(dst,posX1,posY1,posX2,posY2,fontBackColor);
  renderedText.Blit(dst,textX1,textY1,textX2-textX1,textY2-textY1,false,false,curOffX,curOffY);
  rectangleColor(dst,posX1,posY1,posX2,posY2,BORDER);
  if(CursorBlink())boxColor(dst,curDrawX,curDrawY,curDrawX,curDrawY+curDrawH,0x330000FF);
  if(showScroll){
    scrollX.Draw(dst);
    scrollY.Draw(dst);
  }
  if(showPointer){
    vlineColor(dst,mouseX,mouseY-6,mouseY+6,0x00000080);
    hlineColor(dst,mouseX-3,mouseX+3,mouseY-7,0x00000080);
    hlineColor(dst,mouseX-3,mouseX+3,mouseY+7,0x00000080);
  }
}
예제 #14
0
/* render time and bar remained till the end of the wave */
void render_wave_time()
{
	char str[20];
	Uint32 time_passed, one_percent, percents_passed;
	Uint32 color = 0x00FF00FF; /* green, 0xRRGGBBAA */

	/* time passed from start of the wave */
	time_passed = SDL_GetTicks() - waves[global.wave].start_time;
	one_percent = waves[global.wave].duration/100; //600ms
	percents_passed = time_passed / one_percent;
	
	/* word TIME */
	render_text(12,"WAVE",WINDOW_WIDTH-155, WINDOW_HEIGHT-15,color);

	/* time bar. we assume TIME_BAR_W is 100 always ;) */
	if (TIME_BAR_W > percents_passed)
		boxColor(global.screen, TIME_BAR_X, WINDOW_HEIGHT-15,
			 TIME_BAR_X + TIME_BAR_W - percents_passed, WINDOW_HEIGHT-5, 0x32CD32FF);

	rectangleColor(global.screen, WINDOW_WIDTH - 120, WINDOW_HEIGHT-15,
			 WINDOW_WIDTH - 20, WINDOW_HEIGHT-5, 0x008000FF);

	/* digits on the top of bar */
	//sprintf(str,"%u",percents_passed);
	//render_text(12,str, WINDOW_WIDTH/2 + 25,WINDOW_HEIGHT-100,0xFFFFFFFF);
}
예제 #15
0
void Dashboard::act(int event)
{
    SDL_Event evt;
    
    while (SDL_PollEvent(&evt)) {
        if (evt.type == SDL_QUIT) {
            endSimulation();
        }
        
        for (auto &widget : widgets)
            if (widget->handleEvent(this, &evt))
                break;
    }
    
    if (background)
        SDL_BlitSurface(background, NULL, screen, NULL);
    else
        boxColor(screen, 0, 0, screen->w, screen->h, 0x000000ff);
    
    for (auto &widget : widgets)
        widget->render(this);
    
    SDL_Flip(screen);

    scheduleEventIn(SIM_EVENT_DO_FRAME, ms_to_sim_time(Dashboard::FRAME_INTERVAL_MSEC));
}
예제 #16
0
void RS232Console::drawScrollbar(Dashboard *dash, SDLColor color)
{
    const int PADDING = 6;
    const int BAR_WIDTH = 12;
    
    if ((int)stored_text.size() <= rows)
        return;
    
    int height, width, mid_height;
    
    getMetrics(dash, width, mid_height, height);
    
    int bar_x = x + width - PADDING - BAR_WIDTH;
    int bar_y = y + PADDING;
    int bar_w = BAR_WIDTH;
    int bar_h = mid_height - 2 * PADDING;
    
    int thumb_y = bar_y + bar_h * scroll_position / stored_text.size();
    int thumb_h = bar_h * rows / stored_text.size();
    
    rectangleColor(dash->screen, bar_x, bar_y, bar_x + bar_w - 1, bar_y + bar_h - 1,
        color.toUInt32());
    boxColor(dash->screen, bar_x, thumb_y, bar_x + bar_w - 1, thumb_y + thumb_h - 1,
        color.toUInt32());
}
예제 #17
0
파일: r.c 프로젝트: wpwrak/subosm
static SDL_Surface *make_canvas(int height)
{
	SDL_Surface *s;
	int xmax, ymin;
	unsigned i;
	unsigned dx, dy;
	unsigned width;

	xmin = xmax = node[0].x;
	ymin = ymax = node[0].y;

	for (i = 1; i != n_nodes; i++)  {
		if (xmin > node[i].x)
			xmin = node[i].x;
		if (xmax < node[i].x)
			xmax = node[i].x;
		if (ymin > node[i].y)
			ymin = node[i].y;
		if (ymax < node[i].y)
			ymax = node[i].y;
	}

	dx = xmax-xmin;
	dy = ymax-ymin;
	width = height*dx/dy;

	f = (double) height/dy;

	s = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32,
	    0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000);
	boxColor(s, 0, 0, width-1, height-1, 0xffffffff);
	return s;
}
예제 #18
0
파일: Draw.cpp 프로젝트: JuarezASF/Code
void Draw::Text_in_a_Box(Mat &img, Point origin, string text,
										Scalar color, double fontScale)
{

	Scalar boxColor(255, 255, 255);
	int fontFace = FONT_HERSHEY_SIMPLEX;
	int thickness = 1;
	int lineType = 8;
	bool bottomLeftOrigin = false;
	int baseline = 0;

	Size textSize = getTextSize(text, fontFace,
	                            fontScale, thickness, &baseline);


	// draw the box
	rectangle(img, origin + Point(0, baseline),
	          origin + Point(textSize.width, -textSize.height),
	          boxColor);


	putText(img, text, origin, fontFace, fontScale,
			color, thickness,lineType, bottomLeftOrigin);

}
예제 #19
0
파일: DxLib.c 프로젝트: cjxgm/clabs
inline void DrawBox(int x0, int y0,
			int x1, int y1, uint color, int is_fill)
{
	if (is_fill)
		boxColor(screen, x0, y0, x1, y1, color);
	else
		rectangleColor(screen, x0, y0, x1, y1, color);
}
예제 #20
0
void graphics_fill_rect(GContext *ctx, GRect rect, uint8_t corner_radius, GCornerMask corner_mask) {
    //TODO: corner_mask
    GPoint topOffset=getTopOffset ();
    if (corner_radius>0)
        roundedBoxColor (getTopScreen(),topOffset.x+rect.origin.x,topOffset.y+rect.origin.y,topOffset.x+rect.origin.x+rect.size.w,topOffset.y+rect.origin.y+rect.size.h,corner_radius,getRawColor(ctx->fill_color));
    else
        boxColor (getTopScreen(),topOffset.x+rect.origin.x,topOffset.y+rect.origin.y,topOffset.x+rect.origin.x+rect.size.w,topOffset.y+rect.origin.y+rect.size.h,getRawColor(ctx->fill_color));
}
예제 #21
0
파일: geo_layer.cpp 프로젝트: K0F/FreeJ
int GeoLayer::rectangle_fill(int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t col) {
    if(!surf) {
        error("%s can't run: layer not initialized", __PRETTY_FUNCTION__);
        return -1;
    }
    res = boxColor(surf, x1, y1, x2, y2, col);
    if(res < 0) error("error in %s", __PRETTY_FUNCTION__);
    return(res);
}
예제 #22
0
파일: window.c 프로젝트: you-chan/Game
/*****************************************************************
関数名 : DrawEdit
機能	: 編集画面の描画
引数	: なし
出力	: なし
*****************************************************************/
void DrawEdit()
{
	Rect rect = {{0, 0, 0, 0}, {0, 0}}; //とりあえず100*100

	/* 背景を白にする */
	SDL_FillRect(gMainWindow,NULL,0x808080);
	boxColor(gMainWindow, F_WIDTH, 0, WIDTH, HEIGHT, 0x000000FF);

	rect.src.x = 0;
	rect.src.y = 0;
	rect.src.w = 256;
	rect.src.h = 768;
	rect.dst.x = F_WIDTH;
	rect.dst.y = 0;
	SDL_BlitSurface(InfoWindow, &(rect.src), gMainWindow, &(rect.dst));

	rect.src.x = 0;
	rect.src.y = 0;
	rect.src.w = 100;
	rect.src.h = 320;
	rect.dst.x = F_WIDTH / 8;
	rect.dst.y = 5 * HEIGHT /8 - 110;
	SDL_BlitSurface(ArrowWindow, &(rect.src), gMainWindow, &(rect.dst));
	rect.dst.x = 3 * F_WIDTH /8;
	SDL_BlitSurface(ArrowWindow, &(rect.src), gMainWindow, &(rect.dst));

	/*選択しているコマンドに枠を付ける*/
	boxColor(gMainWindow, F_WIDTH*(eState*2+1)/8-5, 5*HEIGHT/8-5, F_WIDTH*(eState*2+1)/8+C_SIZE+5, 5*HEIGHT/8+C_SIZE+5, 0xFF0000FF);

	rect.src.x = gChara[0].gun*100;
	rect.src.y = 0;
	rect.src.w = rect.src.h = 100;
	rect.dst.x = 1 * F_WIDTH /8;
	rect.dst.y = 5 * HEIGHT /8;
	SDL_BlitSurface(GunWindow, &(rect.src), gMainWindow, &(rect.dst));
	rect.src.x = gChara[0].armor*100;
	rect.dst.x = 3 * F_WIDTH /8;
	SDL_BlitSurface(ArmorWindow, &(rect.src), gMainWindow, &(rect.dst));
	rect.src.x = 100;
	rect.dst.x = 5 * F_WIDTH /8;
	SDL_BlitSurface(ChooseWindow, &(rect.src), gMainWindow, &(rect.dst));

	SDL_Flip(gMainWindow);
}
예제 #23
0
// 8 width, 16 height, 128x16
void render_bullets()
{
	int i;
	int x,y;
	SDL_Rect src, dest;
	unsigned int diff; 

	/* render player bullets */
	Uint32 color = waves[global.wave].player_bullets_color;
	for (i = 0; i < PLAYER_BULLETS; i++)
	{
		if (player_bullet[i].exist)
		{
			boxColor(global.screen,player_bullet[i].crd.x1, player_bullet[i].crd.y1,
				 player_bullet[i].crd.x2, player_bullet[i].crd.y2,color);
		}
	}

	/* render enemy bullets */
	for (i = 0; i < ENEMY_BULLETS; i++)
	{
		if (enemy_bullet[i].exist)
		{
			/* choose correct sprite from spritelist */
			src.x = enemy_bullet[i].anim * ENEMY_BULLET_WIDTH;
			src.y = 0;
			src.w = ENEMY_BULLET_WIDTH;
			src.h = ENEMY_BULLET_HEIGHT;
			
			/* render chosen sprite to the correct place on the screen */
			dest.x = enemy_bullet[i].crd.x1;
			dest.y = enemy_bullet[i].crd.y1;
#if 0			
			if (i == 0)
				debug("anim %d src.x %d, src,y %d \n",
				 enemy_bullet[i].anim, src.x, src.y);
#endif 
 			SDL_BlitSurface(sur_enemy_bullet,&src,global.screen,&dest);

			/* check - time to render next animation sprite? */
			diff = SDL_GetTicks() - enemy_bullet[i].time_anim;
			if (diff > 1000/BULLET_ANIM_SPEED) 
			{
				//debug ("diff %u, anim %d \n", diff, enemy_bullet[i].anim);	

				enemy_bullet[i].anim++;
				if (enemy_bullet[i].anim >= BULLET_ANIM_FRAMES)
					enemy_bullet[i].anim = 0;
				/* correct. add +100, not +112 */
				enemy_bullet[i].time_anim += 1000/BULLET_ANIM_SPEED;
			}
		}
	}
}
예제 #24
0
void Map::draw(SDL_Surface *buffer) {
	static Uint32 wallColor = 0x0000AAFF;

	// Paredes
	for (int i=0; i < tiley; i++) {
		for (int j=0; j < tilex; j++) {
			if ( map[i][j] == WALL )
				boxColor(buffer, j*tileSize, i*tileSize, j*tileSize + tileSize, i*tileSize + tileSize, wallColor);
		}
	}
}
예제 #25
0
CAMLprim value ml_boxColor(value dst,value p1,value p2, value col)
{
  SDL_Surface *sur= SDL_SURFACE(dst);
  SDL_Rect rect1,rect2;
  int r;

  SDLRect_of_value(&rect1,p1);
  SDLRect_of_value(&rect2,p2);
  r=boxColor(sur,rect1.x,rect1.y,rect2.x,rect2.y,Int32_val(col));

  return Val_bool(r);
}
예제 #26
0
void drawcell(cell cells[MAX][MAX],SDL_Surface *cel,SDL_Surface *kep)
{
	int x,y;	

	for(y=0;y<MAX;y++)
		for(x=0;x<MAX;x++)
		{
			if(cells[y][x].alive==1)
			{
				SDL_Rect src={0,0,MERET,MERET};
				SDL_Rect dest={x*MERET+KERET,y*MERET+KERET,0,0};
				SDL_BlitSurface(kep,NULL, cel, &dest);
			}
			else if (x%2 != y%2)
				boxColor(cel,palyapos(x),palyapos(y),palyapos(x+1)-1,palyapos(y+1)-1,0xFFDFD2FF);
			else 
				boxColor(cel,palyapos(x),palyapos(y),palyapos(x+1)-1,palyapos(y+1)-1,0xE5C8BDFF);


		}
}
예제 #27
0
파일: coans.c 프로젝트: tomitakecirno/coevo
/********************
最適解をプロット
********************/
void Unit_Optimal(SDL_Surface *window)
{
	int i;
	for(i=0;i<Optimal_N;i++){
		boxColor(window,
			(Optimal[i].n[0]*2)+center[0]-4,
			(Optimal[i].n[1]*2)+center[1]-4,
			(Optimal[i].n[0]*2)+center[0]+4,
			(Optimal[i].n[1]*2)+center[1]+4,
			0x000000ff);
	}
}
예제 #28
0
void exposeicon(int level, int x, int y, int height,
		SDL_Surface *surface, style *st)
{
	Uint32 pen;
	
	if(level == 1)
		pen = colour->pens->item(st->foldexposed1colour);
	else if(level == 2)
		pen = colour->pens->item(st->foldexposed2colour);
	else
		pen = colour->pens->item(st->foldexposed3colour);
	boxColor(surface, x + 7, y, x + 13, y + height - 1, pen);
}
void GUIScrollBar::Draw(SDL_Surface *dst){
  boxColor(dst,trackX1,trackY1,trackX2,trackY2,0xE0E0E0FF);
  GUIDrawBorder(dst,trackX1,trackY1,trackX2,trackY2,0x808080FF,0,0xFFFFFFFF,0);

  if(arrowW>0){
    boxColor(dst,arrAX1,arrAY1,arrAX2,arrAY2,0xD4D0C8FF);
    boxColor(dst,arrBX1,arrBY1,arrBX2,arrBY2,0xD4D0C8FF);

    if(arrADown)GUIDrawBorder(dst,arrAX1,arrAY1,arrAX2,arrAY2,0x404040FF,0x808080FF,0xFFFFFFFF,0,true);
    else GUIDrawBorder(dst,arrAX1,arrAY1,arrAX2,arrAY2,0xFFFFFFFF,0,0x404040FF,0x808080FF);
    if(arrBDown)GUIDrawBorder(dst,arrBX1,arrBY1,arrBX2,arrBY2,0x404040FF,0x808080FF,0xFFFFFFFF,0,true);
    else GUIDrawBorder(dst,arrBX1,arrBY1,arrBX2,arrBY2,0xFFFFFFFF,0,0x404040FF,0x808080FF);

    filledTrigonColor(dst,triAX1,triAY1,triAX2,triAY2,triAX3,triAY3,0x00000080);
    filledTrigonColor(dst,triBX1,triBY1,triBX2,triBY2,triBX3,triBY3,0x00000080);
  }

  if(!isDisabled){
    boxColor(dst,slidX1,slidY1,slidX2,slidY2,0xD4D0C8FF);
    GUIDrawBorder(dst,slidX1,slidY1,slidX2,slidY2,0xFFFFFFFF,0,0x404040FF,0x808080FF);
  }
}
예제 #30
0
파일: window.c 프로젝트: you-chan/Game
/*****************************************************************
関数名 : DrawTitle
機能	: タイトル画面の描画
引数	: なし
出力	: なし
*****************************************************************/
void DrawTitle()
{
	int i;
	Rect rect = {{0, 0, WIDTH, HEIGHT}, {0, 0}};
	/* 背景を白にする */
	SDL_FillRect(gMainWindow,NULL,0xffffff);
	SDL_BlitSurface(BRSWindow, &(rect.src), gMainWindow, &(rect.dst));
	rect.src.x = rect.src.y = 0;
	rect.src.w = 360;
	rect.src.h = 60;
	rect.dst.x = (WIDTH - 360)/2;
	for(i=0; i<MAX_TITLE; i++){
		rect.src.y = i * 60;
		rect.dst.y = HEIGHT*((i*2)+1)/8+120;
		SDL_BlitSurface(TitleWindow, &(rect.src), gMainWindow, &(rect.dst));
	}

	/*選択中でないタブを灰色に*/
	boxColor(gMainWindow, (WIDTH-360)/2, HEIGHT*(((tState+1)*2+1)%6)/8+120, (WIDTH-360)/2+360, HEIGHT*(((tState+1)*2+1)%6)/8+180, 0x00000060);
	boxColor(gMainWindow, (WIDTH-360)/2, HEIGHT*(((tState*2)+5)%6)/8+120, (WIDTH-360)/2+360, HEIGHT*(((tState*2)+5)%6)/8+180, 0x00000060);
	SDL_Flip(gMainWindow);
}