General bug fixes (#142)
* Core/Bitset: Fix TestAll method * Fix documentation * Fix color and their conversions * Core/ByteStream: Fix return of Write * Fix compiler warnings * Math/Algorithm: Fix angle normalization * Math/BoundingVolume: Fix lerp * Math: Fix relation between Matrix4 and Quaternion * More tests * X11/Window: Fix mouse moved event generated when doing Mouse::SetPosition * Update ChangeLog * Should fix compilation on Windows * Should fix compilation on Windows Forgot to include array for Windows
This commit is contained in:
committed by
Jérôme Leclercq
parent
f2506ee918
commit
f991a9529e
@@ -312,7 +312,7 @@ namespace Nz
|
||||
/*!
|
||||
* \brief Sets the pattern of the directory
|
||||
*
|
||||
* \param dirPath Pattern of the directory
|
||||
* \param pattern Pattern of the directory
|
||||
*/
|
||||
|
||||
void Directory::SetPattern(const String& pattern)
|
||||
@@ -327,7 +327,7 @@ namespace Nz
|
||||
* \return true if copy is successful
|
||||
*
|
||||
* \param sourcePath Path of the original directory
|
||||
* \param targetPath Path of the copied directory
|
||||
* \param destPath Path of the copied directory
|
||||
*
|
||||
* \remark Produces a NazaraError if could not create destination directory
|
||||
* \remark Produces a NazaraError if could not open origin directory
|
||||
|
||||
@@ -293,7 +293,7 @@ namespace Nz
|
||||
*
|
||||
* \param rects List of rectangles
|
||||
* \param flipped List of flipped rectangles
|
||||
* \param flipped List of inserted rectangles
|
||||
* \param inserted List of inserted rectangles
|
||||
* \param count Count of rectangles
|
||||
* \param merge Merge possible
|
||||
* \param rectChoice Heuristic to use to free
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Nz
|
||||
* \return Raw memory allocated
|
||||
*
|
||||
* \param size Size to allocate
|
||||
* \parma multi Array or not
|
||||
* \param multi Array or not
|
||||
* \param file File of the allocation
|
||||
* \param line Line of the allocation in the file
|
||||
*/
|
||||
|
||||
@@ -718,7 +718,6 @@ namespace Nz
|
||||
* \brief Create an uninitialized value of a set name
|
||||
*
|
||||
* \param name Name of the parameter
|
||||
* \param value Value of the parameter
|
||||
*
|
||||
* \remark The previous value if any gets destroyed
|
||||
*/
|
||||
|
||||
@@ -190,7 +190,7 @@ namespace Nz
|
||||
/*!
|
||||
* \brief Unmounts the plugin with a path
|
||||
*
|
||||
* \param pluginPath Path to the plugin
|
||||
* \param plugin Path to the plugin
|
||||
*
|
||||
* \remark Produces a NazaraError if not initialized
|
||||
* \remark Produces a NazaraError if plugin is not loaded
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Nz
|
||||
{
|
||||
String path = libraryPath;
|
||||
|
||||
unsigned int pos = path.FindLast(".so");
|
||||
size_t pos = path.FindLast(".so");
|
||||
if (pos == String::npos || (path.GetLength() > pos+3 && path[pos+3] != '.'))
|
||||
path += ".so";
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
/*!
|
||||
* \Brief Checks whether the string contains the character
|
||||
* \brief Checks whether the string contains the character
|
||||
* \return true if found in the string
|
||||
*
|
||||
* \param character Single character
|
||||
@@ -311,7 +311,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
/*!
|
||||
* \Brief Checks whether the string contains the "C string"
|
||||
* \brief Checks whether the string contains the "C string"
|
||||
* \return true if found in the string
|
||||
*
|
||||
* \param string String to search
|
||||
@@ -327,7 +327,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
/*!
|
||||
* \Brief Checks whether the string contains the string
|
||||
* \brief Checks whether the string contains the string
|
||||
* \return true if found in the string
|
||||
*
|
||||
* \param string String to search
|
||||
@@ -2244,7 +2244,7 @@ namespace Nz
|
||||
* \brief Gets the word until next separator
|
||||
* \return Word string
|
||||
*
|
||||
* \param start Index to begin the search
|
||||
* \param index Index to begin the search
|
||||
* \param flags Flag for the look up
|
||||
*/
|
||||
|
||||
@@ -2289,7 +2289,7 @@ namespace Nz
|
||||
* \brief Gets the word position
|
||||
* \return Position of the beginning of the word
|
||||
*
|
||||
* \param start Index to begin the search
|
||||
* \param index Index to begin the search
|
||||
* \param flags Flag for the look up
|
||||
*/
|
||||
|
||||
@@ -2729,8 +2729,8 @@ namespace Nz
|
||||
* \brief Replaces the old "C string" by the new one
|
||||
* \return Number of changes
|
||||
*
|
||||
* \param oldCharacter Pattern to find
|
||||
* \param newCharacter Pattern to change for
|
||||
* \param oldString Pattern to find
|
||||
* \param replaceString Pattern to change for
|
||||
* \param start Index to begin the search
|
||||
* \param flags Flag for the look up
|
||||
*/
|
||||
@@ -2744,10 +2744,10 @@ namespace Nz
|
||||
* \brief Replaces the old "C string" by the new one
|
||||
* \return Number of changes
|
||||
*
|
||||
* \param oldCharacter Pattern to find
|
||||
* \param oldString Pattern to find
|
||||
* \param oldLength Length of the old string
|
||||
* \param newCharacter Pattern to change for
|
||||
* \param Length of the new string
|
||||
* \param replaceString Pattern to change for
|
||||
* \param replaceLength of the new string
|
||||
* \param start Index to begin the search
|
||||
* \param flags Flag for the look up
|
||||
*/
|
||||
@@ -2822,8 +2822,8 @@ namespace Nz
|
||||
* \brief Replaces the old string by the new one
|
||||
* \return Number of changes
|
||||
*
|
||||
* \param oldCharacter Pattern to find
|
||||
* \param newCharacter Pattern to change for
|
||||
* \param oldString Pattern to find
|
||||
* \param replaceString Pattern to change for
|
||||
* \param start Index to begin the search
|
||||
* \param flags Flag for the look up
|
||||
*/
|
||||
@@ -2838,7 +2838,7 @@ namespace Nz
|
||||
* \return Number of changes
|
||||
*
|
||||
* \param oldCharacters Pattern to find
|
||||
* \param newCharacter Pattern to change for
|
||||
* \param replaceCharacter Pattern to change for
|
||||
* \param start Index to begin the search
|
||||
* \param flags Flag for the look up
|
||||
*
|
||||
@@ -3646,7 +3646,7 @@ namespace Nz
|
||||
* \return The number of splits
|
||||
*
|
||||
* \param result Resulting tokens
|
||||
* \param separation List of characters of separation
|
||||
* \param separations List of characters for separation
|
||||
* \param start Index for the beginning of the search
|
||||
* \param flags Flag for the look up
|
||||
*/
|
||||
@@ -3687,7 +3687,7 @@ namespace Nz
|
||||
* \return The number of splits
|
||||
*
|
||||
* \param result Resulting tokens
|
||||
* \param separation List of characters of separation
|
||||
* \param separations List of characters for separation
|
||||
* \param start Index for the beginning of the search
|
||||
* \param flags Flag for the look up
|
||||
*/
|
||||
@@ -3885,7 +3885,7 @@ namespace Nz
|
||||
* \brief Returns a sub string of the string from a character
|
||||
* \return SubString
|
||||
*
|
||||
* \param charater Pattern to find
|
||||
* \param character Pattern to find
|
||||
* \param startPos Index for the beginning of the search
|
||||
* \param fromLast beginning by the end
|
||||
* \param include Include the character
|
||||
@@ -3975,7 +3975,7 @@ namespace Nz
|
||||
* \brief Returns a sub string of the string up to a character
|
||||
* \return SubString
|
||||
*
|
||||
* \param charater Pattern to find
|
||||
* \param character Pattern to find
|
||||
* \param startPos Index for the beginning of the search
|
||||
* \param toLast beginning by the end
|
||||
* \param include Include the character
|
||||
@@ -4124,7 +4124,6 @@ namespace Nz
|
||||
* \return true if successful
|
||||
*
|
||||
* \param value Double to convert to
|
||||
* \param flags Flag for the look up
|
||||
*/
|
||||
|
||||
bool String::ToDouble(double* value) const
|
||||
@@ -4143,7 +4142,7 @@ namespace Nz
|
||||
* \return true if successful
|
||||
*
|
||||
* \param value Integer to convert to
|
||||
* \param flags Flag for the look up
|
||||
* \param base Base to convert the integer to
|
||||
*/
|
||||
|
||||
bool String::ToInteger(long long* value, UInt8 base) const
|
||||
@@ -5483,7 +5482,7 @@ namespace Nz
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param os The stream
|
||||
* \param str The string to output
|
||||
*/
|
||||
|
||||
@@ -5523,7 +5522,7 @@ namespace Nz
|
||||
* \return String which is the result of the concatenation
|
||||
*
|
||||
* \param string String to add
|
||||
* \param string String in the right hand side
|
||||
* \param nstring String in the right hand side
|
||||
*/
|
||||
|
||||
String operator+(const char* string, const String& nstring)
|
||||
@@ -5549,7 +5548,7 @@ namespace Nz
|
||||
* \return String which is the result of the concatenation
|
||||
*
|
||||
* \param string String to add
|
||||
* \param string String in the right hand side
|
||||
* \param nstring String in the right hand side
|
||||
*/
|
||||
|
||||
String operator+(const std::string& string, const String& nstring)
|
||||
@@ -5667,7 +5666,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param character Single character in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator==(char character, const String& nstring)
|
||||
@@ -5680,7 +5679,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator==(const char* string, const String& nstring)
|
||||
@@ -5693,7 +5692,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator==(const std::string& string, const String& nstring)
|
||||
@@ -5706,7 +5705,7 @@ namespace Nz
|
||||
* \return false if it is the case
|
||||
*
|
||||
* \param character Single character in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator!=(char character, const String& nstring)
|
||||
@@ -5719,7 +5718,7 @@ namespace Nz
|
||||
* \return false if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator!=(const char* string, const String& nstring)
|
||||
@@ -5732,7 +5731,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator!=(const std::string& string, const String& nstring)
|
||||
@@ -5745,7 +5744,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param character Single character in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator<(char character, const String& nstring)
|
||||
@@ -5758,7 +5757,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator<(const char* string, const String& nstring)
|
||||
@@ -5771,7 +5770,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator<(const std::string& string, const String& nstring)
|
||||
@@ -5784,7 +5783,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param character Single character in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator<=(char character, const String& nstring)
|
||||
@@ -5797,7 +5796,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator<=(const char* string, const String& nstring)
|
||||
@@ -5810,7 +5809,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator<=(const std::string& string, const String& nstring)
|
||||
@@ -5823,7 +5822,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param character Single character in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator>(char character, const String& nstring)
|
||||
@@ -5836,7 +5835,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator>(const char* string, const String& nstring)
|
||||
@@ -5849,7 +5848,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator>(const std::string& string, const String& nstring)
|
||||
@@ -5862,7 +5861,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param character Single character in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator>=(char character, const String& nstring)
|
||||
@@ -5875,7 +5874,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator>=(const char* string, const String& nstring)
|
||||
@@ -5888,7 +5887,7 @@ namespace Nz
|
||||
* \return true if it is the case
|
||||
*
|
||||
* \param string String to compare in left hand side
|
||||
* \param second String to compare in right hand side
|
||||
* \param nstring String to compare in right hand side
|
||||
*/
|
||||
|
||||
bool operator>=(const std::string& string, const String& nstring)
|
||||
|
||||
@@ -26,14 +26,14 @@ namespace Nz
|
||||
auto drawOptions = static_cast<PhysWorld2D::DebugDrawOptions*>(userdata);
|
||||
if (drawOptions->circleCallback)
|
||||
drawOptions->circleCallback(Vector2f(float(pos.x), float(pos.y)), float(angle), float(radius), CpDebugColorToColor(outlineColor), CpDebugColorToColor(fillColor), drawOptions->userdata);
|
||||
};
|
||||
}
|
||||
|
||||
void DrawDot(cpFloat size, cpVect pos, cpSpaceDebugColor color, cpDataPointer userdata)
|
||||
{
|
||||
auto drawOptions = static_cast<PhysWorld2D::DebugDrawOptions*>(userdata);
|
||||
if (drawOptions->dotCallback)
|
||||
drawOptions->dotCallback(Vector2f(float(pos.x), float(pos.y)), float(size), CpDebugColorToColor(color), drawOptions->userdata);
|
||||
};
|
||||
}
|
||||
|
||||
using DebugDrawPolygonCallback = std::function<void(const Vector2f* vertices, std::size_t vertexCount, float radius, Color outlineColor, Color fillColor, void* userdata)>;
|
||||
|
||||
@@ -50,21 +50,21 @@ namespace Nz
|
||||
|
||||
drawOptions->polygonCallback(nVertices.data(), vertexCount, float(radius), CpDebugColorToColor(outlineColor), CpDebugColorToColor(fillColor), drawOptions->userdata);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void DrawSegment(cpVect a, cpVect b, cpSpaceDebugColor color, cpDataPointer userdata)
|
||||
{
|
||||
auto drawOptions = static_cast<PhysWorld2D::DebugDrawOptions*>(userdata);
|
||||
if (drawOptions->segmentCallback)
|
||||
drawOptions->segmentCallback(Vector2f(float(a.x), float(a.y)), Vector2f(float(b.x), float(b.y)), CpDebugColorToColor(color), drawOptions->userdata);
|
||||
};
|
||||
}
|
||||
|
||||
void DrawThickSegment(cpVect a, cpVect b, cpFloat radius, cpSpaceDebugColor outlineColor, cpSpaceDebugColor fillColor, cpDataPointer userdata)
|
||||
{
|
||||
auto drawOptions = static_cast<PhysWorld2D::DebugDrawOptions*>(userdata);
|
||||
if (drawOptions->thickSegmentCallback)
|
||||
drawOptions->thickSegmentCallback(Vector2f(float(a.x), float(a.y)), Vector2f(float(b.x), float(b.y)), float(radius), CpDebugColorToColor(outlineColor), CpDebugColorToColor(fillColor), drawOptions->userdata);
|
||||
};
|
||||
}
|
||||
|
||||
cpSpaceDebugColor GetColorForShape(cpShape* shape, cpDataPointer userdata)
|
||||
{
|
||||
@@ -76,7 +76,7 @@ namespace Nz
|
||||
}
|
||||
else
|
||||
return cpSpaceDebugColor{255.f, 0.f, 0.f, 255.f};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
PhysWorld2D::PhysWorld2D() :
|
||||
|
||||
@@ -55,8 +55,8 @@ namespace Nz
|
||||
OnRigidBody2DRelease(std::move(object.OnRigidBody2DRelease)),
|
||||
m_shapes(std::move(object.m_shapes)),
|
||||
m_geom(std::move(object.m_geom)),
|
||||
m_userData(object.m_userData),
|
||||
m_handle(object.m_handle),
|
||||
m_userData(object.m_userData),
|
||||
m_world(object.m_world),
|
||||
m_isStatic(object.m_isStatic),
|
||||
m_gravityFactor(object.m_gravityFactor),
|
||||
|
||||
@@ -58,7 +58,8 @@ namespace Nz
|
||||
m_parent(parent),
|
||||
m_smoothScrolling(false),
|
||||
m_mousePos(0, 0),
|
||||
m_keyRepeat(true)
|
||||
m_keyRepeat(true),
|
||||
m_lastSequence(0)
|
||||
{
|
||||
std::memset(&m_size_hints, 0, sizeof(m_size_hints));
|
||||
}
|
||||
@@ -1244,9 +1245,12 @@ namespace Nz
|
||||
{
|
||||
xcb_motion_notify_event_t* motionNotifyEvent = (xcb_motion_notify_event_t*)windowEvent;
|
||||
|
||||
if (m_mousePos.x == motionNotifyEvent->event_x && m_mousePos.y == motionNotifyEvent->event_y)
|
||||
// We use the sequence to determine whether the motion is linked to a Mouse::SetPosition
|
||||
if ((m_mousePos.x == motionNotifyEvent->event_x && m_mousePos.y == motionNotifyEvent->event_y) || m_lastSequence == motionNotifyEvent->sequence)
|
||||
break;
|
||||
|
||||
m_lastSequence = motionNotifyEvent->sequence;
|
||||
|
||||
WindowEvent event;
|
||||
event.type = Nz::WindowEventType_MouseMoved;
|
||||
event.mouseMove.deltaX = motionNotifyEvent->event_x - m_mousePos.x;
|
||||
|
||||
@@ -113,6 +113,7 @@ namespace Nz
|
||||
bool m_threadActive;
|
||||
Vector2i m_mousePos;
|
||||
bool m_keyRepeat;
|
||||
uint16_t m_lastSequence;
|
||||
|
||||
struct
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user