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 - flynet0013

Pages: [1]
1
Graphics / Re: Multiple problems facing me !!
« on: September 04, 2018, 01:53:36 pm »
I will try to do it again , thanks anyway for reply !!

2
Graphics / Multiple problems facing me !!
« on: September 03, 2018, 12:43:23 am »
Hey there i'm new to SFML and C++ , I had many problems while i'm learning sfml and i'm gonna list them :

First :
    Whenever i try to load a texture or any other resource on debug mode ,it always return false when i make
    if condition to check if res loaded or not :
   
     // Always return false on debug mode
     sf::Texture tx;
       
        if (!tx.loadFromFile("data/icon.jpeg"))
                return -1;
   
    but on release mode and without the condition it load and display on the screen without error :
   
     // Work on release mode
     sf::Texture tx;
       
      tx.loadFromFile("data/icon.jpeg");
   
     
Second :
    Whenever i use VertexArray (Quad,Triangles,TrianglesStrip) with texture always get white pixels on debug
    mode but on release mode i get nothing even LineStrips doesn't show up on release mode too !!
    Entity.cpp :
   
     void Entity::draw(sf::RenderTarget & target, sf::RenderStates states) const
{

                states.transform = this->m_trasform;
                states.texture = &this->m_texture;
                target.draw(this->m_vertexes, states);
        // Just to draw bounding box edges
        if (true) {
                sf::Vertex vert[5] = {
                        sf::Vertex(sf::Vector2f(this->m_boundingbox.x ,this->m_boundingbox.y)),
                        sf::Vertex(sf::Vector2f(this->m_boundingbox.x + this->m_boundingbox.width ,this-
  >m_boundingbox.y)),
                        sf::Vertex(sf::Vector2f(this->m_boundingbox.x + this->m_boundingbox.width ,this->m_boundingbox.y + this->m_boundingbox.height)),
                        sf::Vertex(sf::Vector2f(this->m_boundingbox.x ,this->m_boundingbox.y + this->m_boundingbox.height)),
                        sf::Vertex(sf::Vector2f(this->m_boundingbox.x ,this->m_boundingbox.y)),
                };

                vert[0].color = sf::Color::Red;
                vert[4].color = sf::Color::Blue;
                vert[2].color = sf::Color::Green;
                target.draw(vert, 5, sf::LinesStrip, states);
        }

};

Entity::Entity(std::string texture_file,Rect boundingBox ,float x, float y, float h, float w)
{
        this->m_boundingbox = Rect(boundingBox.x + x , boundingBox.y + y , boundingBox.height,boundingBox.width);

        isVisual = true;
        this->setPosition(x, y);

        this->m_texture.loadFromFile(texture_file);
               

        m_vertexes.setPrimitiveType(sf::Quads);
        m_vertexes.resize(w * h* 4);
        this->m_vertexes[0].position = sf::Vector2f(x,y);
        this->m_vertexes[1].position = sf::Vector2f(x + w, y);
        this->m_vertexes[2].position = sf::Vector2f(x + w, y + h);
        this->m_vertexes[3].position = sf::Vector2f(x , y + h);
       
        this->m_vertexes[0].texCoords = sf::Vector2f(0, 0);
        this->m_vertexes[1].texCoords = sf::Vector2f(w, 0);
        this->m_vertexes[1].texCoords = sf::Vector2f(w, h);
        this->m_vertexes[1].texCoords = sf::Vector2f(0, h);
       
}
     
     
      main.cpp :
     
      Entity e("data/icon.jpeg",Rect(0,0,400,500),50,50,100,200);
     
      // While loop
      window.draw(e);
     
     
Third :
     Sprite batch texture or imag get rendered on release mode but the opposite on debug i get nothing just
     blink window .

All my res  files are on correct directory stil getting the same problem , Also i love this Lib and i don't want to change it and another one ,i hope some one find a solution to this problem and thx  :-*

Pages: [1]