示例#1
0
void _high_score_entry_draw_border(high_score_entry* entry, SDL_Surface* screen) {
  int thickness = 5;
  int radius = 2;
  int i;
  for (i = 0; i < screen->w; i += screen->w/10 + 10) {
    roundedBoxRGBA(screen, i,0, i+40, thickness, radius,0, 215, 255, 255);
    roundedBoxRGBA(screen, i,screen->h - thickness, i+40, screen->h, radius, 0, 215, 255, 255);
  }
  for (i = 0; i < screen->h; i += screen->h/10 + thickness) {
    roundedBoxRGBA(screen, 0,i, thickness,i+40, radius, 0,215,255,255);
    roundedBoxRGBA(screen, screen->w - thickness,i, screen->w,i+40, radius, 0,215,255,255);
  }
}
示例#2
0
文件: Character.cpp 项目: KrysG/Unuk
void Character::Render(void) {
  // Draw some fancy speach bubbles. It is a bit of a mess, I am playing.
  if(_speachBubble.size() != 0) {
    if(_speachBubbleTimer.GetTicks() < SPEACH_BUBBLE_DISPLAY_LENGTH) {
      roundedBoxRGBA(screen, (x + w / 2) - 100,
                     y - 100,
                     (x + w / 2) + 100,
                     y - 35,
                     5, 255, 255, 255, 255);

      filledTrigonRGBA(screen, (x + w / 2) - 100,
                       y - 100,
                       (x + w / 2) - 10,
                       y - 40,
                       (x + w / 2) + 10,
                       y - 40,
                       255, 255, 255, 255);

      _speachBubbleText.Render((x + w / 2) - 90, y - 90);
    }
  }

  if(attacking && attackTimer.GetTicks() < ATTACKING_DISPLAY_LEN) {
    ApplySurface(x, y, _texture, screen, &_sprites[directionFacing][ANIM_ATTACK]);
    return;
  }
  else if(attacking)
    attacking = false;
  
  if(xVel == 0.0f && yVel == 0.0f)
    ApplySurface(x, y, _texture, screen, &_sprites[directionFacing][ANIM_NO_FOOT]);
  else {
    if(_animationTimer.GetTicks() > ANIMATION_SPEED) {
      if(_animationStage == ANIM_NO_FOOT) {
        if(_leftFoot == true)
          _animationStage = ANIM_RIGHT_FOOT;
        else
          _animationStage = ANIM_LEFT_FOOT;
      }
      else if(_animationStage == ANIM_LEFT_FOOT) {
        _animationStage = ANIM_NO_FOOT;
        _leftFoot = true;
      }
      else if(_animationStage == ANIM_RIGHT_FOOT) {
        _animationStage = ANIM_NO_FOOT;
        _leftFoot = false;
      }
      _animationTimer.Start();
    }
    ApplySurface(x, y, _texture, screen, &_sprites[directionFacing][_animationStage]);
  }
}
示例#3
0
void Renderer::RoundedBox(Point p, Size s, int radius, Uint8 rr, Uint8 gg, Uint8 bb, Uint8 aa){
    roundedBoxRGBA(_renderer, p.x(), p.y(), p.x() + s.w(), p.y() + s.h(), radius, rr, gg, bb, aa);
}
示例#4
0
static void DrawStatusArea(Ifel* i)
{
   struct StatusArea* s = (struct StatusArea*)i->data;
   SDL_Surface* name;
   SDL_Surface* money;
   SDL_Surface* prop_name;
   SDL_Rect loc;

   // background
   roundedBoxRGBA(s->surface, 0, 0, s->surface->w, s->surface->h, 10, 100, 100, 0, 100);
   roundedBoxRGBA(s->surface, 6, 6, s->surface->w-10, s->surface->h-10, 10, 0, 80, 0, 255);

   // current player's name
   SDL_Color textColor;
   textColor.r = 0x8F;
   textColor.g = 0x80;
   textColor.b = 0xFF;
   loc.x = 10;
   loc.y = 6;
   name = TTF_RenderText_Solid(font, status->player->name, textColor);
   if (!name)
   {
      fprintf(stderr, "Error rendering name\n");
   }
   SDL_BlitSurface(name, NULL, s->surface, &loc);
   SDL_FreeSurface(name);

   // remaining money
   char tempText[64];
   sprintf(tempText, "$%i.00", status->player->money);
   money = TTF_RenderText_Solid(font, tempText, textColor);
   loc.y += 26;
   if (money)
   {
      SDL_BlitSurface(money, NULL, s->surface, &loc);
      SDL_FreeSurface(money);
   }

   // player's token - right aligned
   loc.x = s->surface->w - image[status->player->token]->surface->w; 
   loc.y = 0;
   SDL_BlitSurface(image[status->player->token]->surface, NULL, s->surface, &loc);

   // owned properties
   loc.x = 10;
   loc.y = 55;
   Property* p = GetProperties();
   for (int prop=0; prop < NUM_PROPERTIES; prop++)
   {
      if (p->owner == status->player->index)
      {
         prop_name = TTF_RenderText_Solid(font, p->name, textColor);
         SDL_BlitSurface(prop_name, NULL, s->surface, &loc);
         SDL_FreeSurface(money);
         loc.y += 20;
      }
      p++;
   }


   SDL_BlitSurface(s->surface, NULL, i->surface, NULL);
}