Когда я запускаю игру:
// 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
Игра вылетает на первом кадре ⇐ C++
Программы на C++. Форум разработчиков
1715620859
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[i]);
}
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78473785/game-crashing-at-the-first-frame[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия