micromenu/inc/gfx/canvas.h

43 lines
649 B
C
Raw Normal View History

2018-11-01 18:39:19 +00:00
//
// Created by jedi on 11/1/18.
//
#ifndef MGL_DMXMENU_CANVAS_H
#define MGL_DMXMENU_CANVAS_H
2018-11-05 20:09:01 +00:00
#include "hal/hal.h"
2018-11-01 18:39:19 +00:00
#include "gfx/font.h"
2018-11-02 08:27:20 +00:00
#include "fonts/basic_5x4.h"
2018-11-05 20:49:40 +00:00
#include "gfx/buffer.h"
2018-11-05 09:53:59 +00:00
class screen;
2018-11-01 18:39:19 +00:00
class canvas {
private:
const int width_;
const int height_;
2018-11-05 20:49:40 +00:00
buffer<_1bit> buffer_;
2018-11-05 09:53:59 +00:00
void draw_onto_(screen &);
2018-11-01 18:39:19 +00:00
public:
2018-11-02 08:36:41 +00:00
canvas(int w, int h);
2018-11-01 18:39:19 +00:00
2018-11-05 09:53:59 +00:00
void clear();
2018-11-02 08:36:41 +00:00
void draw(int x, int y);
2018-11-01 18:39:19 +00:00
2018-11-05 09:53:59 +00:00
void print(int x, int y, const char *str, font & = basic_5x4);
void print(int x, int y, char *str, font & = basic_5x4);
2018-11-01 18:39:19 +00:00
2018-11-05 20:09:01 +00:00
int getWidth();
int getHeight();
2018-11-05 09:53:59 +00:00
friend screen;
2018-11-01 18:39:19 +00:00
};
#endif //MGL_DMXMENU_CANVAS_H