Fixed bug which caused buttons not to be displayed and game to crash

This commit is contained in:
Dave White 2003-09-26 09:16:42 +00:00
parent c3c0cc50c5
commit 4e954b84c9
3 changed files with 9 additions and 3 deletions

View file

@ -358,6 +358,8 @@ void display::draw(bool update,bool force)
SDL_FreeSurface(image);
image = new_image;
sidebarScaling_ = static_cast<double>(image->h)/768.0;
} else {
std::cerr << "Could not scale image\n";
}
}

View file

@ -52,8 +52,8 @@ SDL_Surface* scale_surface(SDL_Surface* surface, int w, int h)
const int dstpad = dstxpad*ydst;
srclock.pixels()[ydst*w + xdst + dstpad] =
dstlock.pixels()[ysrcint*surface->w + xsrcint];
dstlock.pixels()[ydst*w + xdst + dstpad] =
srclock.pixels()[ysrcint*surface->w + xsrcint];
}
}

View file

@ -19,6 +19,7 @@
#include "SDL.h"
#include <cstdlib>
#include <iostream>
#include <string>
struct free_sdl_surface {
@ -89,14 +90,17 @@ struct surface_lock
const int res = SDL_LockSurface(surface_);
if(res == 0) {
locked_ = true;
std::cerr << "locked surface\n";
}
}
}
~surface_lock()
{
if(locked_)
if(locked_) {
std::cerr << "unlocking surface\n";
SDL_UnlockSurface(surface_);
}
}
short* pixels() { return reinterpret_cast<short*>(surface_->pixels); }