mirror of
https://github.com/love2d/love.git
synced 2026-08-12 16:40:57 +02:00
Fixed the color set by love.graphics.setColor not being restored properly when love.graphics.pop is called after love.graphics.push("all").
This commit is contained in:
@@ -44,11 +44,26 @@ struct ColorT
|
||||
a = a_;
|
||||
}
|
||||
|
||||
bool operator==(const ColorT<T> &other) const;
|
||||
bool operator!=(const ColorT<T> &other) const;
|
||||
|
||||
ColorT<T> operator+=(const ColorT<T> &other);
|
||||
ColorT<T> operator*=(T s);
|
||||
ColorT<T> operator/=(T s);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
bool ColorT<T>::operator==(const ColorT<T> &other) const
|
||||
{
|
||||
return r == other.r && g == other.g && b == other.b && a == other.a;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool ColorT<T>::operator!=(const ColorT<T> &other) const
|
||||
{
|
||||
return !(operator==(other));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
ColorT<T> ColorT<T>::operator+=(const ColorT<T> &other)
|
||||
{
|
||||
|
||||
@@ -131,11 +131,10 @@ void Graphics::restoreStateChecked(const DisplayState &s)
|
||||
{
|
||||
const DisplayState &cur = states.back();
|
||||
|
||||
if (*(uint32 *) &s.color.r != *(uint32 *) &cur.color.r)
|
||||
if (s.color != cur.color)
|
||||
setColor(s.color);
|
||||
|
||||
if (*(uint32 *) &s.backgroundColor.r != *(uint32 *) &cur.backgroundColor.r)
|
||||
setBackgroundColor(s.backgroundColor);
|
||||
setBackgroundColor(s.backgroundColor);
|
||||
|
||||
if (s.blendMode != cur.blendMode || s.blendMultiplyAlpha != cur.blendMultiplyAlpha)
|
||||
setBlendMode(s.blendMode, s.blendMultiplyAlpha);
|
||||
|
||||
@@ -106,18 +106,12 @@ private:
|
||||
|
||||
struct Vibration
|
||||
{
|
||||
float left, right;
|
||||
SDL_HapticEffect effect;
|
||||
Uint16 data[4];
|
||||
int id;
|
||||
|
||||
Uint32 endtime;
|
||||
|
||||
Vibration()
|
||||
: left(0.0f), right(0.0f)
|
||||
, effect(), data(), id(-1)
|
||||
, endtime(SDL_HAPTIC_INFINITY)
|
||||
{}
|
||||
float left = 0.0f;
|
||||
float right = 0.0f;
|
||||
SDL_HapticEffect effect = {};
|
||||
Uint16 data[4] = {0};
|
||||
int id = -1;
|
||||
Uint32 endtime = SDL_HAPTIC_INFINITY;
|
||||
|
||||
} vibration;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user