This repository has been archived on 2024-06-01. You can view files and clone it, but cannot push or open issues or pull requests.
cathook/include/visual/atlas.hpp
2017-12-02 17:47:47 +03:00

57 lines
897 B
C++

/*
* atlas.hpp
*
* Created on: May 20, 2017
* Author: nullifiedcat
*/
#ifndef ATLAS_HPP_
#define ATLAS_HPP_
#include "common.hpp"
#include "visual/drawex.hpp"
namespace textures
{
class texture_atlas;
class sprite;
class sprite
{
public:
sprite(float x, float y, float w, float h, const texture_atlas &atlas);
public:
void draw(float scrx, float scry, float scrw, float scrh,
const rgba_t &rgba) const;
public:
const float nx;
const float ny;
const float nw;
const float nh;
const texture_atlas &atlas;
};
class texture_atlas
{
public:
texture_atlas(std::string filename, float width, float height);
public:
sprite create_sprite(float x, float y, float sx, float sy) const;
public:
const float width;
const float height;
draw_api::texture_handle_t texture;
};
texture_atlas &atlas();
}
#endif /* ATLAS_HPP_ */