Witam
Mam pewien problem z którym męczę się już kilka dobrych dni
Dwie klasy których prawdopodobnie dotyczy problem
#pragma once
#include <SFML/Graphics.hpp>
#include "Singe_option_esc_menu.hpp"
class Menu_esc_in_game
{
public:
Menu_esc_in_game(sf::View& window, uint8_t type_menu);
uint8_t system(sf::View& window);
void objects_ini();
void draw(sf::RenderWindow& window);
private:
sf::RectangleShape all_panel_top;
sf::Font font_menu;
bool menu_visible{ false };
std::vector<Singe_option_esc_menu>single_option;
uint8_t no_of_option_menu{ 5 };
};
#include "Menu_esc_in_game.hpp"
Menu_esc_in_game::Menu_esc_in_game(sf::View& window, uint8_t type_menu)
{
this->font_menu.loadFromFile("Game/Fonts/butler.ttf");
this->all_panel_top.setSize(sf::Vector2f(window.getSize().x / 3, window.getSize().y / 3));
this->all_panel_top.setPosition(window.getCenter().x - all_panel_top.getGlobalBounds().width / 2, window.getCenter().y - all_panel_top.getGlobalBounds().height / 2);
this->all_panel_top.setFillColor(sf::Color(255, 0, 0, 111));
this->objects_ini();
}
uint8_t Menu_esc_in_game::system(sf::View& window)
{
if (menu_visible == false)
{
return 0;
}
else
{
return 1;
}
}
void Menu_esc_in_game::objects_ini()
{
single_option.push_back(Singe_option_esc_menu(&font_menu, sf::Vector2f(all_panel_top.getPosition().x, all_panel_top.getPosition().y),
sf::Vector2f(all_panel_top.getGlobalBounds().width, all_panel_top.getGlobalBounds().height / no_of_option_menu), "Resume"));
}
void Menu_esc_in_game::draw(sf::RenderWindow& window)
{
window.draw(all_panel_top);
for (uint8_t i = 0; i < single_option.size(); i++)
{
single_option[i].draw(window);
}
//for (auto i : single_option)
// i.draw(window);
}
#pragma once
#include <SFML/Graphics.hpp>
class Singe_option_esc_menu
{
public:
Singe_option_esc_menu(sf::Font* font_text, sf::Vector2f pos, sf::Vector2f size, std::string name);
uint8_t system(sf::View& window, bool mark_on);
void draw(sf::RenderWindow& window);
private:
sf::RectangleShape esc_option;
sf::RectangleShape mark_option;
bool mark_visible{ false };
sf::Text text_menu;
};
#include "Singe_option_esc_menu.hpp"
Singe_option_esc_menu::Singe_option_esc_menu(sf::Font* font_text, sf::Vector2f pos, sf::Vector2f size, std::string name)
{
this->esc_option.setSize(sf::Vector2f(size.x, size.y));
this->esc_option.setPosition(pos.x, pos.y);
this->esc_option.setFillColor(sf::Color(0, 255, 0, 111));
this->mark_option.setSize(sf::Vector2f(size.x, size.y));
this->mark_option.setPosition(pos.x, pos.y);
this->mark_option.setFillColor(sf::Color(0, 0, 0, 111));
this->mark_option.setScale(sf::Vector2f(0, 0));
this->text_menu.setString(name);
this->text_menu.setFont(*font_text);
this->text_menu.setCharacterSize(size.y);
this->text_menu.setFillColor(sf::Color(111, 222, 55, 255));
this->text_menu.setPosition(esc_option.getPosition().x + esc_option.getGlobalBounds().width / 2 - text_menu.getGlobalBounds().width / 2,
esc_option.getPosition().y + esc_option.getGlobalBounds().height / 2 - text_menu.getGlobalBounds().height / 2);
}
uint8_t Singe_option_esc_menu::system(sf::View& window, bool mark_on)
{
this->mark_visible = mark_on;
if (mark_visible == true)
{
this->mark_option.setScale(sf::Vector2f(1.0, 1.0));
}
else
{
this->mark_option.setScale(sf::Vector2f(0, 0));
}
return 0;
}
void Singe_option_esc_menu::draw(sf::RenderWindow& window)
{
window.draw(esc_option);
window.draw(mark_option);
window.draw(text_menu);
}
Wyskakuje mi błąd przy kompilacji:
Na tyle na ile pozwalają moje umiejętności uruchomiłem debuger i starałem się znaleźć miejsce gdzie program się zatrzymuje
Błąd wyskakuje dokładnie w momencie wywołania funkcji draw w lini 42 Singe_option_esc_menu.cpp
Nie mam pojęcia jak się za to zabrać, może ktoś da jakąś podpowiedz
Cały projekt na: GITHUB