He posat punteros dobles i tampoc va res

This commit is contained in:
2025-03-05 12:31:54 +01:00
parent 33038e8509
commit d41b0cb31c
11 changed files with 151 additions and 144 deletions

View File

@@ -167,7 +167,7 @@ void Ending::iniTexts()
const int WIDTH = text->lenght(txt.caption, 1) + 2 + 2;
const int HEIGHT = text->getCharacterSize() + 2 + 2;
Uint8 color = stringToColor("black");
auto color = stringToColor("black");
EndingSurface st;
@@ -188,22 +188,22 @@ void Ending::iniTexts()
Screen::get()->clearSurface(stringToColor("transparent"));
// Crea una malla de 8 pixels de alto
auto surface = Screen::get()->getRenderSurfaceData();
auto surface_data = *(Screen::get()->getRenderSurfaceData());
color = stringToColor("black");
for (int i = 0; i < WIDTH; i += 2)
{
st.cover_surface->putPixel(surface, i, 0, color);
st.cover_surface->putPixel(surface, i, 2, color);
st.cover_surface->putPixel(surface, i, 4, color);
st.cover_surface->putPixel(surface, i, 6, color);
st.cover_surface->putPixel(surface_data, i, 0, color);
st.cover_surface->putPixel(surface_data, i, 2, color);
st.cover_surface->putPixel(surface_data, i, 4, color);
st.cover_surface->putPixel(surface_data, i, 6, color);
st.cover_surface->putPixel(surface, i + 1, 5, color);
st.cover_surface->putPixel(surface, i + 1, 7, color);
st.cover_surface->putPixel(surface_data, i + 1, 5, color);
st.cover_surface->putPixel(surface_data, i + 1, 7, color);
}
// El resto se rellena de color sólido
SDL_Rect rect = {0, 8, WIDTH, HEIGHT};
st.cover_surface->fillRect(surface, &rect, color);
st.cover_surface->fillRect(surface_data, &rect, color);
// Crea el sprite
st.cover_sprite = std::make_shared<SSprite>(st.cover_surface, 0, 0, st.cover_surface->getWidth(), st.cover_surface->getHeight() - 8);
@@ -255,22 +255,22 @@ void Ending::iniPics()
Screen::get()->clearSurface(stringToColor("transparent"));
// Crea una malla en los primeros 8 pixels
auto surface = Screen::get()->getRenderSurfaceData();
auto surface_data = *(Screen::get()->getRenderSurfaceData());
auto color = stringToColor("black");
for (int i = 0; i < WIDTH; i += 2)
{
sp.cover_surface->putPixel(surface, i, 0, color);
sp.cover_surface->putPixel(surface, i, 2, color);
sp.cover_surface->putPixel(surface, i, 4, color);
sp.cover_surface->putPixel(surface, i, 6, color);
sp.cover_surface->putPixel(surface_data, i, 0, color);
sp.cover_surface->putPixel(surface_data, i, 2, color);
sp.cover_surface->putPixel(surface_data, i, 4, color);
sp.cover_surface->putPixel(surface_data, i, 6, color);
sp.cover_surface->putPixel(surface, i + 1, 5, color);
sp.cover_surface->putPixel(surface, i + 1, 7, color);
sp.cover_surface->putPixel(surface_data, i + 1, 5, color);
sp.cover_surface->putPixel(surface_data, i + 1, 7, color);
}
// El resto se rellena de color sólido
SDL_Rect rect = {0, 8, WIDTH, HEIGHT};
sp.cover_surface->fillRect(surface, &rect, color);
sp.cover_surface->fillRect(surface_data, &rect, color);
// Crea el sprite
sp.cover_sprite = std::make_shared<SSprite>(sp.cover_surface, 0, 0, sp.cover_surface->getWidth(), sp.cover_surface->getHeight() - 8);
@@ -477,22 +477,22 @@ void Ending::fillCoverTexture()
// Los primeros 8 pixels crea una malla
const Uint8 color = stringToColor("black");
auto surface = Screen::get()->getRenderSurfaceData();
auto surface_data = *(Screen::get()->getRenderSurfaceData());
for (int i = 0; i < 256; i += 2)
{
cover_surface_->putPixel(surface, i + 0, options.game.height + 0, color);
cover_surface_->putPixel(surface, i + 1, options.game.height + 1, color);
cover_surface_->putPixel(surface, i + 0, options.game.height + 2, color);
cover_surface_->putPixel(surface, i + 1, options.game.height + 3, color);
cover_surface_->putPixel(surface_data, i + 0, options.game.height + 0, color);
cover_surface_->putPixel(surface_data, i + 1, options.game.height + 1, color);
cover_surface_->putPixel(surface_data, i + 0, options.game.height + 2, color);
cover_surface_->putPixel(surface_data, i + 1, options.game.height + 3, color);
cover_surface_->putPixel(surface, i, options.game.height + 4, color);
cover_surface_->putPixel(surface, i, options.game.height + 6, color);
cover_surface_->putPixel(surface_data, i, options.game.height + 4, color);
cover_surface_->putPixel(surface_data, i, options.game.height + 6, color);
}
// El resto se rellena de color sólido
SDL_Rect rect = {0, 0, 256, options.game.height};
cover_surface_->fillRect(surface, &rect, color);
cover_surface_->fillRect(surface_data, &rect, color);
Screen::get()->setRenderSurfaceData(nullptr);
}