命名规范

This commit is contained in:
2026-07-29 12:30:40 +08:00
parent ae07e67619
commit 5a3511bb58
261 changed files with 8776 additions and 8831 deletions
+59
View File
@@ -0,0 +1,59 @@
#pragma once
#include <QWindow>
#include <memory>
#include "Renderive/architecture/global.h"
namespace renderive {
class LIB_DECL Graphic_Renderable {
public:
virtual ~Graphic_Renderable() = default;
};
class Painter_Renderable : public Graphic_Renderable {
public:
std::unique_ptr<QPixmap> buffer1{};
std::unique_ptr<QPixmap> buffer2{};
bool it = true;
void resize_buffers(const QSize& size) {
buffer1 = std::make_unique<QPixmap>(size);
buffer2 = std::make_unique<QPixmap>(size);
}
void draw() {
if (!buffer1 || !buffer2)
return;
it = !it;
QPixmap* cur = it ? buffer1.get() : buffer2.get();
QPainter painter(cur);
painter.fillRect(cur->rect(), Qt::red);
}
void update_texture() {
QPixmap* cur = it ? buffer1.get() : buffer2.get();
Q_UNUSED(cur)
}
};
class LIB_DECL Opengl_Renderable : public Graphic_Renderable {
public:
void draw();
};
class Graphic : public QWindow {
public:
Graphic();
QVector<Graphic_Renderable*> renderables;
QVector<Painter_Renderable*> painter_buffers;
QVector<Opengl_Renderable*> opengl_buffers;
bool first_resize = true;
protected:
bool event(QEvent*) override;
public:
virtual void create_renderables() {};
void render() {
if (first_resize)
return;
for (Opengl_Renderable* b : opengl_buffers) {
b->draw();
}
for (Painter_Renderable* b : painter_buffers) {
b->draw();
b->update_texture();
}
}
};
} // namespace renderive