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

Voir les contributions

Cette section vous permet de consulter les contributions (messages, sujets et fichiers joints) d'un utilisateur. Vous ne pourrez voir que les contributions des zones auxquelles vous avez accès.


Sujets - ProcessusX

Pages: [1]
1
Graphique / Erreur sprite
« le: Octobre 12, 2018, 01:42:05 am »
Bonjour, j'ai mis une texture ?  un sprite, et quand j'écris window.draw(sprite_perso), ça me met ça:
Erreur LNK2001   symbole externe non résolu "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B)   Jeu-collab-rafic   C:\Users\Raphael\source\repos\Jeu-collab-rafic\Jeu-collab-rafic\Jeu-collab-rafic.obj
J'ai lu d'autres articles et d'après moi j'ai bien linké.
Le code :
#include "stdafx.h"
#include <SFML/Graphics.hpp>
#include <iostream>

#pragma region
sf::Texture perso;
sf::Sprite sprite_perso;
sf::CircleShape circle(200);
#pragma endregion

void clavier()
{
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::W))
        {
                sprite_perso.move(0, -1);
        }
        else if (sf::Keyboard::isKeyPressed(sf::Keyboard::S))
        {
                sprite_perso.move(0, 1);
        }
        else if (sf::Keyboard::isKeyPressed(sf::Keyboard::A))
        {
                sprite_perso.move(-1, 0);
        }
        else if (sf::Keyboard::isKeyPressed(sf::Keyboard::D))
        {
                sprite_perso.move(1, 0);
        }
}

int main()
{
        sf::RenderWindow window(sf::VideoMode(600, 300), "Test RPG");

        if (!perso.loadFromFile("elfeacier.png"))
        {
                std::cout << "Erreur, pas de personnage!" << std::endl;
        }
        perso.setSmooth(true);

        sprite_perso.setTexture(perso);


        circle.setRadius(40);

        circle.setPointCount(100);

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

                clavier();
                window.draw(circle);
                window.draw(sprite_perso);
                window.clear();
                window.display();
        }

        return 0;
}
Le linkage :
sfml-graphics-d.lib
opengl32.lib
freetype.lib
sfml-system-d.lib
sfml-window-d.lib
sfml-network-d.lib
sfml-audio-d.lib
sfml-main-d.lib
winmm.lib
openal32.lib
gdi32.lib
flac.lib
vorbisenc.lib
vorbisfile.lib
vorbis.lib
ogg.lib
ws2_32.lib

Merci d'avance   

2
Graphique / [RESOLU] Erreurs dans rect.inl
« le: Octobre 06, 2018, 09:50:30 pm »
Ce que je vais vous demandez ?  peut être déj?  eut une réponse (et dans ce cas excusez moi, j'avais la flemme  ;D de parcourir les 40 pages de questions).
Mon problème est que j'ai tout installé, rajouté les indications pour Visual Studio MAIS, quand j'ai inclus le fichier <SFML/Graphics.hpp> pour faire une fenêtre de base, lors de la compilation, VS me donne PLEIN :o d'erreur dans le dossier Rect.inl.
Merci d'avance  :)

Le code de rect.inl:

template <typename T>
Rect<T>::Rect() :
left  (0),
top   (0),
width (0),
height(0)
{

}

template <typename T>
Rect<T>::Rect(T rectLeft, T rectTop, T rectWidth, T rectHeight) :
left  (rectLeft),
top   (rectTop),
width (rectWidth),
height(rectHeight)
{

}

template <typename T>
Rect<T>::Rect(const Vector2<T>& position, const Vector2<T>& size) :
left  (position.x),
top   (position.y),
width (size.x),
height(size.y)
{

}

template <typename T>
template <typename U>
Rect<T>::Rect(const Rect<U>& rectangle) :
left  (static_cast<T>(rectangle.left)),
top   (static_cast<T>(rectangle.top)),
width (static_cast<T>(rectangle.width)),
height(static_cast<T>(rectangle.height))
{
}

template <typename T>
bool Rect<T>::contains(T x, T y) const
{
    T minX = std::min(left, static_cast<T>(left + width));
    T maxX = std::max(left, static_cast<T>(left + width));
    T minY = std::min(top, static_cast<T>(top + height));
    T maxY = std::max(top, static_cast<T>(top + height));

    return (x >= minX) && (x < maxX) && (y >= minY) && (y < maxY);
}

template <typename T>
bool Rect<T>::contains(const Vector2<T>& point) const
{
    return contains(point.x, point.y);
}

template <typename T>
bool Rect<T>::intersects(const Rect<T>& rectangle) const
{
    Rect<T> intersection;
    return intersects(rectangle, intersection);
}

template <typename T>
bool Rect<T>::intersects(const Rect<T>& rectangle, Rect<T>& intersection) const
{
    T r1MinX = std::min(left, static_cast<T>(left + width));
    T r1MaxX = std::max(left, static_cast<T>(left + width));
    T r1MinY = std::min(top, static_cast<T>(top + height));
    T r1MaxY = std::max(top, static_cast<T>(top + height));

    T r2MinX = std::min(rectangle.left, static_cast<T>(rectangle.left + rectangle.width));
    T r2MaxX = std::max(rectangle.left, static_cast<T>(rectangle.left + rectangle.width));
    T r2MinY = std::min(rectangle.top, static_cast<T>(rectangle.top + rectangle.height));
    T r2MaxY = std::max(rectangle.top, static_cast<T>(rectangle.top + rectangle.height));

    T interLeft   = std::max(r1MinX, r2MinX);
    T interTop    = std::max(r1MinY, r2MinY);
    T interRight  = std::min(r1MaxX, r2MaxX);
    T interBottom = std::min(r1MaxY, r2MaxY);

    if ((interLeft < interRight) && (interTop < interBottom))
    {
        intersection = Rect<T>(interLeft, interTop, interRight - interLeft, interBottom - interTop);
        return true;
    }
    else
    {
        intersection = Rect<T>(0, 0, 0, 0);
        return false;
    }
}

template <typename T>
inline bool operator ==(const Rect<T>& left, const Rect<T>& right)
{
    return (left.left == right.left) && (left.width == right.width) &&
           (left.top == right.top) && (left.height == right.height);
}

template <typename T>
inline bool operator !=(const Rect<T>& left, const Rect<T>& right)
{
    return !(left == right);
}

 

Pages: [1]
anything