Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: OniLink Tries to fix Bugs in Tasklist  (Read 2558 times)

0 Members and 1 Guest are viewing this topic.

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
OniLink Tries to fix Bugs in Tasklist
« on: June 06, 2010, 11:55:19 pm »
Alright, so since Laurent seems to be busy, I decided to use my amazingly large amount of free time to fix whatever bugs in the tasklist that I can. The first bug I tried to fix was #160. Lines 450 to 454 in WindowImplWin32.cpp were changed to this:
Code: [Select]
// Resize event
case WM_SIZE :
{
    // Update window size
    RECT rectangle;
    GetClientRect(myHandle, &rectangle);
    myWidth  = rectangle.right - rectangle.left;
    myHeight = rectangle.bottom - rectangle.top;

    if (myWidth != 0 && myHeight != 0){
        Event event;
        event.Type        = Event::Resized;
        event.Size.Width  = myWidth;
        event.Size.Height = myHeight;
        PushEvent(event);
    }
    break;
}

I would assume this would fix the bug. I will be going through the tasklist and fix whatever bugs I can.
I use the latest build of SFML2

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Vector2 Functions
« Reply #1 on: June 07, 2010, 12:32:18 am »
Added Length() and Normalize() to sf::Vector2<T>. The code in the header is before the member data and is
Code: [Select]
////////////////////////////////////////////////////////////
/// \brief Get the length of the vector
///
/// \return The length of the vector
////////////////////////////////////////////////////////////
T Length();

////////////////////////////////////////////////////////////
/// \brief Normalize the length of the vector to 1
////////////////////////////////////////////////////////////
void Normalize();

The code in the inline include is just after the constructors and is
Code: [Select]
////////////////////////////////////////////////////////////
template <typename T>
inline T Vector2<T>::Length()
{
return sqrt(x*x+y*y);
}


////////////////////////////////////////////////////////////
template <typename T>
inline void Vector2<T>::Normalize()
{
x /= Length();
y /= Length();
}


Going to add these to Vector3 next, and probably going to add Dot and Cross Products. The question is, how should I implement to Dot and Cross Products? As a global function or an inline static member function?
I use the latest build of SFML2

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Vector3
« Reply #2 on: June 07, 2010, 02:37:31 am »
Added the Length and Normalize functions to Vector3 with these lines in header
Code: [Select]
////////////////////////////////////////////////////////////
/// \brief Get the length of the vector
///
/// \return The length of the vector
////////////////////////////////////////////////////////////
T Length();

////////////////////////////////////////////////////////////
/// \brief Normalize the length of the vector to 1
////////////////////////////////////////////////////////////
void Normalize();

and these lines in the inline file
Code: [Select]
////////////////////////////////////////////////////////////
template <typename T>
inline T Vector3<T>::Length(){
return sqrt(x*x+y*y+z*z);
}


////////////////////////////////////////////////////////////
template <typename T>
inline void Vector3<T>::Normalize(){
x /= Length();
y /= Length();
z /= Length();
}
I use the latest build of SFML2

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
OniLink Tries to fix Bugs in Tasklist
« Reply #3 on: June 07, 2010, 08:25:26 am »
Hi

Thank you very much, but things are not going to be faster than if I did it myself. As you can see, it's just a few lines of code and it will take me the same amount of time to apply your patches.

I know that it may sound rude, especially for an open-source project, but I prefer doing things myself. The main reason is that I want to think about every single task to make sure that I'm not missing anything. For example, your first patch is the wrong way to go. The code must test lParam (there is a special value for the minimize event), so that we don't ignore other potential valid situations where the size can really be zero. I also have to test this behaviour on Linux, and write a patch if the same thing happens.

Something else: you're not following my coding rules, so I'd have to review your code and adjust it (ok, this is not really a big deal here, but imagine a patch of hundreds of lines).

Regarding the vector functions, I'm still thinking about what to add and how to add it. It's really not that I don't have the time or the skills to add these 4 lines of code :)

But thanks for your help, I really appreciate and I feel a little guilty to give you this answer.
Laurent Gomila - SFML developer

 

anything