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.


Topics - Reborn121

Pages: [1]
1
Graphics / Window.draw() no longer working after SFML Update
« on: December 09, 2014, 02:45:39 am »
So I was, in another thread told to update my SFML to the source version. Upon doing so it fixed my problem, but now most of my classes that use SFML are broken. Here is one of the classes that is not working, I'm getting an
Code: [Select]
Unhandled exception at 0x00000000 in SFML2D.exe: 0xC0000005: Access violation reading location 0x00000000. on the
Code: [Select]
window.draw(m_Sprite);
Here is the section containing the code:
                        case Animation::FadeIn:
                                m_Alpha = 0;
                                m_Sprite.setColor(sf::Color(255, 255, 255, m_Alpha));
                                while (isAnimating)
                                {
                                        window.clear();
                                        window.draw(m_Sprite);
                                        window.display();
                                        if (loopIndex == 1)
                                        {
                                                if (m_Clock.getElapsedTime() > sf::seconds(m_InitTime))
                                                {
                                                        ++i;
                                                        m_Sprite.setColor(sf::Color(255, 255, 255, m_Alpha));
                                                        window.draw(m_Sprite);
                                                        ++loopIndex;
                                                        !isAnimating;
                                                        return;
                                                }
                                        }
                                        else if (loopIndex == 0)
                                        {
                                                if (m_Clock.getElapsedTime() > sf::milliseconds(i*m_Time))
                                                {
                                                        ++i;
                                                        m_Sprite.setColor(sf::Color(255, 255, 255, m_Alpha));
                                                        window.draw(m_Sprite);
                                                        ++m_Alpha;
                                                        if (m_Alpha > 255)
                                                        {
                                                                ++loopIndex;
                                                        }
                                                }
                                        }
                                }
                        break;
 

and this following part is my constructor (I do have a default constructor, but it does nothing and requires a create() or setSomeAttr() call, which basicly does what the following constructor does.):

        Splash::Splash(sf::Texture Texture, int InitTime, int Time)
        {
                m_Texture = Texture;
                m_Sprite.setTexture(m_Texture);
                m_InitTime = InitTime;
                m_Time = Time;
        }
 

EDIT::
I didn't change anything, but it seems that the problem is now the
virtual void draw(sf::RenderTarget &target, sf::RenderStates states) const
function, that makes something drawable in sfml. This is the only line I have in there:
target.draw(m_Sprite, states);

Helpful Info:
- OS: Windows XP 32-bit
- Compiler: Visual C++ 2010 Express
- SFML Version: Built from latest source as of December 9th.
- SFML Link Type: Dynamic

2
Window / Multiple Windows Overlapping Issue
« on: December 06, 2014, 08:55:34 pm »
So, I have two windows, they both work, they issue is when I tried to interact with the second window while it is above the first window, as soon as I move the first window away, then click back to the seconds window I can interact with it without any problems. My code is below.

        //Declare both RenderWindows
        sf::RenderWindow F1Menu;
        sf::RenderWindow MainWin;

        //Create the Main Window
        MainWin.create(sf::VideoMode(800, 600), "SFML 2D");

        sf::View MainView(sf::FloatRect(0, 0, 1600, 1200));
        MainView.setViewport(sf::FloatRect(0, 0, 1, 1));

        MainWin.setView(MainView);
   
    //Loop while either window is open.
    while (MainWin.isOpen() || F1Menu.isOpen())
    {
        sf::Event Event;
                //Main Window got an event
                if (MainWin.pollEvent(Event))
                {
                        switch (Event.type)
                        {
                                case sf::Event::Closed:
                                        MainWin.close();
                                break;

                                case sf::Event::Resized:
                                        MainView.reset(sf::FloatRect(0.f, 0.f, MainWin.getSize().x, MainWin.getSize().y));
                                        MainWin.setView(MainView);
                                break;

                                case sf::Event::KeyPressed:
                                        if (Event.key.code == sf::Keyboard::F1)
                                                //Create the second window when F1 is pressed.
                                                F1Menu.create(sf::VideoMode(200, 500), "SFML 2D - F1 Menu");
                                        else if (Event.key.code == sf::Keyboard::Escape)
                                                MainWin.close();
                                break;
                        }
        }

                //Second Window got an event.
                if (F1Menu.pollEvent(Event))
                {
                        switch (Event.type)
                        {
                                case sf::Event::Closed:
                                        F1Menu.close();
                                break;
                        }
                }

                //The Main window is the top window
                if (MainWin.isOpen())
                {
                        MainWin.clear();
                        MainWin.display();
                }

                //Second Window is top window.
                if (F1Menu.isOpen())
                {
                        F1Menu.clear();
                        F1Menu.display();
                }
    }
 

EDIT::::

Here is the link to a stack overflow question http://stackoverflow.com/questions/27350714/managing-multiple-renderwindows-in-sfml/27351325?noredirect=1#comment43156853_27351325 I posted, it has a couple of important discussions, like what we have tried.

The most important part in there is when I discover that if I move the executable to another computer it works as expected.

Here are some specs on what I am compiling on, where the problem persists, I believe it may be a bug between the OS/Compiler and SFML:

- Windows XP 32-bit (Yes I know it is no longer supported, I have another computer, I use for everyday use.)
- Visual C++ 2010 32-bit
- 3GB Ram

Program Does work on the following system:

- MAC OSX 10.9.5 64-bit
- 4GB Ram
- I have not used XCode to compile, I used the same executable, but ran it under wine.

Should I try to update my Drivers? Can I on WinXP?

EDIT 2::::

After further investigation, it Does Not work on the Mac, but I can move the window. It seems they cannot poll events at the same time.

Pages: [1]