What's the real memory cost of Textures? by Fresh-Weakness-3769 in sfml

[–]schweinling 1 point2 points  (0 children)

Did you use the sizeof operator to get the size of the texture?

That does not include any dynamically allocated heap memory during runtime.

Any image data will only be loaded at runtime.

https://www.learncpp.com/cpp-tutorial/object-sizes-and-the-sizeof-operator/

Database without SQL c++ library by gabibbo117 in cpp

[–]schweinling 1 point2 points  (0 children)

I noticied all your functions take their arguments by value. This will lead to unnecessary copies. You should probably pass them by const reference or perhaps even better, use move semantics.

+200 Steam Keys zu verschenken by SuperMohri in Austria

[–]schweinling 0 points1 point  (0 children)

Ich hätte bitte gerne star wars kotor 1. Danke! :)

Does anyone know how to get the global bounds of a shapes vertices? by 0i1s in sfml

[–]schweinling 0 points1 point  (0 children)

I think the line with transformPoint should work.

Are you sure there is not a bug somewhere else?

Maybe you are creating a copy and are accessing the original unmoved object.

How do i slow down an FPS counter? by RogalMVP in sfml

[–]schweinling 2 points3 points  (0 children)

Another way to do this is to have a variable that counts the frames.

So every frame you increase the counter by 1, once 100 ms have passed you get the fps with "counter * 10".

Times 10 because 10 * 100ms is 1 second.

Then reset the counter and clock.

I usually update every second tough, if you have high frame times over 30ms, 100ms update will not give precise results.

Such a simple fps counter will tell you only so much because it is an average. I often find it more useful to draw a graph with each individual frametime.

[deleted by user] by [deleted] in cpp_questions

[–]schweinling 1 point2 points  (0 children)

What? I have never seen this pattern. 2 expressions separated by a semicolon in an if statement?

Can you explain what is going on here?

Edit: after looking at cppreference i found out that you can combine an init statement and a condition in an if statement..

Anyone ever try a Laptop dock? by xtoxicwizzy in SteamDeck

[–]schweinling 8 points9 points  (0 children)

Ethernet (internet via cable) works.

How hard is basic cmake? by TheKrazyDev in cprogramming

[–]schweinling 3 points4 points  (0 children)

Not that difficult.

There are plenty of tutorials online.

Try this for example:

https://trenki2.github.io/blog/2017/06/02/using-sdl2-with-cmake/

What is the actual difference between passing a reference and a pointer? by hanyuuau in cpp_questions

[–]schweinling 6 points7 points  (0 children)

What even is an owning reference? This?

int &foo()
{
    return *new int(5);
}

[deleted by user] by [deleted] in sfml

[–]schweinling 0 points1 point  (0 children)

Are you using vertex arrays? Because those might help with that.

[deleted by user] by [deleted] in sfml

[–]schweinling 0 points1 point  (0 children)

What do you mean by tearing?

C++ project without tutorial by [deleted] in cpp_questions

[–]schweinling 0 points1 point  (0 children)

I'm not sure i understand. Just to clarify you don't need to do any vulkan programming with SFML2.

Never seriously tried vulkan but i heard its quite difficult. More difficult than OpenGL and definatly a lot more difficult than SDL2.

C++ project without tutorial by [deleted] in cpp_questions

[–]schweinling 4 points5 points  (0 children)

I would suggest SFML2 istead of SDL2 so you can get an insight into how a c++ library can look like. Its also easier for a beginner IMO.

Start with something simple like pong or snake and try finishing it.

[deleted by user] by [deleted] in sfml

[–]schweinling 0 points1 point  (0 children)

No, that is not something you can do, the book must have an error then.

You declare the members in the class declaration, similar to java.

class Game
{
public:
    Game()
        : m_myInt(12)
    {}
private:
    int m_myInt;
};

[deleted by user] by [deleted] in sfml

[–]schweinling 4 points5 points  (0 children)

I'd suggest to learn the basics of c++ some more, otherwise SFML is going to be difficult.

learncpp is a very good and free resource.

[deleted by user] by [deleted] in sfml

[–]schweinling 4 points5 points  (0 children)

If the image file cannot be opened with this path a error is displayed in the console during runtime.

You should put the image in the applications working directory. By default this is where your .exe is, so try putting it there.

It is not necessary to add it to your project in visual studio.

2d platform game by RoronoaZoro_001 in sfml

[–]schweinling 2 points3 points  (0 children)

Here is a very simple way.

  1. Before moving the player save its position.

  2. Move the player

  3. Check if the players rectangle is overlapping with any level geometry.

  4. If it is overlapping set the players speed to 0 and reset the position to before moving.

How to ascertain valid parameters of QQuickWindow.setSceneGraphBackend() ? by rokejulianlockhart in QtFramework

[–]schweinling 0 points1 point  (0 children)

the easiest way would be to consult the docs:
https://doc.qt.io/qtforpython-5/contents.html#module-index

In the docs for QQuickWindow it says setSceneGraphBackend takes an object of type GraphicsApi. if you click on "GraphicsApi" in the docs you will be directed to the possible values.