38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
#pragma once
|
||
#include "../global/Base.h"
|
||
#include "../global/Config.h"
|
||
#include "FrameBuffer.h"
|
||
#include"../image/image.h"
|
||
#include"../event/event.h"
|
||
|
||
/*
|
||
* class GPU:
|
||
* 模拟GPU的图形库
|
||
*/
|
||
|
||
class GPU {
|
||
public:
|
||
GPU();
|
||
|
||
~GPU();
|
||
|
||
//接受外界传入的bmp对应的内存指针以及窗体的宽/高(图形库绑定硬件驱动)
|
||
void initGL(const uint32_t& width, const uint32_t& height, void* buffer = nullptr);
|
||
|
||
//清除画布内容
|
||
void clear();
|
||
|
||
//传入像素位置,绘制成某种颜色
|
||
void drawPoint(const int& x, const int& y, const RGBA& color, const float& depth = 0);
|
||
|
||
void drawVerticalLine(const int& x, const int& y_min, const int y_max, const RGBA& color, const float& depth = 0.);
|
||
void drawRect(const int& x_min, const int x_max, const int y_min, const int y_max, const RGBA& color, const float& depth = 0.);
|
||
void drawLine(const int& x_from, const int& y_from, const int& x_to, const int& y_to, const RGBA& color, const float& depth = 0.);
|
||
public:
|
||
int m_screenWidth;
|
||
int m_screenHeight;
|
||
Event<int> test; //for-test
|
||
private:
|
||
|
||
FrameBuffer* mFrameBuffer{ nullptr }; //存储当前画布对应的bmp的内存指针,作为当前绘图画板
|
||
}; |