Exemplo n.º 1
0
Arquivo: DxLib.c Projeto: cjxgm/clabs
void DrawOval(int x, int y, int rx, 
			int ry, uint color, int is_fill) // 椭圆
{
	if (is_fill)
		filledEllipseColor(screen, x, y, rx, ry, color);
	else
		ellipseColor(screen, x, y, rx, ry, color);
}
Exemplo n.º 2
0
void inicio(){
        if (SDL_Init(SDL_INIT_EVERYTHING) || TTF_Init())
            exit(1);
        wnd = SDL_CreateWindow("SHOL GUI", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 800,800, SDL_WINDOW_SHOWN);
        renderer = SDL_CreateRenderer(wnd,-1,SDL_RENDERER_SOFTWARE);
        fnt_pt = TTF_OpenFont("font.ttf", 12);
        if (fnt_pt == NULL){
            printf("Font (font.ttf) not found! Exiting...\n");
            exit(1);
        }
        SDL_SetRenderDrawColor(renderer, 0,0,0,255);
        SDL_RenderClear(renderer);
        int fila,columna;
        fila = 60;
        columna = 560;
        renderString("Smart Home", columna, fila, 0xFF,0xFF,0xFF);
        fila = 80;
        renderString("Proyecto TL", columna, fila, 0xFF,0xFF,0xFF);
        fila = 100;
        renderString("Curso 2015/2016", columna, fila, 0xFF,0xFF,0xFF);
        renderString("Simulador de Smart Home - Plano de la casa", 50, 10, 0xFF,0xFF,0xFF);
        SDL_Rect *rect = new SDL_Rect();
        rect->x = ORIGEN_X-5;
        rect->y = ORIGEN_Y-5;
        rect->w = 455;
        rect->h = 555;
        SDL_SetRenderDrawColor(renderer, 255,255,255,255);
        SDL_RenderFillRect(renderer, rect);
        fila = 180; columna = 560;
        renderString("Sensor de temperatura", columna+20,fila , 0,0xFF,0);
        ellipseRGBA(renderer, columna, fila, 6,6,0,0xFF,0,0xFF);
        fila = 200; columna = 560;
        renderString("Sensor de luminosidad",columna+20,fila,0xFF,0xFF,0xFF);
        ellipseColor(renderer, columna, fila, 6,6, 0xFFFFFFFF);
        fila = 220; columna = 560;
        renderString("Sensor de humo",columna+20,fila,0x00,0x00,0xFF);
        ellipseRGBA(renderer, columna, fila, 6,6, 0x00,0x00,0xFF,0xFF);
        fila = 250; columna = 560;
        renderString("Alarma",columna+20,fila,0xFF,0x00,0x00);
        ellipseColor(renderer, columna, fila, 6,6, 0xFF0000FF);
        fila = 270; columna = 560;
        renderString("Luz",columna+20,fila,0xFF,0xB4,0x00);
        ellipseRGBA(renderer, columna, fila, 6,6, 0xFF,0xB4,0x00,0xFF);
        SDL_RenderPresent(renderer);	
}
Exemplo n.º 3
0
int GeoLayer::ellipse(int16_t x, int16_t y, int16_t rx, int16_t ry, uint32_t col) {
    if(!surf) {
        error("%s can't run: layer not initialized", __PRETTY_FUNCTION__);
        return -1;
    }
    res = ellipseColor(surf, x, y, rx, ry, col);
    if(res < 0) error("error in %s", __PRETTY_FUNCTION__);
    return(res);
}
Exemplo n.º 4
0
CAMLprim value ml_ellipseColor(value dst,value p,value rp, value col)
{
  SDL_Surface *sur= SDL_SURFACE(dst);
  SDL_Rect prect,rprect;
  int r;

  SDLRect_of_value(&prect,p);
  SDLRect_of_value(&rprect,rp);
  r=ellipseColor(sur,prect.x,prect.y,rprect.x,rprect.y,Int32_val(col));

  return Val_bool(r);
}
Exemplo n.º 5
0
static PyObject*
_gfx_ellipsecolor (PyObject *self, PyObject* args)
{
    PyObject *surface, *color, *pt, *rd;
    int x, y, rx, ry;
    pguint32 c;

    ASSERT_VIDEO_INIT (NULL);

    if (!PyArg_ParseTuple (args, "OOOO:ellipse", &surface, &pt, &rd, &color))
    {
        PyErr_Clear ();
        if (!PyArg_ParseTuple (args, "OiiiiO:ellipse", &surface, &x, &y, &rx,
            &ry, &color))
            return NULL;
    }
    else
    {
        if (!PointFromObj (pt, &x, &y) || !PointFromObj (rd, &rx, &ry))
            return NULL;
    }
    
    if (!PySDLSurface_Check (surface))
    {
        PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
        return NULL;
    }
    if (!ColorFromObj (color, &c))
        return NULL;

    if (ellipseColor (((PySDLSurface*)surface)->surface, (Sint16)x, (Sint16)y,
            (Sint16)rx, (Sint16)ry, (Uint32)c) == -1)
    {
        PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
        return NULL;
    }
    Py_RETURN_NONE;
}
Exemplo n.º 6
0
void rotationWidget::paintEvent(QPaintEvent *){
  int side = qMin(width(), height());

  double_point3 vec(0,0,90);//centro sfera
  double_point3 front(0,0,80);
  double_point3 back(0,0,-80);
  double_point3 left(-80,0,0);
  double_point3 right(80,0,0);
  double_point3 top(0,80,0);
  double_point3 bottom(0,-80,0);

  rot.applyTransform(vec);
  rot.applyTransform(front);
  rot.applyTransform(back);
  rot.applyTransform(left);
  rot.applyTransform(right);
  rot.applyTransform(top);
  rot.applyTransform(bottom);

  QPainter painter(this);
  painter.setRenderHint(QPainter::Antialiasing);

  //coordinate tra -100 e 100
  painter.translate(width() / 2, height() / 2);
  painter.scale(side / 200.0, side / 200.0);
  
  QColor ellipseColor(0, 0, 127, 128);
  QColor pointColor(255, 0, 0);
  QColor xColor(255, 0, 0);
  QColor yColor(0, 255, 0);
  QColor zColor(0, 0, 255);
  
  if ( !isEnabled() ){
    ellipseColor=ellipseColor.darker(300);
    pointColor=pointColor.darker(300);
    xColor=xColor.darker(300);
    yColor=yColor.darker(300);
    zColor=zColor.darker(300);
  }
  
  if (vec.z()<0){ //sul retro
    painter.setBrush(pointColor);
    painter.setPen(Qt::SolidLine);
    painter.drawEllipse(QRectF(vec.x()-10,vec.y()-10,20,20));
  }
  
  painter.setPen(Qt::NoPen);
  painter.setBrush(ellipseColor);
  painter.drawEllipse(QRectF(-80,-80,160,160));

  painter.setPen(Qt::SolidLine);
  painter.setPen(zColor);
  painter.drawLine(QLine((int)front.x(),(int)front.y(),(int)back.x(),(int)back.y()));
  painter.setPen(xColor);
  painter.drawLine(QLine((int)left.x(),(int)left.y(),(int)right.x(),(int)right.y()));
  painter.setPen(yColor);
  painter.drawLine(QLine((int)top.x(),(int)top.y(),(int)bottom.x(),(int)bottom.y()));

  if (vec.z()>=0){ //sul fronte
    painter.setBrush(pointColor);
    painter.setPen(Qt::SolidLine); 
    painter.drawEllipse(QRectF(vec.x()-10,vec.y()-10,20,20));
  }  
}