Sprites throw an error when they exceed a certain size

Issue #30 closed
created an issue

I ran into this error while working on my 7drl this year, and I can't find a way around it.

Whenever I try to either load a large image as a sprite or resize an image to be larger than some threshold, I get a std::runtime_error thrown.

Here's my minimal example:

#include "BearLibTerminal.h"

int main() {
  terminal_set("window: size=160x100");
  terminal_set("U+E000: Background.jpg, resize=1280x800");

  terminal_put(0, 0, 0xE000); // Background

  while (true) {
    int key = terminal_read();
    if (key == TK_CLOSE || key == TK_ESCAPE) {

  return 0;

The above example throws this error:

terminate called after throwing an instance of 'std::runtime_error'
  what():  Failed to add a sprite tile to a newly constructed texture
Aborted (core dumped)

As your sample shows, the above function will work with no resizing. But the resizing breaks the code. I originally ran into the problem trying to load in a 1280x800 png file, with no resizing.

For the above example, I used the image from your samples: Background.jpg

Comments (2)

  1. Log in to comment