Example #1
0
void PlayMode::drawStuff()
{
  // draw the walls, obstacles, items and the shot
  for(int i = 0; i < 160; i++)
  {
    FillRect(5 * i, 0, 5, walls_top[i], 0x309930);
    FillRect(5 * i, walls_bottom[i], 5, 599 - walls_bottom[i], 0x309930);
    if(obstacles[i])
      FillRect(5 * i, obstacles[i], 5, 50, 0x309930);
    if(i < 131 && shot[i])
      FillRect(5 * i + 140, shot[i], 5, 5, (comboTime && !(playtime % 3)) ? 0xFF1111 : 0xFFFFFF); // flashing red during combo time, white normally
    if(items[i])
    {
      Sint16 vx[] = { 7, 5, 0, 4, 2, 7, 9, 14, 12, 16, 10, 8 }; // Star shape
      Sint16 vy[] = { 0, 5, 5, 9, 15, 12, 12, 15, 9, 5, 5, 0 };
      for(int j = 0; j < 12; j++) // translate
      {
        vx[j] += i * 5;
        vy[j] += items[i];
      }
      filledPolygonColor(display, vx, vy, 12, 0xFFFF40FF);
    }
  }

}
Example #2
0
void gpath_draw_filled(GContext *ctx, GPath *path) {
    Sint16* pointsX,* pointsY;
    _gpath_to_sdl (path,&pointsX,&pointsY);
    filledPolygonColor(getTopScreen(), pointsX, pointsY, path->num_points, getRawColor(ctx->fill_color));
    free(pointsX);
    free(pointsY);
}
Example #3
0
int GeoLayer::polygon_fill(int16_t *vx, int16_t *vy, int num_vertex, uint32_t col) {
    if(!surf) {
        error("%s can't run: layer not initialized", __PRETTY_FUNCTION__);
        return -1;
    }
    res = filledPolygonColor(surf, vx, vy, num_vertex, col);
    if(res < 0) error("error in %s", __PRETTY_FUNCTION__);
    return(res);
}
Example #4
0
void TSketcher::polytab(int nb,Sint16 *tabx,Sint16 *taby, int col)
{
    int n;
    for (n=0; n<nb; n++) {
	tabx[n] = tabx[n]*w/mw+ox;
	taby[n] = taby[n]*h/mh+oy;
    }
    if (filled_poly)
	filledPolygonColor(sf,tabx,taby,nb,col);
    else
	polygonColor(sf,tabx,taby,nb,col);
}
Example #5
0
/**
 * @brief This function draws a filled polygon in the matrix.
 * @param points Vertices of the polygon.
 * @param n Number of vertices in the array "points".
 * @param number The number to use to fill the polygon.
 */
void Matrix::DrawPolygon(Point *points, int n, Uint8 number)
{
    Sint16 *vx = new Sint16[n];
    Sint16 *vy = new Sint16[n];

    for (int i=0 ; i < n ; i++)
    {
        vx[i] = points[i].x;
        vy[i] = points[i].y;
    }

    filledPolygonColor(m_surface, vx, vy, n, number << 24 | 0xFF);
    delete vx;
    delete vy;
}
Example #6
0
/**
 * Draws a filled polygon on the surface.
 * @param x Array of x coordinates.
 * @param y Array of y coordinates.
 * @param n Number of points.
 * @param color Color of the polygon.
 */
void Surface::drawPolygon(Sint16 *x, Sint16 *y, int n, Uint8 color)
{
	filledPolygonColor(_surface, x, y, n, Palette::getRGBA(getPalette(), color));
}
Example #7
0
static PyObject*
_gfx_filledpolygoncolor (PyObject *self, PyObject* args)
{
    PyObject *surface, *color, *points, *item;
    Sint16 *vx, *vy;
    int tmp1, tmp2;
    Py_ssize_t count, i;
    int ret;
    pguint32 c;

    ASSERT_VIDEO_INIT (NULL);

    if (!PyArg_ParseTuple (args, "OOO:filled_polygon", &surface, &points,
            &color))
        return NULL;
    
    if (!PySDLSurface_Check (surface))
    {
        PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
        return NULL;
    }
    if (!PySequence_Check (points))
    {
        PyErr_SetString (PyExc_TypeError, "points must be a sequence");
        return NULL;
    }

    count = PySequence_Size (points);
    if (count < 3)
    {
        PyErr_SetString (PyExc_ValueError,
            "points must contain more than 2 points");
        return NULL;
    }

    if (!ColorFromObj (color, &c))
        return NULL;

    vx = PyMem_New (Sint16, (size_t) count);
    vy = PyMem_New (Sint16, (size_t) count);
    if (!vx || !vy)
    {
        if (vx)
            PyMem_Free (vx);
        if (vy)
            PyMem_Free (vy);
        return NULL;
    }

    for (i = 0; i < count; i++)
    {
        item = PySequence_ITEM (points, i);
        if (!PointFromObj (item, &tmp1, &tmp2))
        {
            PyMem_Free (vx);
            PyMem_Free (vy);
            Py_XDECREF (item);
            return NULL;
        }
        Py_DECREF (item);
        vx[i] = (Sint16)tmp1;
        vy[i] = (Sint16)tmp2;
    }

    Py_BEGIN_ALLOW_THREADS;
    ret = filledPolygonColor (((PySDLSurface*)surface)->surface, vx, vy,
        (int)count, (Uint32)c);
    Py_END_ALLOW_THREADS;

    PyMem_Free (vx);
    PyMem_Free (vy);

    if (ret == -1)
    {
        PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
        return NULL;
    }
    Py_RETURN_NONE;
}