With your help I was able to come up with code that works. Thanks.
#include <SFML/Graphics.hpp>
#include <iostream>
#include <sstream>
int main()
{
int Color;
char buffer[10];
// Create main window
sf::RenderWindow App(sf::VideoMode(1200, 900), "SFML Graphics");
// Load a font from a file
sf::Font MyFont;
if (!MyFont.LoadFromFile("/users/warren/projects/impact.ttf", 50))
return EXIT_FAILURE;
// Clear screen
App.Clear(sf::Color(128,128,255));
// Draw apredefined shape
App.Draw(sf::Shape::Rectangle(50,50,200, 200, sf::Color(64,128,190)));
// Finally, display the rendered frame on screen
App.Display();
sf::Image Image = App.Capture();
sf::Color color = Image.GetPixel(100, 100);
// Create a graphical string
sf::String prntr;
sprintf(buffer,"%i",(int)color.r);
prntr.SetText(buffer);
prntr.SetFont(MyFont);
prntr.SetColor(sf::Color(0, 0, 0));
prntr.SetPosition(150, 350);
prntr.SetSize(150);
// Draw our strings
App.Draw(prntr);
// Create a graphical string
sf::String prntg;
sprintf(buffer,"%i",(int)color.g);
prntg.SetText(buffer);
prntg.SetFont(MyFont);
prntg.SetColor(sf::Color(0, 0, 0));
prntg.SetPosition(450, 350);
prntg.SetSize(150);
// Draw our strings
App.Draw(prntg);
// Create a graphical string
sf::String prntb;
sprintf(buffer,"%i",(int)color.b);
prntb.SetText(buffer);
prntb.SetFont(MyFont);
prntb.SetColor(sf::Color(0, 0, 0));
prntb.SetPosition(750, 350);
prntb.SetSize(150);
// Draw our strings
App.Draw(prntb);
// Finally, display the rendered frame on screen
App.Display();
// Start game loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
}
}
return EXIT_SUCCESS;
}