8 , format(Color::Format)
14 if (tex) SDL_DestroyTexture(tex);
17 Texture::Texture(Texture &&other)
22 Texture &Texture::operator =(Texture &&other) {
23 Texture temp(std::move(other));
34 : tex(SDL_CreateTexture(c, f, u, s.x, s.y))
41 void Texture::Swap(Texture &other) {
42 std::swap(tex, other.tex);
43 std::swap(format, other.format);
44 std::swap(size, other.size);
48 void Texture::SetColors(const Color *values) {
49 if (format == Color::Format) {
50 SDL_UpdateTexture(tex, nullptr, values, Size().x * sizeof(Color));
52 // TODO: implement for non-Color pixel formats
57 void Texture::Fill(SDL_Renderer *canv) {
58 SDL_RenderCopy(canv, tex, nullptr, nullptr);
61 void Texture::Copy(SDL_Renderer *canv, Vector<int> to) {
62 Copy(canv, Rect<int>(to, Size()));
65 void Texture::Copy(SDL_Renderer *canv, Rect<int> to) {
66 SDL_RenderCopy(canv, tex, nullptr, &to);