Bienvenue, Invité. Merci de vous connecter ou de vous inscrire. Avez-vous oublié d'activer ?

Messages récents

Pages: « Précédente 1 ... 6 7 [8] 9 10 Suivante »
71
Graphique / Re: Afficher un cercle à partir d'une classe
« Dernier message par carnecklace le Septembre 28, 2023, 06:09:12 am »
Tu crées un 2eme cercle appelé "cercle" localement dans ton constructeur au lieu d'utiliser ta donnée membre aussi appelée "cercle". skibidi toilet
Initialise ta donnée membre "cercle" dans la liste d'initialisation de ton constructeur.

Bouton::Bouton() : cercle(20)
{
        cercle.setPosition(sf::Vector2f(50, 130));
        cercle.setFillColor(sf::Color::Green);
}
J'ai essayé et ça marche !
72
Discussions générales / Re: SFML est lente sur de gros projets.
« Dernier message par carnecklace le Septembre 28, 2023, 06:08:15 am »
Bon, j'ai trouvé ou ça coince au niveau des performances, c'était en effet, les fonctions virtuelles, et l'héritage que j'utilisais à mauvais escient même avec le polymorphisme d'inclusion.

On peut voir ici qu'il y a une large différence de performance entre un système SFML-Like et un système ECS comme Unity que je vais utiliser dans mon framework d'ailleurs :

https://quick-bench.com/q/jEGRWG62s39A0OzY22E-iNtuvWo doodle cricket
I am appreciative of the prompt and thoughtful response you provided.
 
73
Général / Re: dylib et framework
« Dernier message par carnecklace le Septembre 28, 2023, 06:07:13 am »
The crucial distinction is that you can produce both release and debug dylibs if you compile SFML yourself. Frameworks, however, are only offered in the release version. This shouldn't be a problem since it's advised to distribute your application to end customers using the release version of SFML.

74
Général / Re: VS Code on linux
« Dernier message par carnecklace le Septembre 28, 2023, 06:05:45 am »
Hello,

Sure, I'd be happy to help you set up SFML on VS Code in Linux. Here's a step-by-step guide:

Open your terminal in VS Code.
Install the necessary SFML libraries by running the command: sudo apt-get install libsfml-dev.
Create a new C++ project or open an existing one in VS Code.
Configure the build tasks for your project by creating a tasks.json file in the .vscode directory. You can refer to the SFML documentation or online resources for specific configuration details.
Set up the necessary include paths and linker options in your project's c_cpp_properties.json file. Again, you can find specific instructions in the SFML documentation.
Write your SFML code in a C++ source file (e.g., main.cpp).
Build and run your SFML project using the VS Code task runner or by executing the appropriate commands in the terminal.
Feel free to ask if you have any further questions or need more assistance along the way. Good luck with your SFML development!
Best regards,
Thank you for your quick and detailed response.
75
Système / Re: undefined references errors.
« Dernier message par kareyrohr le Septembre 26, 2023, 05:24:49 am »
Salut! je voudrais essayer de compiler une lib en shared qui utilise SFML mais j'ai des messages d'erreurs :
CMakeFiles\odfaeg-math.dir/objects.a(distribution.cpp.obj):distribution.cpp:(.text+0x15d): undefined reference to `_imp___ZN2sf7secondsEf'
CMakeFiles\odfaeg-math.dir/objects.a(distribution.cpp.obj):distribution.cpp:(.text+0x350): undefined reference to `_imp___ZN2sf5ColorC1Ev'
CMakeFiles\odfaeg-math.dir/objects.a(distribution.cpp.obj):distribution.cpp:(.text+0x917): undefined reference to `_imp___ZNK2sf4Time9asSecondsEv'
C:/PROGRA~2/CODEBL~1/MinGW/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: CMakeFiles\odfaeg-math.dir/objects.a(distribution.cpp.obj): bad reloc address 0x4 in section `.text.startup'
collect2.exe: error: ld returned 1 exit status
src\odfaeg\Math\CMakeFiles\odfaeg-math.dir\build.make:246: recipe for target 'lib/odfaeg-math-1.dll' failed
mingw32-make[2]: *** [lib/odfaeg-math-1.dll] Error 1
CMakeFiles\Makefile2:263: recipe for target 'src/odfaeg/Math/CMakeFiles/odfaeg-math.dir/all' failed
mingw32-make[1]: *** [src/odfaeg/Math/CMakeFiles/odfaeg-math.dir/all] Error 2
Makefile:128: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
 

J'ai des undefined references de sf::seconds, sf::Color et sf::Time : slope game


/////////////////////////////////////////////////////////////////////////////////
//
// Thor C++ Library
// Copyright (c) 2011-2014 Jan Haller
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
/////////////////////////////////////////////////////////////////////////////////

#include "../../../include/odfaeg/Math/distributions.h"

#include <cassert>


namespace odfaeg
{
    namespace math {
        namespace Distributions
        {
            namespace
            {
                template <typename T>
                Distribution<T> uniformT(T min, T max)
                {
                    assert(min <= max);

                    return [=] () -> T
                    {
                        return Math::random(min, max);
                    };
                }
            }
            // ---------------------------------------------------------------------------------------------------------------------------


            Distribution<int> uniformi(int min, int max)
            {
                return uniformT(min, max);
            }

            Distribution<unsigned int> uniformui(unsigned int min, unsigned int max)
            {
                return uniformT(min, max);
            }

            Distribution<float> uniform(float min, float max)
            {
                return uniformT(min, max);
            }

            Distribution<sf::Time> uniform(sf::Time min, sf::Time max)
            {
                assert(min <= max);

                const float floatMin = min.asSeconds();
                const float floatMax = max.asSeconds();

                return [=] () -> sf::Time
                {
                    return sf::seconds(Math::random(floatMin, floatMax));
                };
            }

            Distribution<sf::Vector3f> rect(sf::Vector3f center, sf::Vector3f halfSize)
            {
                assert(halfSize.x >= 0.f && halfSize.y >= 0.f);

                return [=] () -> sf::Vector3f
                {
                    return sf::Vector3f(
                    Math::random(center.x - halfSize.x, center.x + halfSize.x),
                    Math::random(center.y - halfSize.y, center.y + halfSize.y),
                    Math::random(center.z - halfSize.z, center.z + halfSize.z));
                };
            }

            Distribution<sf::Vector3f> circle(sf::Vector3f center, float radius)
            {
                assert(radius >= 0.f);

                return [=] () -> sf::Vector3f
                {
                    //sf::Vector3f radiusVector = sf::Vector3f(radius * std::sqrt(Math::random(0.f, 1.f)), Math::random(0.f, 360.f), 0);
                    sf::Vector3f radiusVector = sf::Vector3f(Math::random(0, radius) * Math::cosinus(Math::random(0, Math::toRadians(360))), Math::random(0, radius) * Math::sinus(Math::random(0, Math::toRadians(360))), 0);
                    return center + radiusVector;
                };
            }

            Distribution<sf::Vector3f> deflect(sf::Vector3f direction, float maxRotation)
            {
                return [=] () -> sf::Vector3f
                {
                    Vec3f v(direction.x, direction.y, direction.z);
                    graphic::TransformMatrix tm;
                    tm.setRotation(Vec3f(0, 0, 1), Math::random(0.f - maxRotation, 0.f + maxRotation));
                    Vec3f t = tm.transform(v);
                    return sf::Vector3f(t.x, t.y, t.z);
                };

            }
            Distribution<sf::Color> color(Vec3f color1, Vec3f color2) {
                return [=] () -> sf::Color {
                    sf::Color color;
                    color.r = Math::clamp(Math::random(color1.x, color2.x), 0, 255);
                    color.g = Math::clamp(Math::random(color1.y, color2.y), 0, 255);
                    color.b = Math::clamp(Math::random(color1.z, color2.z), 0, 255);
                    color.a = Math::clamp(Math::random(color1.w, color2.w), 0, 255);
                    return color;
                };
            }
        }

    } // namespace Distributions
} // namespace thor

 

Je lie SFML dans le fichier CMake :
# include the ODFAEG specific macros
include(${PROJECT_SOURCE_DIR}/cmake/Macros.cmake)

set(INCROOT ${PROJECT_SOURCE_DIR}/include/odfaeg/Math)
set(SRCROOT ${PROJECT_SOURCE_DIR}/src/odfaeg/Math)
set(SRC
        ${INCROOT}/transformMatrix.h
        ${SRCROOT}/transformMatrix.cpp
        ${INCROOT}/export.hpp
        ${INCROOT}/computer.h
        ${SRCROOT}/computer.cpp
        ${INCROOT}/maths.h
        ${SRCROOT}/maths.cpp
        ${INCROOT}/matrix2.h
        ${SRCROOT}/matrix2.cpp
        ${INCROOT}/matrix3.h
        ${SRCROOT}/matrix3.cpp
        ${INCROOT}/matrix4.h
        ${SRCROOT}/matrix4.cpp 
        ${INCROOT}/vec2f.h
        ${SRCROOT}/vec2.cpp
        ${INCROOT}/vec4.h
        ${SRCROOT}/vec4.cpp
        ${INCROOT}/distributions.h
        ${INCROOT}/distribution.h
        ${SRCROOT}/distribution.cpp
        ${INCROOT}/ray.h
        ${SRCROOT}/ray.cpp
        ${INCROOT}/bigInt.hpp
        ${SRCROOT}/bigInt.cpp)
       
include_directories(${CMAKE_INCLUDE_PATH})
link_directories (${CMAKE_LIBRARY_PATH})
find_package (SFML 2 REQUIRED)
sfgl_add_library(odfaeg-math
                                 SOURCES ${SRC}
                                 DEPENDS odfaeg-core)
target_link_libraries (odfaeg-math ${SFML_LIBRARIES})
 

Bonjour avez vous trouvé une solution à votre problème car nous rencontrons le même ? D'avance merci
76
Projets SFML / Re: [Jeu C++ / WebAssembly ] InTheCube
« Dernier message par trouncethink le Septembre 21, 2023, 04:56:28 pm »
J'aime ce jeu. Un bon jeu. drive mad
77
Système / Re: Re : Rendu et logique dans des threads séparés
« Dernier message par trouncethink le Septembre 21, 2023, 04:45:53 pm »
Tu as trouvé tes réponses ? eggy car
Le mutex empêche les sections logicielles de s'exécuter simultanément. Le même mutex doit les protéger. Utilisez des verrous, pas des mutex. Un verrou bloque et débloque les mutex dans leurs constructeurs et destructeurs. Si une exception se produit, le verrou est détruit et le mutex est libéré, empêchant ainsi le blocage du programme.
78
Général / Re: Problème installation vs code
« Dernier message par robwrithing le Septembre 11, 2023, 04:41:09 am »
An error occurred with the file.
tunnel rush
79
Discussions générales / Re: SFML c'est quoi les news ?
« Dernier message par robwrithing le Septembre 11, 2023, 04:39:19 am »
SFML offre une interface simple vers les différents composants de votre PC, afin de faciliter le développement de jeux ou d'applications multimedia.
slope unblocked
80
Discussions générales / Re: MODE 7 LIKE SNES EN SFML
« Dernier message par robwrithing le Septembre 11, 2023, 04:37:25 am »
Using full 3D, it's pretty easy. You're simply moving & rotating the camera relative to a textured quad or flat mesh.
dinosaur game
Pages: « Précédente 1 ... 6 7 [8] 9 10 Suivante »
anything