Move windows to uptr. Add simple text editing.

This commit is contained in:
jmsgrogan 2020-06-20 16:34:10 +01:00
parent 2bcc7b3d83
commit b99708e7d3
55 changed files with 1257 additions and 994 deletions

View file

@ -1,36 +1,47 @@
#include "Color.h"
Color::Color(unsigned r, unsigned g, unsigned b, double a)
: mR(r),
mG(g),
mB(b),
mAlpha(a)
: mR(r),
mG(g),
mB(b),
mAlpha(a)
{
}
std::shared_ptr<Color> Color::Create(unsigned r, unsigned g, unsigned b,
double a )
std::shared_ptr<Color> Color::CreateShared(unsigned r, unsigned g, unsigned b,
double a )
{
return std::make_shared<Color>(r, g, b, a);
return std::make_shared<Color>(r, g, b, a);
}
unsigned Color::GetR()
std::unique_ptr<Color> Color::Create(unsigned r, unsigned g, unsigned b,
double a )
{
return mR;
return std::make_unique<Color>(r, g, b, a);
}
unsigned Color::GetG()
std::unique_ptr<Color> Color::Create(const Color& color)
{
return mG;
return std::make_unique<Color>(color);
}
unsigned Color::GetB()
unsigned Color::GetR() const
{
return mB;
return mR;
}
double Color::GetAlpha()
unsigned Color::GetG() const
{
return mAlpha;
return mG;
}
unsigned Color::GetB() const
{
return mB;
}
double Color::GetAlpha() const
{
return mAlpha;
}

View file

@ -3,21 +3,23 @@
class Color
{
unsigned mR;
unsigned mG;
unsigned mB;
double mAlpha;
unsigned mR;
unsigned mG;
unsigned mB;
double mAlpha;
public:
Color(unsigned r, unsigned g, unsigned b, double a = 1.0);
Color(unsigned r, unsigned g, unsigned b, double a = 1.0);
static std::shared_ptr<Color> CreateShared(unsigned r, unsigned g, unsigned b, double a = 1.0);
static std::unique_ptr<Color> Create(unsigned r, unsigned g, unsigned b, double a = 1.0);
static std::unique_ptr<Color> Create(const Color& color);
static std::shared_ptr<Color> Create(unsigned r, unsigned g, unsigned b, double a = 1.0);
unsigned GetR();
unsigned GetG();
unsigned GetB();
double GetAlpha();
unsigned GetR() const;
unsigned GetG() const;
unsigned GetB() const;
double GetAlpha() const;
};
using ColorPtr = std::shared_ptr<Color>;
using ColorUPtr = std::unique_ptr<Color>;