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

Pages: [1]
1
Graphics / Re: Dealing with large textures
« on: December 07, 2016, 11:02:27 pm »
I'm not an expert but I got the same error when i was developing a game for android and I solved my problem using a smaller texture and repeat it.

There are several techniques to solve your problem, but they depend on it. Games like zelda or mario usually use tile maps. Here you have an excellent SFML example ;) http://www.sfml-dev.org/tutorials/2.4/graphics-vertex-array.php

2
Graphics / Re: How to compute AABB of circle shape with sf::Transform
« on: December 03, 2016, 08:34:49 pm »
Question is why you'd want an AABB for a circle?

Hahaha, you're question made me feel like a fool. XD. So well, I'm trying to check collisions using AABB method. Maybe is easier check collisions between a circle and an AABB instead of compute the AABB of a circle, but I didn't think that when I was trying to achieve it.

I don't know if there's an "exact" method for computing the bounding box of a transformed circle, but at least you can do the same as for your other shapes: convert it to a polygon (that's what you do for drawing it anyway, right?) and apply the same process.

I think in that option but maybe is not very efficient. Well, I thought create a regular polygon with a big number of vertex.

The rectangle axis-aligned bounding box contained the circle that you create (the FloatRect) - when rotated - results in a rotated rectangle and the axis-aligned bounding box of the rotated rectangle is larger than the unrotated rectangle.

You're right. Thanks. If you scale the sf::Transform, you will scale the circle radius too.

Well, finally i solved it.

I must to transform the position of the circle and then scale its radius. [SOLVED]

3
Graphics / How to compute AABB of circle shape with sf::Transform [SOLVED]
« on: December 02, 2016, 09:08:39 pm »
Hi guys, so, I'm developing a CircleShape class for collisions and it's defined by radius only. I have other classes such as EdgeShape and PolygonShape.

In EdgeShape and PolygonShape I transform the verteices that define them and then calculate minX, maxX, minY and maxY to create de AABB (someone like sf::FloatRect). Everything works perfectly.

The problem comes computing the AABB from the CircleShape. I tried with this code:
    AABB CircleShape::getAABB (const sf::Transform &transform)
   {
       return transform.transformRect (sf::FloatRect (0, 0, radius * 2.f, radius * 2.f));
   }
 

but when I rotate it, its width and height increase, and that is not correct.

Thanks!!   ;D

Pages: [1]