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 - Tom Clabault

Pages: [1]
1
I found what the error was and it was kinda stupid. A fopen() returned NULL but I wasn't checking for this kind of errors so the program kept on going with a NULL pointer... Nothing good happen then : )
There's no more problem. Is there any "Solved" state I need to set for the topic ?

One more question considering what you said:
What does it implies that destructors of variables aren't called ? If my program exits, all the memory used is released right ? So what's the problem of not calling the destructors on program exit ?

2
I created a file at the location pointed by the path and the file is actually where it it supposed to be...

if(!texture.loadFromFile("..."))
    exit(0);

That's what I do if the texture hasn't been loaded properly.
After trying not to give the program the textures he needed ( simply delete the textures from the executable location ), it takes half a second for the program to exit, that's really quick.
When giving the program the textures he needs ( As my game needs textures to work : ) ), it takes randomly from 4s to 16s for the game to crash after a white screen

By the way, I don't think that exit(0); is what to do in case the texture hasn't been loaded. What should I do since I need the texture later with the Sprites ?

3
To load ressources, I'm using path such as "./Resources/Textures/....png". Any problem with that kind of syntax ?
When running the .exe, Windows doesn't complain with missing DLLs so I assume they are at the right place

4
Windows Defender, nothing else. I added an exception but no changes

5
Hello

So. I compiled my project using Visual Studio 2017 and within Visual Studio, no problems, the project runs fine, everything is alright.
The thing is that when I'm trying to launch the .exe produced by Visual Studio, the game pops, there's a window but it's white, as is there were no textures and it's not responding, as is the program crashed

I searched on the Internet but didn't found any relevant answer.

Thanks in advance

6
Graphics / Re: VertexArray and transparent texture
« on: March 03, 2019, 03:35:32 pm »
Hum, I think you found the problem

Behind it is supposed to stand the sky but the sky is also a Quad belonging to the same vertexArray.
I'll try some things and I'll tell you

EDIT: Done, I used a Sprite instead of vertices, it worked. Thanks for pointing me in the direction

7
Graphics / VertexArray and transparent texture
« on: March 03, 2019, 02:42:32 pm »
Hi!
I'm in front of a problem that doesn't seem to be that of a challenge but still, I'm stuck with it
I've a Quads vertexArray and I've a .png with transparency in it.
The problem is that when displaying the vertices with the texCoords of the image, it shows black instead of transpanrecy

Here's my .png:


I'm defining the vertices' texCoords as follows:
levelVertex[0].texCoords = CORNER_UP_LEFT_TEXTURE;
levelVertex[1].texCoords = CORNER_UP_RIGHT_TEXTURE;
levelVertex[2].texCoords = CORNER_BOTTOM_RIGHT_TEXTURE;
levelVertex[3].texCoords = CORNER_BOTTOM_LEFT_TEXTURE;
 

When displaying, here's what I get:


I tried to set the four vertices' color to sf::Color::Transparent but with that done, it displays a full black Quad

Any thoughts about that?

8
Graphics / Re: My sprite won't show ( black screen )
« on: February 08, 2019, 09:34:10 pm »
int main()
{
        sf::Texture texture;
        if (!texture.loadFromFile("./Resources/Level/Textures/dirt.jpg"))
                exit(0);
        sf::Sprite sprite(texture);

        while (window.isOpen())
        {
                sf::Event event;
                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                                window.close();
                }

                window.clear();

                window.draw(sprite);

                window.display();
        }
}

Changes done, it works fine, thank you !

9
Graphics / My sprite won't show ( black screen )
« on: February 08, 2019, 07:41:18 pm »
Hi!

So I tried to draw a simple sprite but I can't get it to work. Why ? I don't think I have done any mistakes but it just shows a black screen when running the code. What's the problem ?

Here is my code:

#include "include/SFML/Graphics.hpp"

#pragma region Variables
sf::RenderWindow window(sf::VideoMode(750, 750), "Title");
#pragma endregion Variables





int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow)
{
        while (window.isOpen())
        {
                sf::Event event;
                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                                window.close();
                }

                window.clear();

                sf::Texture texture;
                texture.loadFromFile(".\\Resources\\Level\\Textures\\dirt.jpg");
                sf::Sprite sprite;
                sprite.setTexture(texture);
                window.draw(sprite);

                window.display();
        }
}

I'm using Visual Studio under Windows 10 if some you wanted these infos.

Thanks in advance

Pages: [1]
anything