### 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 - achpile

Pages: [1] 2 3 ... 15
1
##### SFML projects / Dispersio 2
« on: April 09, 2019, 01:00:37 pm »
Actually it's 3, but i renamed the 2 to 3, so it's 2 now
So i decided to take a short break on my previous project and i will probably release this one earlier - so I had to rename them

This game will be very similar to the first one, but instead of different abilities on each level you will face different obstacles. I hope to make it as good as first one - and same hard as well

2
##### Graphics / Re: sf::Rect
« on: September 11, 2018, 11:00:39 am »
Quote
There's no truth, only conventions.

So I guess topic can be closed

3
##### Graphics / Re: sf::Rect
« on: September 11, 2018, 10:45:11 am »
Quote
It doesn't, because by convention, point (2, 2) belongs to pixel (2, 2).

But it also belongs to pixels (1,1), (1,2) and (2,1)

4
##### Graphics / Re: sf::Rect
« on: September 11, 2018, 10:27:38 am »
Well, this is not for integer coordinates. This is for pixels.
As i said in example - let's take a look at 2x2 rectangle.
And what is pixel? It's 1x1 square. So 2x2 square will contain 4 pixels (0,0), (1,0), (0,1) and (1,1)
But pixel is not a point - it's a square.

Will 2x2 rect contain pixel (2,2)? No
Will 2x2 rect contain point (2,2)? Yes

So this is not clear in Rect class - if you work with points or pixels. In function call it called a point, but actually it isn't.

And, well, if nobody cares about that - i won't too.

5
##### Graphics / Re: sf::Rect
« on: September 11, 2018, 09:30:52 am »
Just let's take a simple example....

I have rectangle. Based on 4 points. (0,0), (0,2), (2,2) and (2,0)

The length of each side is 2.
Does it contain point (0,0) ? Yes, it does.
Does it contain point (2,2) ? Yes, it does.

All you said is right only if you use sf::IntRect to store array dimentions, but not as a geometry object

6
##### Graphics / Re: sf::Rect
« on: September 11, 2018, 09:19:28 am »
Quote
If you can't understand that then think about arrays

Don't mix up the size of an array (amount of elements) and length of a line.
In geometry rectangle contains all 4 points. And all points on the edges.

PS: i'm not talking about which pixels are included and which are not. I was talking about FloatRect

7
##### Graphics / Re: sf::Rect
« on: September 10, 2018, 09:10:49 pm »
Imagine Left=0 and Width=5. The 5 horizontal points in your rectangle would then be 0, 1, 2, 3, 4.

Now imagine x=5. (x < Left + Width) becomes (5 < 0 + 5), which will evaluate to false. This is correct because the horizontal point 5 is not in the rectangle. If it were "<=" then it would incorrectly evaluate to true.

left = 0; width = 5;
width 5 is 0-1, 1-2, 2-3, 3-4, 4-5

width of 0-4 is 4, not 5.

Dude, learn math please before posting here

8
##### Graphics / sf::Rect
« on: September 10, 2018, 08:24:07 pm »
Hey guys! Just got an issue with rect class.... Can someone explain this please?
Commit:

commit 082a928555125e37cc52a80c11cf286f0b03dee5
Author: LaurentGom <LaurentGom@4e206d99-4929-0410-ac5d-dfc041789085>
Date:   Fri Apr 9 13:04:49 2010 +0000

*important* sf::Rect now uses Width/Height instead of Right/Bottom
Removed Offset, GetSize and GetCenter functions from sf::Rect
Added a sf::Rect constructor taking two Vector2 parameters
Updated the API documentation of the sf::Rect class

template <typename T>
bool Rect<T>::Contains(T x, T y) const
{
-    return (x >= Left) && (x <= Right) && (y >= Top) && (y <= Bottom);
+    return (x >= Left) && (x < Left + Width) && (y >= Top) && (y < Top + Height);
}

Why changed "<=" to "<"?

9
##### SFML projects / Re: A-Maze Batz
« on: September 07, 2018, 06:35:59 pm »
Oh wow, that looks very nice!

10
##### Feature requests / Re: sf::Rect extension
« on: September 07, 2018, 10:57:09 am »
Also i think it would be also good to have function like this:

bool    contains (const Rect< T > &rectangle) const

Because now i have to use like this:

if (rect.contains(r.left, r.top) && rect.contains(r.left + r.width, r.top + r.height))

or this:

if (rect.intersects(r, intersection) && (r == intersection))

11
##### Graphics / Re: Access violation writing location
« on: August 17, 2018, 02:32:37 pm »
Isn't this because "sf::Texture texture;" declared inside the function and when function returns the value - destructor cleans some internal data?

try better this:

void loadTexture(sf::Texture *texture, const std::string& path)
{
{
throw std::runtime_error("Could not open file: " + path);
}
}

int main()
{
sf::Texture gameFieldTexture;
return 0;
}

12
##### General / Re: Friends can't open my games
« on: August 09, 2018, 05:26:07 pm »
at first you should provide errors text to get help

13
##### SFML projects / Re: Dispersio 2
« on: August 06, 2018, 03:39:14 pm »
Finally i hope i get back to this project So, all i have now is in this video Now it's time to make a content!

14
##### SFML wiki / Re: SFML dynamic color tile-based lighting
« on: June 16, 2018, 05:35:57 pm »
I don't think that your message related to this topic

15
##### SFML projects / Re: Screenshot Thread
« on: March 15, 2018, 02:29:49 pm »
Used only straight lines to draw (Except outline circle)

Source: https://github.com/achpile/math/tree/master/lines

Inspired by this:
(click to show/hide)

Pages: [1] 2 3 ... 15