Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <Windows.h>
- #include <utility>
- #include <vector>
- #include "Sprite.h"
- namespace ulib
- {
- namespace canvas
- {
- using position = std::pair<int, int>;
- enum TEXT_ATTRIBUTES
- {
- TEXT_DARKBLUE = 0x0001,
- TEXT_DARKGREEN = 0x0002,
- TEXT_DARKRED = 0x0004,
- TEXT_INTENSITY = 0x0004,
- };
- enum BACKDROP_ATTRIBUTES
- {
- BACKDROP_BLUE = 0x0010,
- BACKDROP_GREEN = 0x0020,
- BACKDROP_RED = 0x0040,
- BACKDROP_INTENSITY = 0x0040,
- };
- struct WindowInfo
- {
- HANDLE WriteHandle;
- HANDLE ReadHandle;
- SMALL_RECT WindowSize;
- COORD BufferSize;
- COORD CharBufferSize;
- COORD CharPosition;
- SMALL_RECT WriteArea;
- CHAR_INFO *Buffer;
- ~WindowInfo()
- {
- delete Buffer;
- }
- };
- class Canvas
- {
- private:
- WindowInfo info;
- std::vector<Sprite> sprites;
- std::vector<Shader> shaders;
- public:
- Canvas(short width, short height)
- {
- Init(width, height);
- }
- void Init(short width, short height);
- void Update();
- void Clear();
- void Display();
- void Draw(Sprite&, const unsigned short& = 1, position = { 0, 0 });
- void Draw(const std::string&, const unsigned short& = 0x0004, position = { 0, 0 });
- void Draw(const std::vector<std::string>&, const unsigned short& = 1, position = { 0, 0 });
- };
- }
- using namespace canvas;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement