Any ideas?
so I can set it up like so for windowed mode (which works anyway)
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/OpenGl.hpp>
#include <iostream>
////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
sf::Texture texBack; //640 ,480 size
texBack.LoadFromFile("introback.bmp");
sf::Sprite sprBack;
sprBack.SetTexture(texBack);
//current video mode
sf::VideoMode DesktopMode = sf::VideoMode::GetDesktopMode();
std::vector<sf::VideoMode> modes = sf::VideoMode::GetFullscreenModes();
for (std::size_t i = 0; i < modes.size(); ++i)
{
sf::VideoMode mode = modes[i];
std::cout << "Mode #" << i << ": "
<< mode.Width << "x" << mode.Height << " - "
<< mode.BitsPerPixel << " bpp" << std::endl;
}
// Create the main rendering window
sf::RenderWindow App; //(sf::VideoMode(320, 224, 32), "SFML Graphics", sf::Style::None);
sf::View view;
// App.Create(sf::VideoMode(320, 220, DesktopMode.BitsPerPixel), "SFML Graphics", sf::Style::None);
//App.Create(sf::VideoMode(DesktopMode.Width / 2, DesktopMode.Height / 2, DesktopMode.BitsPerPixel), "SFML Graphics", sf::Style::Fullscreen);
//App.Create(sf::VideoMode(1024, 720, DesktopMode.BitsPerPixel), "SFML Graphics", sf::Style::None );
App.Create(sf::VideoMode(DesktopMode.Width , DesktopMode.Height , DesktopMode.BitsPerPixel), "SFML Graphics", sf::Style::Fullscreen);
view = App.GetView();
//App.Create(sf::VideoMode(DesktopMode.Width , DesktopMode.Height, DesktopMode.BitsPerPixel), "SFML Graphics", sf::Style::Fullscreen);
view.SetSize(640 ,480 );
view.SetCenter(640 / 2 ,480/ 2 );
App.SetView(view);
//
// Start game loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.PollEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
// Resize event : adjust viewport
if (Event.Type == sf::Event::Resized)
{
//glViewport(0, 0, 640, 480);
view = App.GetView();
//App.Create(sf::VideoMode(DesktopMode.Width , DesktopMode.Height, DesktopMode.BitsPerPixel), "SFML Graphics", sf::Style::Fullscreen);
view.SetSize(640 ,480 );
view.SetCenter(640 / 2 ,480/ 2 );
App.SetView(view);
}
}
// Clear the screen with red color
App.Clear();
App.Draw(sprBack);
// Display window contents on screen
App.Display();
}
return EXIT_SUCCESS;
}
Setting the rest, and then setting the view to the size of the image.
BUT the image is too big for the screen when I do this....what?! surly it should be fine? it makes no sense to me? the image should thus match the view
sf::Vector2f CGameEngine::GetSize()
{
return Window.ConvertCoords(Window.GetWidth() / 2 , Window.GetHeight() / 2);
The above returns place my sprites exactly where I want them :\