Category : sdl

Code producing exception: //Sets tiles from tile map bool setTiles(Tile* tiles[]) { //Success flag bool tilesLoaded = true; //The tile offsets int x = 0, y = 0; //Open the map std::ifstream map("Assets/lazy.map"); //If the map couldn’t be loaded if (map.fail()) { printf("Unable to load map file!n"); tilesLoaded = false; } else { //Initialize the ..

Read more

I am trying to render a Texture with Alpha-Channel to my Window but it shows up with dark/black edges on some parts of the Texture. The Image is loaded via the SDL_image library IMG_Load(img_path) and later converted to a Texture using SDL_CreateTextureFromSurface(img_surface). The Texture has a Alpha-Channel and I would like to blend it onto ..

Read more

i’ve been trying to learn SDL2 with c++. But i keep getting this weird error. This is a simplified version of the code that produces the error. #include <SDL2/SDL.h> #include <iostream> int main() { SDL_Init(SDL_INIT_EVERYTHING); SDL_Window *window = NULL; SDL_Renderer *renderer = NULL; SDL_Surface *screen = NULL; window = SDL_CreateWindow("Window", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 600, 400, SDL_WINDOW_RESIZABLE|SDL_WINDOW_BORDERLESS); ..

Read more

I’m currently writing a gui and wanted to implement sdl_ttf to my project, the problem is font loading: no font wants to actually load, TTF_OpenFont errors with Error writing to datastream. bool gui::initalize() { if (SDL_Init(SDL_INIT_VIDEO) != 0) { printf("SDL_Init error: %sn", SDL_GetError()); return 1; } this->window = SDL_CreateWindow("Speller", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 800, 0); this->renderer ..

Read more