1
스프라이트를 그리면 내 창이 닫힙니다.그리기 중 세그먼트 오류
내 코드가 인데도 그대로 유지하면 스프라이트를 그리지 않는다는 점을 제외하면 확실히 작동하기 때문에 그리기 부분이 분명합니다. Segmentation fault (core dumped)
나도 몰라 그게 무슨 뜻인지 : 실행할 때
또한 나는이 오류가 /을.
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Audio.hpp>
#include <string>
#include <iostream>
#include <vector>
using namespace std;
//create vars
sf::Color bgColour(20, 175, 215);
vector<sf::Sprite> tiles;
void CreateTile(string Texture, int x, int y)
{
sf::Vector2f Pos(x, y);
sf::Texture Ftexture;
Ftexture.loadFromFile(Texture);
sf::Sprite Tile;
Tile.setTexture(Ftexture);
Tile.setPosition(Pos);
tiles.push_back(Tile);
}
int main()
{
//create window
sf::RenderWindow window(sf::VideoMode(800, 600), "-\\\\-(Game)-//-");
CreateTile("Recources/grass.png", 40, 40);
//main loop
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
window.close();
}
}
window.clear(bgColour);
window.draw(tiles[1]);
window.display();
}
return 0;
}
감사 :
그리고 여기 내 코드입니다!