Witam mam problem otóż gdy kompiluje i odpalam swoją gierkę w sfml-u wszystko fajnie śmiga dopiero jak odpala mi się Menu główne to gra crash-uje i wywala.
Podejrzewam że błąd leży gdzieś w tym kodzie więc go wysyłam.:
#include "StartState.h"
StartState::StartState(RenderWindow* win, stack<StateMachine*>* states) : StateMachine(win,states)
{
c = 0;
i = 0;
white = false;
this->BackGround.setSize(Vector2f(win->getSize()));
this->BackGround.setPosition(0, 0);
this->Title = new Txt("FONTS/Blox2.ttf", "One Life", 72, win->getSize().x / 2, win->getSize().y / 2);
this->Author = new Txt("FONTS/01 Digit.ttf", "By Chomik", 24, win->getSize().x / 2, 6*win->getSize().y / 8);
}
StartState::~StartState()
{
}
void StartState::EndState()
{
}
void StartState::Update(const float& dt)
{
if (c < 255 && white == false)
{
c++;
}
else
{
white = true;
}
if (i < 400 && white == true)
{
i++;
}
if (c > 0 && white == true && i == 400)
{
c--;
}
if (c == 0)
{
this->states->push(new MainMenuState(this->win,this->states));
}
this->Title->Update(Color(255, 255, 255, c), dt);
this->Author->Update(Color(255, 255, 255, c), dt);
this->BackGround.setFillColor(Color(93, 39, 186, c));
}
void StartState::Render(RenderTarget* target)
{
target->draw(this->BackGround);
Title->Render(target);
this->Author->Render(target);
}
Albo już w samym menu więc też wysyłam tu:
#include "MainMenuState.h"
MainMenuState::MainMenuState(RenderWindow* win, stack<StateMachine*>* states) : StateMachine(win, states)
{
this->BackGround.setSize(Vector2f(win->getSize()));
this->BackGround.setPosition(0, 0);
}
MainMenuState::~MainMenuState()
{
}
void MainMenuState::EndState()
{
}
void MainMenuState::Update(const float& dt)
{
this->BackGround.setFillColor(Color(93, 39, 186, 255));
}
void MainMenuState::Render(RenderTarget* target)
{
target->draw(this->BackGround);
}
Proszę o szybką pomoc.