1
Graphics / texture.update() problem
« on: May 27, 2015, 01:56:17 pm »
I am making a mini zombie survival game in SFML, and what I'm trying to do at the moment is to render the map. However, when I try to use the line:
it crashes, and at first I thought it is because the image size is too big or something, or I made a derp in the development process, so I created a minimal code, and please note, I made sure the
#include<iostream>
#include<SFML/Graphics.hpp>
#include<SFML/Window.hpp>
int main(){
sf::Image image;
sf::RenderWindow window(sf::VideoMode(800,600),"minimal code");
sf::Texture texture;
sf::Event event;
while(window.isOpen()){
while(window.pollEvent(event)){
if(event.type == sf::Event::Closed){
window.close();
}
}
image.create(64,64);
image.loadFromFile("Stones.png");
texture.update(image,64,64);
}
}
now that the context of the minimal code is given, I should also tell you that
here is the png, just so you can do a quick test.
this->texture->update(tile1,x*64,y*64);
it crashes, and at first I thought it is because the image size is too big or something, or I made a derp in the development process, so I created a minimal code, and please note, I made sure the
"Stones.png"
is 64x64.#include<iostream>
#include<SFML/Graphics.hpp>
#include<SFML/Window.hpp>
int main(){
sf::Image image;
sf::RenderWindow window(sf::VideoMode(800,600),"minimal code");
sf::Texture texture;
sf::Event event;
while(window.isOpen()){
while(window.pollEvent(event)){
if(event.type == sf::Event::Closed){
window.close();
}
}
image.create(64,64);
image.loadFromFile("Stones.png");
texture.update(image,64,64);
}
}
now that the context of the minimal code is given, I should also tell you that
texture.update(image,64,64);
is what causes the problem.here is the png, just so you can do a quick test.