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

Pages: [1]
1
Graphics / Image set pixel & Texture update - Nothing happens?
« on: May 23, 2018, 10:24:31 pm »
I'm trying to edit the pixels of a particular image, but the image does not change, it remains the same.

                sf::Vector2u size = internalImage[i].image->getSize();

                for (int x = 0; x < size.x; x++) {
                        for (int y = 0; y < size.y; y++) {
                                internalImage[i].image->setPixel(x, y, sf::Color(0, 0, 0, 255));;
                        }
                }

                internalTexture[t].texture->update(*internalImage[i].image);

Any tips or alternative method?

2
Graphics / Re: Rectangle size 1/2 = 2/4?
« on: May 23, 2018, 10:11:43 pm »
I have created 7 rectangles of 1 width and 2 height to create a rain effect.

Look the result:


Each rectangle is 2/4 and not 1/2

3
Graphics / Rectangle size 1/2 = 2/4?
« on: May 23, 2018, 06:37:13 pm »
I trying to create a rectangle of size 1 width 2 height, but in the screen appears a 2 width 4 height.

Here is the code:
      sf::RectangleShape *rectangle = new sf::RectangleShape;

      rectangle->setSize(sf::Vector2f(width, height));
      rectangle->setFillColor(sf::Color(color[0], color[1], color[2], color[3]));

      rectangle->setPosition(x, y);
      rectangle->move(offx * -1, offy * -1);
      rectangle->setFillColor(sf::Color(oColor.r, oColor.g, oColor.b, opacity));



4
General / Rotate sprite and preserve position
« on: May 21, 2018, 08:34:14 pm »
Hello!
I want to rotate a sprite in it's own center, my try:

         sf::Sprite sprite(*internalTexture[t].texture, sf::IntRect(rect[0], rect[1], rect[2], rect[3]));

         sprite.setPosition(sf::Vector2f(x, y));
         sprite.move(sf::Vector2f(offx * -1, offy * -1));

         if (opacity < 255)
         {
            sprite.setColor(sf::Color(255, 255, 255, opacity));
         }

         if (rotation > 0.0)
         {
            sprite.setOrigin(sf::Vector2f(rect[2] / 2, rect[3] / 2));
            sprite.setRotation(-rotation);
         }


Actually the position of the sprite is not preserved :/

Pages: [1]
anything