43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
#pragma once
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
#include "font.h"
|
|
#include "rect.h"
|
|
#include "resource.h"
|
|
#include "vec2.h"
|
|
|
|
using color = uint32_t;
|
|
struct ini;
|
|
|
|
struct image : resource {
|
|
image(resource_manager& rm, ini_category const* ini, std::string const& path, std::vector<uint8_t> const& data);
|
|
image(image const& other);
|
|
image(vec2i size);
|
|
image(vec2i size, color* data);
|
|
~image();
|
|
//static image_from_pointer()
|
|
|
|
vec2i const& size() const;
|
|
recti const& bounds() const;
|
|
|
|
color* raw_pointer() const;
|
|
color get(vec2i pos) const;
|
|
|
|
void clear(color color);
|
|
|
|
void draw(image const* image, vec2i pos);
|
|
void draw(image const* image, vec2i pos, recti src_rect);
|
|
void draw(image const* image, vec2i pos, color color);
|
|
void draw(image const* image, vec2i pos, color color, recti src_rect);
|
|
void draw_upscaled(image const* image);
|
|
|
|
void draw(std::string const& str, vec2i pos, font const* font, color color);
|
|
void draw(std::string const& str, vec2i pos, font const* font, color color1, color color2);
|
|
private:
|
|
bool _alpha;
|
|
bool _borrowed_pointer; //to know if to free or not
|
|
color* _data; //not a vector so can wrap sdl surfaces
|
|
recti _bounds;
|
|
};
|