LoadTexture keeps giving me a segfault

Using a different image from the same folder doesn’t change anything.

#include "raylib.h"

int main()
{
    const int screen_width{384}, screen_height{384};

    Texture2D world_map = LoadTexture("nature_tileset/world_map.png");

    InitWindow(screen_width, screen_height, "Classy Clash");

    SetTargetFPS(60);
    while(!WindowShouldClose())
    {

        BeginDrawing();
            ClearBackground(WHITE);
            DrawTextureEx(world_map, {0.0F, 0.0F}, 0.0F, 4.0F, WHITE);
        EndDrawing();

    }

    UnloadTexture(world_map);

    CloseWindow();

    return 0;
}

The problem was calling LoadTexture before InitWindow.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms