Игра вылетает на первом кадреC++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Игра вылетает на первом кадре

Сообщение Anonymous »

Когда я запускаю игру:
// Compile with: g++ main.cpp -lSDL2 -lSDL2_image -lSDL2_ttf -o "Five Nights At Chipflakes"

#include
#include
#include
#include
#include

#include
#include
#include

#define SDL_INITIALIZATION_ERROR 1
#define IMG_INITIALIZATION_ERROR 2
#define TTF_INITIALIZATION_ERROR 3
#define SAVEDATA_LOADING_ERROR 4
#define WINDOW_CREATION_ERROR 5
#define RENDERER_CREATION_ERROR 6

#define IMAGE_LOADING_ERROR 7

SDL_Window* window;
SDL_Renderer* renderer;

SDL_Texture* imageSlot[10];
SDL_Rect imageRect[10];

std::vector animationFrames1;
std::vector animationFrameRects1;

std::vector animationFrames2;
std::vector animationFrameRects2;

std::vector animationFrames3;
std::vector animationFrameRects3;

int animationIndex = 0;

bool animationOnePlaying = false;
bool animationTwoPlaying = false;
bool animationThreePlaying = false;

int animationOneLoops;
int animationTwoLoops;
int animationThreeLoops;

SDL_Texture* textTexture[10];

SDL_Rect textRect[10];

TTF_Font* mainFont;

int imageIndex = 0;
int textIndex = 0;
int buttonIndex = 0;

int elapsedFrames = 0;

int elaspedMilliseconds = 0;

int scene = 1;

bool scenesLoaded[1] = {false};

const char* staticEffect[8] = {"./Assets/Animations/Static/Frame1.png", "./Assets/Animations/Static/Frame2.png", "./Assets/Animations/Static/Frame3.png", "./Assets/Animations/Static/Frame4.png", "./Assets/Animations/Static/Frame5.png", "./Assets/Animations/Static/Frame6.png", "./Assets/Animations/Static/Frame7.png", "./Assets/Animations/Static/Frame8.png"};

SDL_Rect staticEffectRect[8];

const char* saveDataPath = "./savadata.ini";

std::string saveDataLines[4];

int night;

bool star1;
bool star2;
bool star3;

bool printElapsedMilliseconds = false;
bool printMousePos = false;
bool printRandomNumber = false;
bool printFrameRate = false;

int mouseX;
int mouseY;

bool mouseDown;

int randomNumber;

float averageFPS;

bool evilChipLoaded = false;

SDL_Rect button[10];

int createWindow()
{
if(SDL_Init(SDL_INIT_EVERYTHING) != 0){return SDL_INITIALIZATION_ERROR;}
if(IMG_Init(IMG_INIT_PNG) == 0){return IMG_INITIALIZATION_ERROR;}
if(TTF_Init() != 0){return TTF_INITIALIZATION_ERROR;}

std::ifstream saveData("savedata.ini");

if(!saveData.is_open()){return SAVEDATA_LOADING_ERROR;}

for(int i = 0; i < 4; i++)
{
std::getline(saveData, saveDataLines);
}

std::cout

Подробнее здесь: https://stackoverflow.com/questions/784 ... irst-frame
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»