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

Pages: [1]
1
Window / Programmatically sending events to sf::Window
« on: November 28, 2015, 08:28:51 pm »
Hello,

I am using boost::test as a testing framework and am trying to create some tests for how my application will be processing user input to a window. The handling of each individual event is already under a test as they are not part of the same procedure that polls the events, so that's not my concern. I just want to make sure that the actual procedure that has the sf::Window::pollEvent() loop is also tested.

However, I am having trouble determining how one can programmatically send an event to a sf::Window, such as sf::Event::Resized or sf::Event::KeyPressed, which can then be processed by my pollEvent() procedure. Any ideas?

If I need to clarify more then let me know.

2
Graphics / Re: sf::Sprite, cannot get to draw.
« on: March 14, 2015, 04:31:03 pm »
For starters move the clear and display methods out into your main game loop where you are drawing your list of sprites.  Can't see anything else that might be causing it though.

Yea, I placed it that way mostly for the purposes of the example so that it's easy to get a general idea of the flow of the code.

But I've nailed down the issue after many long hours with the debugger. It turns out that my code is not the problem, but my Intel graphics card and its corresponding drivers, which seems to be not very friendly with OpenGl. It's nothing I can currently change :(.

3
Graphics / sf::Sprite, cannot get to draw.
« on: March 12, 2015, 10:20:12 pm »
Hello,

I'm having a lot of trouble with drawing the image present within the sf::Sprite class. Here is the simplified fragment of code which is giving me issues:

class SFMLDrawer {

public:
 
        void draw( sf::Sprite& passed_sprite );

private:

        sf::RenderWindow mScreen;

};

//Program runs successfully but does not draw anything to the screen.
void SFMLDrawer::draw( sf::Sprite& passed_sprite )
{

        this->mScreen.clear();

        this->mScreen.draw( passed_sprite );

        this->mScreen.display();

}

In the above example, The program runs and exits successfully but the screen is blank.The texture present within the variable passed_sprite is dynamically allocated( using new, not shown in above code. ), and thus, I imagine, shouldn't have any issues related to scope. I could be wrong, though.

However, when I change the draw() method to the following:

//This function exits the code in failure.
//Crashes when using a debugger with no information.
void SFMLDrawer::draw( sf::Sprite& passed_sprite )
{

        this->mScreen.clear();

    sf::Sprite crash_sprite;

        //getTexture() returns a pointer, which is why the '*' is there.
        crash_sprite.setTexture( *(passed_sprite.getTexture()) );

        crash_sprite.setTextureRect( passed_sprite.getTextureRect() );

        this->mScreen.draw( crash_sprite );

    this->mScreen.display();

}

The above code crashes the program immediately on startup, resulting in exit failure. When I tried to run gdb, the window drew my image in the appropriate location but crashed the second I tried closing the window. I don't understand why it would suddenly cause such undefined behavior, though, considering I am effectively using the same values for crashed_sprite as I was for passed_sprite.

If anyone has any suggestions or advice, I would appreciate it. If I left something unclear, then let me know.

4
General / Re: Compilation Error
« on: December 30, 2014, 10:27:17 pm »
I played around with the ordering and put opengl32 (as well as winmm and gdi32). I didn't know they were already part of MinGW so I was struggling with that. But it finally compiled fine!

Thank you, I appreciate the help!

5
General / Re: Compilation Error
« on: December 30, 2014, 10:11:56 pm »
The only thing I can find is that I need to link opengl32.dll along with the other SFML dependencies (http://www.sfml-dev.org/tutorials/2.2/start-cb.php). However, I cannot find that file in the provided SFML directories.  :-\

6
General / Compilation Error
« on: December 30, 2014, 09:26:43 pm »
Hi,

I'm running on Windows 7, using the Netbeans IDE with the MinGW compiler. SFML compiles, builds, and runs fine when I use any of the headers or functions that do not require opengl. However, if I have a program that is as simple as this:

#include <cstdlib>
#include <SFML/Graphics.hpp>

int main( int argc, char** argv ) {
   
    sf::RenderTexture myTexture;
   
    return EXIT_SUCCESS;
}
 

Then I get a huge stack of errors in the command prompt (Note, these are only a few of them):

...
g++     -o dist/Debug/MinGW-Windows/mingwtest build/Debug/MinGW-Windows/main.o -L/C/GameDev/SFML-2.2/lib -lsfml-system-s-d -lsfml-window-s-d -lsfml-audio-s-d -lsfml-graphics-s-d -lsfml-network-s-d -lboost_regex
c:/GameDev/SFML-2.2/lib/libsfml-graphics-s-d.a(RenderTexture.cpp.obj): In function `sf::RenderTexture::create(unsigned int, unsigned int, bool)':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTexture.cpp:57: undefined reference to `sf::err()'

c:/GameDev/SFML-2.2/lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj): In function `sf::RenderTarget::clear(sf::Color const&)':
D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:99: undefined reference to `glClearColor'

D:/sfml-release/_Sources/SFML/src/SFML/Graphics/RenderTarget.cpp:100: undefined reference to `glClear'
...

All the errors seems to reference openGL functions at a location that does not exist on my computer (I don't have a D:/ drive).

I don't really know what these errors mean or how to go about fixing them, or know anything about OpenGL. Sorry if this is a stupid question, but I'm at a loss.

Thanks,
   Deathvango.

Pages: [1]
anything