La barra de progres ja torna a estar com abans
This commit is contained in:
@@ -137,7 +137,7 @@ Uint8 Surface::getPixel(int x, int y)
|
||||
return surface_data_->data[x + y * surface_data_->width];
|
||||
}
|
||||
|
||||
// Dibuja un rectangulo
|
||||
// Dibuja un rectangulo relleno
|
||||
void Surface::fillRect(SDL_Rect *rect, Uint8 color)
|
||||
{
|
||||
// Limitar los valores del rectángulo al tamaño de la superficie
|
||||
@@ -157,6 +157,40 @@ void Surface::fillRect(SDL_Rect *rect, Uint8 color)
|
||||
}
|
||||
}
|
||||
|
||||
// Dibuja el borde de un rectangulo
|
||||
void Surface::drawRectBorder(SDL_Rect *rect, Uint8 color)
|
||||
{
|
||||
// Limitar los valores del rectángulo al tamaño de la superficie
|
||||
int x_start = std::max(0, rect->x);
|
||||
int y_start = std::max(0, rect->y);
|
||||
int x_end = std::min(rect->x + rect->w, static_cast<int>(surface_data_->width));
|
||||
int y_end = std::min(rect->y + rect->h, static_cast<int>(surface_data_->height));
|
||||
|
||||
// Dibujar bordes horizontales
|
||||
for (int x = x_start; x < x_end; ++x)
|
||||
{
|
||||
// Borde superior
|
||||
const int top_index = x + y_start * surface_data_->width;
|
||||
surface_data_->data[top_index] = color;
|
||||
|
||||
// Borde inferior
|
||||
const int bottom_index = x + (y_end - 1) * surface_data_->width;
|
||||
surface_data_->data[bottom_index] = color;
|
||||
}
|
||||
|
||||
// Dibujar bordes verticales
|
||||
for (int y = y_start; y < y_end; ++y)
|
||||
{
|
||||
// Borde izquierdo
|
||||
const int left_index = x_start + y * surface_data_->width;
|
||||
surface_data_->data[left_index] = color;
|
||||
|
||||
// Borde derecho
|
||||
const int right_index = (x_end - 1) + y * surface_data_->width;
|
||||
surface_data_->data[right_index] = color;
|
||||
}
|
||||
}
|
||||
|
||||
// Dibuja una linea
|
||||
void Surface::drawLine(int x1, int y1, int x2, int y2, Uint8 color)
|
||||
{
|
||||
@@ -277,7 +311,6 @@ void Surface::render(int x, int y, SDL_Rect *srcRect, SDL_RendererFlip flip)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Copia una región de la superficie de origen a la de destino
|
||||
void Surface::render(SDL_Rect *srcRect, SDL_Rect *dstRect, SDL_RendererFlip flip)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user