Пример #1
0
bool PowerUp::render()
{
	double throughLife = (double)(SDL_GetTicks()-birthTime)/(double)LIFE_TIME;
	int color = (double)0xff * throughLife;
	int end = (1.0f-throughLife)*360.0f;
	arcRGBA(SDL_GetVideoSurface(), X(), Y(), getRadius(), 0, end, 0xff, 0xff, 0xff, 0xff-color);
	if(type == 10)
	{
		// Spray power up
		filledCircleRGBA(SDL_GetVideoSurface(), X()-10, Y()+3, 4, 0xff, 0xff, 0xff, 0xff-color);
		filledCircleRGBA(SDL_GetVideoSurface(), X(), Y()-3, 4, 0xff, 0xff, 0xff, 0xff-color);
		filledCircleRGBA(SDL_GetVideoSurface(), X()+10, Y()+3, 4, 0xff, 0xff, 0xff, 0xff-color);
	}
	else if(type == 11)
	{
		// Cluster bullet
		filledCircleRGBA(SDL_GetVideoSurface(), X(), Y(), 4, 0xff, 0xff, 0xff, 0xff-color);
		filledCircleRGBA(SDL_GetVideoSurface(), X()-10, Y()-4, 2, 0xff, 0xff, 0xff, 0xff-color);
		filledCircleRGBA(SDL_GetVideoSurface(), X(), Y()-8, 2, 0xff, 0xff, 0xff, 0xff-color);
		filledCircleRGBA(SDL_GetVideoSurface(), X()+10, Y()-4, 2, 0xff, 0xff, 0xff, 0xff-color);
		filledCircleRGBA(SDL_GetVideoSurface(), X()-8, Y()+6, 2, 0xff, 0xff, 0xff, 0xff-color);
		filledCircleRGBA(SDL_GetVideoSurface(), X()+8, Y()+6, 2, 0xff, 0xff, 0xff, 0xff-color);
		
	}
	else if(type == 12)
	{
		// Shield
		aacircleColor(SDL_GetVideoSurface(), X(), Y(), getRadius()-10+(cos((double)SDL_GetTicks()/100.0f)*3), 0xffffffff);
	}
	return isAlive();
}
Пример #2
0
int GeoLayer::aacircle(int16_t x, int16_t y, int16_t r, uint32_t col) {
    if(!surf) {
        error("%s can't run: layer not initialized", __PRETTY_FUNCTION__);
        return -1;
    }
    res = aacircleColor(surf, x, y, r, col);
    if(res < 0) error("error in %s", __PRETTY_FUNCTION__);
    return(res);
}
Пример #3
0
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);
    aacircleColor(dst,(posX1+posX2)/2,(posY1+posY2)/2,rad,BORDER);
    if(isChecked){
      filledCircleColor(dst,(posX1+posX2)/2,(posY1+posY2)/2,rad-3,0x000000FF);
      aacircleColor(dst,(posX1+posX2)/2,(posY1+posY2)/2,rad-3,0x000000FF);
    }
  }else{
    boxColor(dst,posX1,posY1,posX2,posY2,0xFFFFFFFF);
    rectangleColor(dst,posX1,posY1,posX2,posY2,BORDER);
    if(isChecked){
      thickLineColor(dst,posX1+1,posY1+1,posX2-1,posY2-1,3,0x000000FF);
      thickLineColor(dst,posX1+1,posY2-1,posX2-1,posY1+1,3,0x000000FF);
    }
  }
}
Пример #4
0
CAMLprim value ml_aacircleColor(value dst,value p,value ra, value col)
{
  SDL_Surface *sur= SDL_SURFACE(dst);
  SDL_Rect prect;
  int r;

  SDLRect_of_value(&prect,p);
  r=aacircleColor(sur,prect.x,prect.y,Int_val(ra),Int32_val(col));

  return Val_bool(r);
}
Пример #5
0
static PyObject*
_gfx_aacirclecolor (PyObject *self, PyObject* args)
{
    PyObject *surface, *color, *pt;
    int x, y, r;
    pguint32 c;

    ASSERT_VIDEO_INIT (NULL);

    if (!PyArg_ParseTuple (args, "OOiO:aacircle", &surface, &pt, &r, &color))
    {
        PyErr_Clear ();
        if (!PyArg_ParseTuple (args, "OiiiO:aacircle", &surface, &x, &y, &r,
                &color))
            return NULL;
    }
    else
    {
        if (!PointFromObj (pt, &x, &y))
            return NULL;
    }

    if (!PySDLSurface_Check (surface))
    {
        PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
        return NULL;
    }
    if (!ColorFromObj (color, &c))
        return NULL;

    if (aacircleColor (((PySDLSurface*)surface)->surface,
            (Sint16)x, (Sint16)y, (Sint16)r, (Uint32)c) == -1)
    {
        PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
        return NULL;
    }
    Py_RETURN_NONE;
}
Пример #6
0
void
draw (void)
{
	double now, dt;
	struct unit *up;
	struct pathblock *pp;

	now = get_secs ();

	if (destimg.drawing) {
		dt = floor (10 * (now - destimg.lasttime));
		if (dt < 8) {
			switch ((int) dt) {
			case 0:
				draw_blit (destimg.frames[0],
					   destimg.x, destimg.y);
				break;
			case 1:
				draw_blit (destimg.frames[1],
					   destimg.x, destimg.y);
				break;
			case 2:
				draw_blit (destimg.frames[2],
					   destimg.x, destimg.y);
				break;
			case 3:
				draw_blit (destimg.frames[3],
					   destimg.x, destimg.y);
				break;
			case 4:
				draw_blit (destimg.frames[4],
					   destimg.x, destimg.y);
				break;
			case 5:
				draw_blit (destimg.frames[5],
					   destimg.x, destimg.y);
				break;
			case 6:
				draw_blit (destimg.frames[6],
					   destimg.x, destimg.y);
				break;
			case 7:
				draw_blit (destimg.frames[7],
					   destimg.x, destimg.y);
				break;
			}

		} else {
			destimg.drawing = 0;
		}
	}

	for (pp = first_pathblock; pp; pp = pp->next) {
		boxColor (screen, pp->left, pp->top, pp->right, pp->bottom,
			  pp->color);
	}

	for (up = first_unit; up; up = up->next) {
		boxColor (screen, up->left, up->top, up->right, up->bottom,
			  up->color);
		if (up->selected == 1) {
			circleColor (screen, up->center_x, up->center_y,
				     hypot (up->h / 2, up->w / 2) + 3,
				     0x00ff00ff);
			aacircleColor (screen, up->center_x, up->center_y,
				       hypot (up->h / 2, up->w / 2) + 3,
				       0x00ff00ff);
		}
	}

	if (selectbox.drawing) {
		rectangleColor (screen, selectbox.x1, selectbox.y1,
				selectbox.x2, selectbox.y2, selectbox.color);
	}
}
Пример #7
0
void Surface::circle(Sint16 x, Sint16 y, Sint16 r, const SDL_Color& c) {
	aacircleColor(surface, x, y, r, getRGBA(c));
}
Пример #8
0
void
Surface::AACircle (const Point & center, Sint16 r, const Color & c)
{
    if (aacircleColor (surface, center.x, center.y, r, c.GetRGBAColor ()))
	throw SDLException ();
}