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 - killmichnich

Pages: [1]
1
Graphics / Deleting a sprite
« on: September 27, 2009, 04:25:12 pm »
i'm relative sure, when i don't set the image the programms running well, and i can close it without a bugmessage, just when i set the image to the sprite it doesn't work.

I'm using version 1.5 for msvc++ 2008, my operating system is windows vista business 64-bit (maybe important).

2
Graphics / Deleting a sprite
« on: September 27, 2009, 01:02:31 pm »
okay i know what you mean but my problem isn't that pointer, believe me ^^

here the programm without that pointer:
Code: [Select]

#include <iostream>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>

using namespace std;

int main()
{
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Window");

    sf::Image Image;
    if(!Image.LoadFromFile("sprite.png"))
    {
        cout<<"Sprite konnte nicht geladen werden"<<endl;
    }
    sf::Sprite Sprite(Image);
    Sprite.SetPosition(0, 0);
    while(App.IsOpened())
    {
        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();
            }
        }

            App.Clear();

            App.Draw(Sprite);

            App.Display();
    }


    return EXIT_SUCCESS;
}

You meant i should do it light this, dint't you?
Now the programms working brilliantly, just when i close it by esp or clicking on the X, it's hanging up. With that pointer i just wanted to test if it's the sprite's fault or not. So I think it's the destructor of the sprite or smilar.
I hope you know now what's my problem ^^

3
Graphics / Deleting a sprite
« on: September 27, 2009, 09:02:03 am »
would be brilliant if it was so simple. At the beginning i din't use the Pointer, and every time i closed my application it hang up. So I tried it with that pointer to know if it is the sprites fault. The only way it works is when i'm closing the application without deleting my Sprite :/ ... but thats a bit stupid ^^

And i'm calling my var only Sprite for testing it because i just began with sfml and wanted to draw sth. in my window ^^

4
Graphics / Deleting a sprite
« on: September 26, 2009, 07:56:43 pm »
Hiho Community =)
I've got a problem with deleting sprites. My current programm looks like this:
Code: [Select]

#include <iostream>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>

using namespace std;

int main()
{
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Window");

    sf::Image* Image = new sf::Image();
    if(!Image->LoadFromFile("sprite.png"))
    {
        cout<<"Sprite konnte nicht geladen werden"<<endl;
    }
    sf::Sprite* Sprite = new sf::Sprite((*Image));
    Sprite->SetPosition(0, 0);
    while(App.IsOpened())
    {
        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();
            }
            if(Event.Type == sf::Event::KeyPressed && Event.Key.Code==sf::Key::A)
            {
                delete Image;
                Image = NULL;
                delete Sprite;
                Sprite = NULL;
            }
        }

            App.Clear();

            App.Draw((*Sprite));

            App.Display();
    }


    return EXIT_SUCCESS;
}

Now when i press 'A' and want do delete the image and the sprite the programms hanging up. I'm able to destroy the image alone, but when i'm destroying the sprite it's hanging up and i don't know why :(

I'm using code blocks with the ms vc++ 2008 compiler and downloaded the newest version of sfml for vc++ 08, the libraries i added are sfml-graphics.lib and sfml-window.lib, otherway i can't compile. The Build Target is Release.

I hope someone can help me =)

MfG Killmichnich

PS: Sorry for my bad english, i'm not very goot at it =(

Pages: [1]
anything