#include <stdio.h>
#include <zlib.h>
-extern bool visibleloading;
-
/* These two are needed for screenshot */
extern int kContextWidth;
extern int kContextHeight;
bool load_image(const char *file_name, ImageRec &tex)
{
- if (visibleloading) {
- Game::LoadingScreen();
- }
+ Game::LoadingScreen();
if ( tex.data == NULL ) {
return false;
struct my_error_mgr jerr;
JSAMPROW buffer[1]; /* Output row buffer */
int row_stride; /* physical row width in output buffer */
+ errno = 0;
FILE *infile = fopen(file_name, "rb");
- if (infile == NULL)
+ if (infile == NULL) {
+ perror((std::string("Couldn't open file ") + file_name).c_str());
return false;
+ }
cinfo.err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = my_error_exit;
int bit_depth, color_type, interlace_type;
bool retval = false;
png_byte **row_pointers = NULL;
+ errno = 0;
FILE *fp = fopen(file_name, "rb");
if (fp == NULL) {
- cerr << file_name << " not found" << endl;
+ perror((std::string("Couldn't open file ") + file_name).c_str());
return false;
}
png_infop info_ptr = NULL;
bool retval = false;
+ errno = 0;
fp = fopen(file_name, "wb");
- if (fp == NULL)
+ if (fp == NULL) {
+ perror((std::string("Couldn't open file ") + file_name).c_str());
return false;
+ }
png_bytep *row_pointers = new png_bytep[kContextHeight];
png_bytep screenshot = new png_byte[kContextWidth * kContextHeight * 3];