SFML community forums
Help => Window => Topic started by: Christopher Jozwiak on December 23, 2011, 11:35:54 pm
-
No errors, I have my clear set too 0,255,255 and my image is black. Here's the code.
// SFMLWindow.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow Screen(sf::VideoMode(1024, 768, 32), "SFML-Window");
while(Screen.IsOpened())
{
sf::Image image;
if(!image.LoadFromFile("sprite.png"))
return EXIT_FAILURE;
sf::Sprite sprite(image);
Screen.Draw(sprite);
Screen.Clear(sf::Color(0,255,255));
Screen.Display();
sf::Event Event;
while (Screen.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
Screen.Close();
}
}
return EXIT_SUCCESS;
}
-
You're clearing the screen after you draw the sprite.
-
sf::Image image;
if(!image.LoadFromFile("sprite.png"))
return EXIT_FAILURE;
sf::Sprite sprite(image);
Not in the While.
And Clear always before your Draw