Hi.
First post here so greetings all.
Very new to SFML (yesterday) and just getting back into programming after a long hiatus (decades).
I'm using SFML 1.6 (Headers, Libraries, and External Libraries Visual C++ 2008 pack) in VS2010 Express with C++, using .dll files downloaded from here:
http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition-The-Introduction.aspxwhich are allegedly configured to agree with VS2010.
I've been playing around with RenderWindows a little, not really having much of an idea what I'm doing.
If I open two windows (a top and a bottom) and close the top one, the portion of the top window that overlapped the bottom window remains visible. Here's a screenshot:
http://i92.photobucket.com/albums/l28/erikhasissue/screen.pngAnyone know why?
Weirdly, if I make the bottom window active and close it first, it vanishes completely as expected.
Allow me to emphasize once more,
I have no idea what I'm doing.
Here's my code:
#include "stdafx.h"
#include "SFML/Graphics.hpp"
int _tmain(int argc, _TCHAR* argv[])
{
sf::VideoMode VTMode(600, 400, 32);
sf::VideoMode VBMode(800, 300, 32);
sf::RenderWindow BotWin(VBMode, "This is the bottom window.");
sf::RenderWindow TopWin(VTMode, "This is the top window.");
sf::Shape Ball=sf::Shape::Circle (0,0,25,sf::Color(0,0,200));
int x, y;
x=255; y=100;
int z=150;
while (TopWin.IsOpened()||BotWin.IsOpened())
{
sf::Event A;
if (TopWin.GetEvent(A))
{
if (A.Type==sf::Event::Closed)TopWin.Close();
if (A.Type==sf::Event::MouseEntered) {x=255;y=100;}
if (A.Type==sf::Event::MouseLeft) {x=0;y=255;}
}
if (BotWin.GetEvent(A))
if (A.Type==sf::Event::Closed) BotWin.Close();
if (BotWin.IsOpened())
{
BotWin.Display();
BotWin.Clear(sf::Color(255, 0, 255));
}
if (TopWin.IsOpened())
{
TopWin.Display();
TopWin.Clear(sf::Color(x, y, 0));
Ball.SetPosition(z,150);
TopWin.Draw(Ball);
z++;
sf::Sleep(0.03f);
}
}
return 0;
}