Every object you want to use must of course be created in some way. That however doesn't meant that you need to declare x number of variables, instead one would make use of containers such as std::vector
to which you can dynamically add or remove an object.
How you dynamically deal with objects is however nothing really SFML specific and instead is a generic C++ problem. If you aren't really familiar how the standard C++ containers work, I highly recommend you get a good C++ book and study that first for a while.
After that you might find the SFML Game Development book quite interesting.
You found out wrong then. SFML still provides all the necessary dependencies for Windows.
My guess is that you didn't read the official tutorial on how to use SFML with VS 2015 and thus you didn't link SFML's dependencies, as clearly stated in the tutorial. ;)
Keep in mind that opengl32.lib as well as others are system libraries and are provided by the Windows SDK or Visual Studios, thus they don't get shipped with SFML.
Have you looked through the documentation? Why do you think you need to know the client's IP address?
There is a tutorial on communicating with sockets which should get you started.
well --version gives me this. I can't really tell whether this compiler is 64 bit or 32 bit from that, but maybe there's something I'm missing.
Also, I applied that check to the compiled program, and it also seems to be x86, so everything seems to be 32 bit I think.
Have you tried looking at what the values for the attributes are for videoMode
? Also compare your videoMode
attribute values against the attributes of sf::VideoMode::getDesktopMode();
.
Check the example in the docs, it displays all fullscreen values. It also uses a desktop VideoMode .bitsPerPixel
in a custom VideoMode.
This is just a guess and I'm not familiar with codeblocks but after browsing the YuGiOh.cbp file it doesn't mention linking to SFMLs dependencies.
Did you remember to link SFMLs dependencies in your Visual Studio project? The dependencies required for each module can be found here http://www.sfml-dev.org/tutorials/2.3/start-vc.php
If you look at the documentation, you'll see the getTexture() returns a pointer to the Texture, not a reference, which needs the -> syntax.
If you're confused on pointers and references, I highly recommend doing some more studying on C++ before getting deep into SFML, pointers and references are pretty integral to the language.
On memory leaks, it's not your GlobalGet function that creates them, actually just storing those Textures as pointers in the map creates the leak (via your use of GlobalInsert). You are using 'new' to create the Textures, which stores them on the heap. And in no place do you ever use 'delete' those Textures. If you're going to do it in this way... I'd look into using std::unique_ptr to store the Textures instead. That way, the Textures will be deleted for you when the map is destroyed.
Also, your 'else' condition in GlobalInsert will never be reached, and is incorrect. You're creating the key on line 6, you don't need to use std::map::find at all, you could just do:
GlobalTextures[index]->loadFromFile(index)
The site acts like I'm on a mobile device. Huge text and vertical layout. I don't need a 26px high font on my 1080p monitor.
What's funny to me is that the Windows Evaluation notice on the bottom right gets covered in every video starting from the 22nd tutorial. I wonder if it ran out or "suddenly" reset...
All in all the stuff I've looked into for a bit is okay and probably suited for people who need a bit to understand a certain topic. For the rest, it's a lot faster to just stick to the official tutorials, since they contain about the same information and are always up to date.
While the SFML code is, as far as I can judge, okay, some of the comments or explanations are either unprecise or only partially true (e.g. the event vs real-time input comment).
The documentation for the UdpSocket class shows exactly how to use it. Read through that and the UDP section of the last link I sent you. Both pages answer your question, and show examples on how to receive messages from an unknown IP address and retrieve that address in order to send a reply.
You need those functions when you mix raw OpenGL with SFML draw functions. SFML-Graphics uses OpenGL too, so extra care must be taken so that SFML and user states don't conflict with each other
The only way to avoid conflicts between SFML and your own OpenGL states, is to save/restore them everytime you switch from OpenGL to SFML.
>- draw with OpenGL
>- save OpenGL states
>- draw with SFML
>- restore OpenGL states
>- draw with OpenGL
>>...
The easiest solution is to let SFML do it for you, with the pushGLStates/popGLStates functions :
>glDraw...
>window.pushGLStates();
>window.draw(...);
>window.popGLStates();
>glDraw...
Since it has no knowledge about your OpenGL code, SFML can't optimize these steps and as a result it saves/restores all OpenGL states and matrices. This is ok for small projects, but it may be too slow for bigger programs that need maximum performances. In this case, you can handle saving and restoring the OpenGL states yourself, with glPushAttrib/glPopAttrib, glPushMatrix/glPopMatrix, etc. But you'll still need to restore SFML's own states before drawing, with the resetGLStates function.
>glDraw...
>glPush...
>window.resetGLStates();
>window.draw(...);
>glPop...
>glDraw...
By saving and restoring OpenGL states yourself, you can manage only those that you really need, and save a few unnecessary driver calls.
Oh that makes more sense. Well after struggling for a while I found another workaround. This tool (Dyoxygen)[http://www.doxygen.nl/] let me generate html documentation directly from the source code. Appreciate the help though
You will have to adapt it (there is always a solution 😉). But believe me there is everything you need to make a good game. 👍 You can create a great game without using RenderTexture.
Here’s an example: SFML Game (Google Play)