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

Show Posts

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.


Messages - Icup

Pages: [1]
1
Graphics / Re: noob draw question
« on: June 19, 2012, 09:24:52 pm »
oh wow... I can't believe I didn't see that. Thanks!

2
Graphics / noob draw question
« on: June 19, 2012, 12:52:37 pm »
So I am trying to teach myself how to program step by step. I started using SFML because of how easy I had heard it was easy to use.  I have messed around with the code for awhile now and looked for a bit using search but I found it better just to make my own topic so I apologize if this has been answered(I am sure it has).

I have my program to where all I want it to do is display an image on my screen(starting out real slow).  For whatever reason all I get is a white screen instead of the image I am trying to load and I have no idea why this is.

#include <SFML/Graphics.hpp>

 

int main()

{
        //sets screen dimentions and sets bit depth
        sf::VideoMode VMode(800, 600, 32);
        //creates the window and gives it a name
        sf::RenderWindow Window(VMode, "SFML Test");



        sf::Texture Texture;
        if(!Texture.loadFromFile("Hero.png"))
                return 1;
        sf::Sprite Sprite;
        Sprite.setTexture(Texture);
        Sprite.setPosition(100.0f, 30.0f);




       

       
        //loop for closing the window
        while (Window.isOpen())
{
        sf::Event Event;
        while (Window.pollEvent(Event))
        {
                switch (Event.type)
                {
                case sf::Event::Closed:
                        Window.close();
                        break;
                default:
                        break;
                }
        }
}
Window.clear();
Window.draw(Sprite);
Window.display();


    return 0;

}
 

man self learning this is not going to be easy :(

Pages: [1]