0 Members and 1 Guest are viewing this topic.
#include <SFML/Graphics.hpp>#include <string>using namespace std;sf::RenderWindow App;sf::Sprite load_sprite(string path) { sf::Sprite test_sprite; sf::Image img; img.LoadFromFile(path); test_sprite.SetImage(img); return test_sprite; }//#define fromFunction // Un-comment the #define to make the image load incorrectly.#ifdef _WIN32int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)#elseint main()#endif { App.Create(sf::VideoMode(640, 480, 32), "SFML Window"); sf::Sprite spr; #ifdef fromFunction spr = load_sprite("image.bmp"); #else sf::Image bobf; bobf.LoadFromFile("image.bmp"); spr.SetImage(bobf); #endif spr.SetCenter(120,80); spr.SetScale(1,1); spr.SetColor(sf::Color(255,255,255)); spr.SetX(320); spr.SetY(240); bool loopin = true; while(loopin) { sf::Event Event; while (App.GetEvent(Event)) { if ((Event.Type == sf::Event::Closed) || ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))) { App.Close(); loopin = false; break; } } App.Draw(spr); App.Display(); sf::Clock clock; clock.Reset(); while(clock.GetElapsedTime() < 1/60) {} } return EXIT_SUCCESS; }
Core Xii -1 ( new is not required with a manager so its more easy )
Quote from: "Hiura"Core Xii -1 ( new is not required with a manager so its more easy )Well... I didn't say it was the easy way. I prefer to do things the right way.