Ich bin neu in SDL. Ich bin dabei, ein Blackjack-Spiel zu machen. Ich möchte ein Array von Texturen erstellen. Ich fragte mich, ob jemand mir helfen könnte. Hier ist das, was ich habe versucht zu tun:SDL-Textur-Array?
// array of textures for the extra player cards
SDL_Texture *hitCardsText[] = { NULL };
// this does not give me errors but i dont know if it is right
hitCardsText[0] = loadTexture(ren, cards[dynamicPlayerCards[0]]);
hitCardsText[1] = loadTexture(ren, cards[dynamicPlayerCards[1]]);
// i get an error here
SDL_DestroyTexture(hitCardsText[0]);
SDL_DestroyTexture(hitCardsText[1]);
erhalte ich diesen Fehler, wo ich oben im Code angegeben (meine Datei introSDL.exe genannt btw):
Unbehandelte Ausnahme bei 0x6C78CE9A (SDL2. dll) in introSDL.exe: 0xC0000005: Zugriffsverletzung lesen Speicherort 0x00000050.
danke für die Antwort. Was Sie sagen, macht Sinn, aber jetzt bekomme ich eine Unhandled-Ausnahme bei 0x779DDAD8 in introSDL.exe: Microsoft C++ - Ausnahme: std :: bad_alloc am Speicherort 0x0018EFE4 bei hitCardsText.push_back (loadTexture (ren, Karten [dynamicPlayerCards [0]])); – soso