1
Graphics / Render to a sub rectangle?
« on: February 06, 2009, 11:33:40 pm »Quote from: "Laurent"
QuoteI saw that in the header files for 1.4
Really? What did you see?
Actually, I think I only saw the forward declaration in Image.hpp.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
QuoteI saw that in the header files for 1.4
Really? What did you see?
for (int i = 0; i < MAX_STARS; i++)
{
renderWindow.Draw(_stars[i]);
}
If you are compiling in debug mode, you have t ouse the -d libraries.
When you link the libraries you have to do it in the good order :
-lsfml-graphics-d
-lsfml-window-d
-lsfml-system-d
fatal error C1047: The object or library file 'G:\Development\Microsoft Visual Studio 8\VC\lib\sfml-graphics.lib' was created with an older compiler than other objects; rebuild old objects and libraries
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
// Create the main rendering window
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Test",sf::Window::Fixed);
// Change background color to red
App.SetBackgroundColor(sf::Color(0, 0, 0));
// Start game loop
bool Running = true;
while (Running)
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Close)
Running = false;
// A key has been pressed
if (Event.Type == sf::Event::KeyPressed)
{
// Escape key : exit
if (Event.Key.Code == sf::Key::Escape)
Running = false;
// F1 key : capture a screenshot
if (Event.Key.Code == sf::Key::F1)
{
sf::Image Screen = App.Capture();
Screen.SaveToFile("screenshot.jpg");
}
}
}
// Display window contents on screen
App.Display();
}
return EXIT_SUCCESS;
}