Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: why doesnt it work?  (Read 2628 times)

0 Members and 1 Guest are viewing this topic.

ravenheart

  • Full Member
  • ***
  • Posts: 148
    • View Profile
why doesnt it work?
« on: December 14, 2008, 02:22:48 am »
Code: [Select]

#include <SFML/Graphics.hpp>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cmath>

using namespace std;

int main()
{
    // Fenster erstellen
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics",sf::Style::Fullscreen);
    App.SetFramerateLimit(60);
    App.ShowMouseCursor(1);

    sf::Image img;
    img.LoadFromFile("eee.jpg");
    sf::Sprite ele;
    ele.SetImage(img);
    ele.SetPosition(sf::Vector2f(111,110));

    // SChleife
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
            if ((Event.Type == Event.KeyPressed) && (Event.Key.Code == sf::Key::Escape))
            {
                App.Close();
            }

            if ((Event.Type == Event.KeyPressed) && (Event.Key.Code == sf::Key::F1))
            {
                ele.SetPosition(sf::Vector2f(0,0));
            }
        }
    }

    App.Draw(ele);
    App.Display();
    return 0;
}



i dont understand what i am doing wrong,,,

dorkfish

  • Newbie
  • *
  • Posts: 38
    • View Profile
why doesnt it work?
« Reply #1 on: December 14, 2008, 03:32:07 am »
Code: [Select]
App.Draw(ele);
App.Display();


These need to be inside of your game loop.

 

anything