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

Pages: 1 [2] 3 4 ... 16
16
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

17
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

18
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 "<"?

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

20
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))
 

21
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)
{
        if (!texture->loadFromFile(path))
        {
                throw std::runtime_error("Could not open file: " + path);
        }
}

int main()
{
        sf::Texture gameFieldTexture;
        loadTexture(&gameFieldTexture, "graphics/field.png");
        return 0;
}
 

22
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  :)

23
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!


24
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

25
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)

26
SFML projects / Re: ReJewel
« on: January 31, 2018, 01:03:16 am »
Btw i dunno why tetris... it's bejeweled

27
SFML projects / Re: ReJewel - Релиз
« on: January 31, 2018, 01:02:08 am »
Would be great if you could add some English text, so everyone can understand the game's description. :)

Dedicated to all tetris fans
Created using C++ and SFML

OS: Windows 7 and newer
Genre: Logic
Developer: Redee
Current state: beta
All links are in the description!!!

28
General / Re: Game Loop Lag
« on: December 26, 2017, 09:46:14 pm »
probably this


        delay = carry + timer.getElapsedTime().asMilliseconds();
        if(delay >= MSPF) {
            timer.restart();
            while(delay >= MSPF) {
                update();
                delay -= MSPF;
            }
            carry = delay;
        }


just use RenderWindow::setFramerate (or how is it called)

29
General / Re: Game Physics
« on: December 16, 2017, 08:27:19 am »
Oh sorry. Not acceseration, but speed.
For example i have gravity acceleration 1000.0f, so if player jumps - I just set his speed.y to -375

30
General / Re: Game Physics
« on: December 15, 2017, 09:02:21 pm »
Hello, I am trying to make a platforming game, I have all of the other physics set up BUT jumping.
To put it simply , I want to know how to make an entity go up for a little bit then down.
               
 

just set acceleration to -<jump power>

Pages: 1 [2] 3 4 ... 16
anything