forked from jaildesigner-jailgames/jaildoctors_dilemma
La barra de progres ja torna a estar com abans
This commit is contained in:
@@ -403,6 +403,7 @@ void Resource::calculateTotal()
|
||||
AssetType::SOUND,
|
||||
AssetType::MUSIC,
|
||||
AssetType::BITMAP,
|
||||
AssetType::PALETTE,
|
||||
AssetType::FONT,
|
||||
AssetType::ANIMATION,
|
||||
AssetType::TILEMAP,
|
||||
@@ -431,7 +432,7 @@ void Resource::renderProgress()
|
||||
auto surface = Screen::get()->getRendererSurface();
|
||||
const int wired_bar_width = options.game.width - (X_PADDING * 2);
|
||||
SDL_Rect rect_wired = {X_PADDING, bar_position, wired_bar_width, X_PADDING};
|
||||
surface->fillRect(&rect_wired, stringToColor("blue"));
|
||||
surface->drawRectBorder(&rect_wired, stringToColor("white"));
|
||||
|
||||
const int full_bar_width = wired_bar_width * count_.getPercentage();
|
||||
SDL_Rect rect_full = {X_PADDING, bar_position, full_bar_width, X_PADDING};
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -110,9 +110,12 @@ public:
|
||||
// Obtiene el color de un pixel de la surface_data
|
||||
Uint8 getPixel(int x, int y);
|
||||
|
||||
// Dibuja un rectangulo
|
||||
// Dibuja un rectangulo relleno
|
||||
void fillRect(SDL_Rect *rect, Uint8 color);
|
||||
|
||||
// Dibuja el borde de un rectangulo
|
||||
void drawRectBorder(SDL_Rect *rect, Uint8 color);
|
||||
|
||||
// Dibuja una linea
|
||||
void drawLine(int x1, int y1, int x2, int y2, Uint8 color);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user